Skip to content

Presence versus import authority

A block imports a third-party Python distribution because its own @xratu declares it. A package being in the foundation, or prepared by the project, lets the resolver reuse those bytes; it gives no block access to them on its own.

The declaration is what a block needs, and the foundation is optional:

Declared in the block's @xratu In the foundation or prepared by the project Result
Yes Yes The existing installed dependency is reused
Yes No The resolver fetches and install the dependency for this block's closure
No Yes UndeclaredDependency when the block imports it

The rule

Every third-party Python distribution a reusable capability block imports is declared by that block. The rule applies to every distribution alike, from requests to a large framework.

A declared distribution resolves whether or not the foundation carries it. If a compatible component is in the foundation or was prepared by the project, the resolver selects it; otherwise the resolver fetches and builds one for this block's closure. See Six dependency sources.

An undeclared distribution is unavailable to the block even when its bytes are present. The declaration stays required in each of these situations:

  1. The foundation component store contains the distribution.
  2. runtime.xratu prepared a compatible component for project reuse.
  3. A sibling block in the same package declares and uses it.
  4. A sibling block's component was built into the same artifact set.

For example, a project whose runtime.xratu prepares numpy>=1.26,<2 gives a block that imports numpy without declaring it UndeclaredDependency. A block that declares numpy>=1.26 selects the prepared component, and a block that declares numpy>=2.1 gets its own component built for its closure.

What presence contributes

Presence makes bytes a resolver candidate. When a present component satisfies a block's declaration, the resolver selects it rather than building a new component for that closure, and every block selecting it runs the same version.

Declaration contributes the import. The declaring block's closure records its own binding, and the cell receives an import root for the selected component. Presence without declaration contributes no import root.

The provider runtime is separate

CPython and its standard library are provider-runtime ABI rather than third-party package declarations, so a block imports json or pathlib without declaring anything.

Surface Declared by the block
The Python standard library No, it is provider-runtime ABI
A third-party Python distribution Yes, through @xratu
A native library in the exported baseline No, the foundation exported it
A native library outside the baseline Yes, through @xratu apt or runtime.xratu

Reachability

A file present in the foundation rootfs or component store, and absent from both the exported baseline and every selected binding, stays unreachable to the cell. The cell's filesystem and import views are generated from the closure, so what is not selected is not mounted. See Cell environment view.

Related: Three declaration scopes covers who declares what, and Undeclared dependency covers the refusal and how to clear it.