Repository navigation
docs: split slice design approaches into content, function and tier #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
54dda60
docs: split slice design approaches into content, function and tier
lczyk 240aaad
docs: point slice examples at 26.04
lczyk 65eac11
docs: remove outdated yaml example from slice design tiers
lczyk 3c195cb
docs: clarify use of standard vs core slices
lczyk 7f182ce
docs: move note on mixing slice design approaches to the end
lczyk 730db9d
docs: match slice design approach names to headings
lczyk 91089b6
docs: reserve tier slice names
lczyk a781035
Merge remote-tracking branch 'canonical/main' into feat/slice-design-…
lczyk c80661e
Apply batched suggestions from code review
lczyk e294af3
docs: address review comments
lczyk 7fdcaa1
docs: turn mixing slice design approaches into a note
lczyk 8a7abfa
docs: tidy slice tier wording
lczyk 546e37c
Merge branch 'main' into feat/slice-design-approaches-update
asanvaq 7645e02
Update docs/explanation/slice-design-approaches.md
lczyk 550ddf4
Update docs/explanation/slice-design-approaches.md
lczyk e4c7c6f
docs: move slice approach mixing note into intro
lczyk 8061a73
feat: update explanation of slice design approaches
lczyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,111 @@ | ||
| --- | ||
| myst: | ||
| html_meta: | ||
| description: "Explanation of the two slice design approaches in Chisel: grouping by content type (bins, libs) or by functionality (minimal, core, standard)." | ||
| description: "Explanation of the three slice design approaches in Chisel: grouping by content type (bins, libs), function (crypto, internet) or tier (minimal, core)." | ||
| --- | ||
|
|
||
| (slice_design_approaches)= | ||
|
|
||
| # Slice design approaches | ||
|
|
||
| There are two approaches to design slices: **grouping by content** and **grouping by function**. Depending on the package, one of these approaches might be more suitable. It is up to the user to choose a preferred approach. | ||
| There are three approaches to design slices: **grouping by type of content**, | ||
| **grouping by function** and **grouping by tier**. Depending on the package, | ||
| one of these approaches might be more suitable. It is up to the user to choose | ||
| a preferred approach. | ||
|
|
||
| Whichever the approach, the slices do not have to cover all the contents of a | ||
| package. It is fine to leave out files that no slice needs, such as manual pages | ||
| or examples. | ||
|
|
||
| ```{note} | ||
| These approaches can be combined in one slice definitions file. For example, | ||
| the | ||
| [`systemd` slice definitions file](https://github.com/canonical/chisel-releases/blob/ubuntu-26.04/slices/systemd.yaml) | ||
| uses tier slices (`standard`, `dev`), function slices (`journal`, `login`, | ||
| `dbus-services`) and a content type slice (`config`). | ||
| ``` | ||
|
|
||
| (slice_design_approaches_content)= | ||
|
|
||
| ## Grouping by type of content | ||
|
|
||
| This means putting all the binaries together in one slice, all the libraries together in another slice, and so on. | ||
| A good example is the [`dpkg` slice definitions file](https://github.com/canonical/chisel-releases/blob/ubuntu-24.04/slices/dpkg.yaml). | ||
| This means putting all the binaries together in one slice, all the libraries | ||
| together in another slice, and so on. A good example is the | ||
| [`dpkg` slice definitions file](https://github.com/canonical/chisel-releases/blob/ubuntu-26.04/slices/dpkg.yaml). | ||
|
|
||
| In this case, the best practice is to create: | ||
|
|
||
| In this case, the best practice is to create: | ||
| - a `bins` slice which contains all the binaries | ||
| - a `libs` slice which contains all the libraries | ||
| - a `config` slice which contains all [configuration files](#create_sdf_inspect_pkg_conffiles) | ||
| - a `scripts` slice which contains ASCII executable scripts, e.g. Python, | ||
| Perl scripts | ||
| - other slices analogously (e.g. `data`, `modules`, `services`, etc) | ||
|
|
||
| - a `bins` slice which contains all the binaries | ||
| - a `libs` slice which contains all the libraries | ||
| - a `config` slice which contains all [configuration files](#create_sdf_inspect_pkg_conffiles) | ||
| - a `scripts` slice which contains ASCII executable scripts, e.g. Python, | ||
| Perl scripts | ||
| - other slices analogously (e.g. `data`, `modules`, `services`, etc) | ||
| You may split the above slices into more granular ones, but you should | ||
| reserve the above as a catch-all for their respective types. | ||
|
|
||
| You may split the above slices into more granular ones, but you should | ||
| reserve the above as a catch-all for their respective types. | ||
| (slice_design_approaches_function)= | ||
|
|
||
| ## Grouping by function | ||
|
|
||
| This means grouping the contents into slices that deliver a specific | ||
| functionality. For example, the | ||
| [`python3` slice definitions file](https://github.com/canonical/chisel-releases/blob/ubuntu-24.04/slices/python3.yaml) | ||
| has a `core` slice providing a very minimal `python3` runtime, but also a | ||
| `standard` slice with the additional libraries on top of `core`. | ||
|
|
||
| In this case, the most common is to create: | ||
|
|
||
| - A `minimal` slice that offers a stripped down installation, to the absolute essentials, to make the software | ||
| work. In most cases, such a minimal installation may only be useful if used as a base for another installation/ | ||
| build, where the developer adds their own additional dependencies. Taking the above `python3` example, this slice | ||
| would only contain the necessary dependencies to run a trivial "Hello World" script, and not much more. | ||
| - A `core` slice that offers a more complete, though still relatively slim installation. Although slightly larger | ||
| than minimal, core installations are meant to cover the majority of simple use cases, while also being a small and | ||
| ideal base to be extended for more complex use cases. Using `python3` as an example again, this slice could only | ||
| contain the topmost referenced modules in the standard library. | ||
| - A `standard` slice that provides a normal installation, supporting the full operation of the application, | ||
| including all the runtime libs/modules and additional utilities, but possibly still leaving out things like | ||
| debugging and development utilities. | ||
| - A `dev` slice which is the `standard` slice, plus all the debugging and dev utilities. A close-to full-size | ||
| installation, designed for development environments, but not production. | ||
| - Other slices which are scoped and named after the functionality they | ||
| provide (e.g. see the | ||
| [`libpython3.12-stdlib` slices](https://github.com/canonical/chisel-releases/blob/ubuntu-24.04/slices/libpython3.12-stdlib.yaml)). | ||
| This means grouping the contents into slices that deliver a specific | ||
| functionality, and naming each slice after the functionality it provides. For | ||
| example, the | ||
| [`libpython3.14-stdlib` slice definitions file](https://github.com/canonical/chisel-releases/blob/ubuntu-26.04/slices/libpython3.14-stdlib.yaml) | ||
| splits the Python standard library into slices such as `crypto`, | ||
| `concurrency` and `internet`. | ||
|
|
||
| Such slices are best kept small and single-purpose, so that users can install | ||
| just the functionality they need on top of a base installation. | ||
|
|
||
| (slice_design_approaches_tier)= | ||
|
|
||
| ## Grouping by tier | ||
|
|
||
| This means grouping the contents into slices of increasing completeness, where | ||
| each tier is a superset of the previous one. For example, the | ||
| [`python3` slice definitions file](https://github.com/canonical/chisel-releases/blob/ubuntu-26.04/slices/python3.yaml) | ||
| has a `core` slice providing a small `python3` runtime, but also a | ||
| `standard` slice with the additional libraries on top of `core`. | ||
|
|
||
| In this case, the most common approach is to create: | ||
|
|
||
| - A `minimal` slice that offers a stripped down, base installation, with the | ||
| absolute bare minimum which still retains the identity of the package. In | ||
| most cases, such a minimal installation may only be useful if used as a base | ||
| for another installation/build, where the developer adds their own | ||
| additional dependencies. Taking the above `python3` example, this slice would | ||
| only contain a runtime with no standard library, able to run a trivial "Hello | ||
| World" script, and not much more. | ||
| - A `core` slice that offers what is needed for basic functionality, and | ||
| nothing more. Although slightly larger than `minimal`, `core` installations | ||
| are meant to cover the majority of simple use cases, while also being a small | ||
| and ideal base to be extended for more complex use cases. Using `python3` as | ||
| an example again, this slice could only contain the topmost referenced | ||
| modules in the standard library. | ||
| - A `standard` slice that provides what most users would expect from a normal | ||
| installation, supporting the full operation of the application, including all | ||
| the runtime libs/modules and additional utilities. It still does not include | ||
| everything, leaving out things like manual pages, examples, and debugging and | ||
| development utilities. | ||
| - A `dev` slice that includes all the debugging and dev utilities. A | ||
| close-to full-size installation, designed for development environments, but | ||
| not production. For example, the `systemd_dev` slice adds tools such as | ||
| `busctl` and `systemd-cgls` on top of `systemd_standard`. | ||
|
|
||
| You should reserve the above names for their respective tiers, and not use | ||
| them for slices with a different purpose. | ||
|
|
||
| Not all four tiers have to be present, so only define the ones that are | ||
| meaningful for the package. Each tier is a superset of the previous one. | ||
| Therefore, if more than one tier is present, the higher tier must list | ||
| the lower one in its `essential` dependencies. | ||
|
|
||
| `standard` is the convenient choice when the package should behave like a | ||
| regular installation. Applications that only need part of a package should | ||
| instead install the `core` slice plus the | ||
| [function slices](#slice_design_approaches_function) they use, which keeps the | ||
| root file system smaller. For example, an application that only needs | ||
| Python's cryptographic modules can install `python3_core` and | ||
| `libpython3.14-stdlib_crypto` instead of `python3_standard`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.