Skip to content

Three declaration scopes

Three places declare what code may reach at runtime. Each is authored by a different owner, and each grants a different reach. Everything else in this section follows from the split.

Each block's closure is resolved on its own, so two blocks can run incompatible versions of one library, and a large shared library is resolved and built once per block. The foundation, the base image the project's cells run on, is where such a library belongs, and runtime.xratu changes that shared set without rebuilding the image. See Where shared dependencies live.

flowchart TB
  F["Foundation system baseline<br/>authored by the foundation builder"]
  P["runtime.xratu<br/>authored per project"]
  B["@xratu<br/>authored per block"]
  F -->|"every closure on this foundation"| C["A block's closure"]
  P -->|"apt: every closure in the project"| C
  P -.->|"requirements: resolver candidates"| C
  B -->|"this block only"| C
Scope Authored by Reach
Foundation system baseline The foundation builder exports a signed subset of inventoried native libraries, executables, provider-runtime dependencies and accelerator user-space components; the control plane admits the foundation digest Every closure using that foundation, with no block declaration
Project-shared preparation and project-wide system additions runtime.xratu declares Python components to prepare and apt requirements to expose project-wide; the control plane compiles both into a sealed project dependency intent Admitted system bindings reach every block closure in the project; prepared Python components are resolver candidates
Reusable block additions @xratu declares every direct Python requirement, and any block-only system or image requirement Only the declaring block selects that component or receives those system bindings

The asymmetry between native and Python

The scopes treat the two kinds of dependency differently, and the difference is the rule the rest of the section rests on.

A native library is ABI-level. Declaring libmagic1 once for a project, or exporting it from a foundation, is safe: it carries no program semantics, so every block in the project can see it without any of them being coupled to another's choice.

A Python distribution version is program semantics. torch==2.4 and torch==2.6 behave differently. A block that inherited a version from a project file or from whatever the foundation happened to contain would be coupled to a sibling's decision, and would change behaviour when that sibling changed its mind.

A Python distribution or Python bundle is refused as a foundation baseline export for this reason. See Exported system baseline.

One requirement, read three ways

A block declaring torch>=2.4 resolves against all three scopes at once:

Where the bytes may come from Condition
The foundation component store A compatible component is already inventoried there
A project-prepared component runtime.xratu prepared a compatible one
A component built for this closure Neither of the above matches the requirement

All three satisfy the same declaration, and the block's import authority comes from the declaration rather than from which one was selected. See Six dependency sources.

What each scope leaves alone

Scope Decides Leaves to resolution
Foundation baseline Which native components every cell receives Which Python components any block imports
runtime.xratu Project-wide system availability, and what to prepare The resolved version, digest, mount and import root
@xratu Which Python distributions this block imports Where the selected bytes come from

Next: Presence versus import authority covers the rule that makes this split hold.