Skip to content

Load a Python module's libraries outside its directory - #40

Merged
eunomie merged 9 commits into
mainfrom
pyinclude-resources
Oct 15, 2026
Merged

eunomie merged 9 commits into
mainfrom
pyinclude-resources

Conversation

@eunomie

@eunomie eunomie commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

A Python module on its generated entrypoint can now depend on a library outside its directory, such as a package its repository shares. The path source uv already needs is enough:

[tool.uv.sources]
greet = { path = "../../libs/greet", editable = true }

dagger generate follows the module's path sources outside its directory, their own path sources, and its workspace members outside it, checked against uv.lock. A committed uv.lock is locked again with the same directories mounted. Every generated entrypoint now declares sources, which engine v1.0.0-beta.18 calls when it loads the module (dagger/dagger#14693): it returns the module directory and those directories, and types and call take no workspace. The entrypoint builds from currentModule.contextDirectory: uv finds the library, a change in it gives a new cache key, and the module also runs from a Git repository.

This moves the SDK's floor to v1.0.0-beta.18, in its own commit; on an older engine, generation refuses and names the release to pin. A module generated earlier keeps loading on beta.18 until it is generated again.

Generation refuses only what it found and cannot load: an absolute path, a path outside the workspace, a missing or ignored directory, or an entrypoint other than the generated one.

Not covered yet: files the code opens at call time, hatch force-include sources outside a library, a wheel, source archive or symlink outside the module as a path source (generation refuses it), and pip-mode modules.

Independent of other open changes; applies on main.

Tests: unit tests for the renderer and the walk; the e2e resources-* checks, including a call from Git. CI now pins its engines like the Go SDK: engine-e2e builds v1.0.0-beta.18 from its dagger/dagger commit and runs every e2e check on it, and checks that v1.0.0-beta.17 is refused.

The first release that loads a module's files through its entrypoint's
sources member. The client bindings are regenerated on it.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie force-pushed the pyinclude-resources branch from 082fe4b to caace8d Compare October 15, 2026 19:02
CI's own engine is older than the floor, so the checks run on the floor
release built from its dagger/dagger commit, and the release below it is
checked to be refused, as the Go SDK does.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie force-pushed the pyinclude-resources branch from caace8d to 789b938 Compare October 15, 2026 19:08
@eunomie
eunomie merged commit eb9c4aa into main Oct 15, 2026
4 checks passed
@eunomie
eunomie deleted the pyinclude-resources branch October 15, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant