Conversation
`dagger module init python --name my-module --template flat` writes the module's code as a single file at the module root, `<package>.py`, instead of `src/<package>/__init__.py`. The example module is the one the default template writes, so the two templates differ only in layout. `--template` still defaults to `default`. The template builds with hatchling rather than uv_build. uv_build packages a directory module only: with `module-root = ""` it looks for `<package>/__init__.py` at the root and refuses a root-level `<package>.py`. A root-level package directory would in turn match neither glob the runtimes use to find a module's Python files, `hasPythonFiles` in runtime/build.dang and `src/**/*.py|*.py` in the engine's builtin runtime, so it would need a change on both sides. A single root-level file matches both globs, and hatchling derives it from `[project] name` with no further configuration, so the flat template needs no runtime change. Signed-off-by: Yves Brissaud <yves@dagger.io>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
dagger module init python --name my-module --template flatwrites the module's code as a single file at the module root,<package>.py, instead ofsrc/<package>/__init__.py. The example module is the one the default template writes, so the two templates differ only in layout.--templatestill defaults todefault.The template builds with hatchling rather than uv_build. uv_build packages a directory module only: with
module-root = ""it looks for<package>/__init__.pyat the root and refuses a root-level<package>.py. A root-level package directory would in turn match neither glob the runtimes use to find a module's Python files,hasPythonFilesin runtime/build.dang andsrc/**/*.py|*.pyin the engine's builtin runtime, so it would need a change on both sides. A single root-level file matches both globs, and hatchling derives it from[project] namewith no further configuration, so the flat template needs no runtime change.