fix(build): include specify_cli.bundler.lib in built distribution#3085
Merged
Conversation
The root .gitignore carried unanchored `lib/` and `lib64/` patterns from the
standard GitHub Python template (intended to ignore a top-level build/venv
`lib` directory). Being unanchored, they also match the source package
`src/specify_cli/bundler/lib/`.
Hatchling applies .gitignore patterns as build-exclusion rules, so the
`bundler/lib` package (project.py, versioning.py, yamlio.py) was silently
dropped from the built wheel even though it is tracked in git. Since
commands/bundle/__init__.py imports `specify_cli.bundler.lib.project` at module
load, any install built from source (e.g. `uv tool install --from git+...`)
crashed on startup with:
ModuleNotFoundError: No module named 'specify_cli.bundler.lib'
which broke the entire CLI — every command, including `specify init`.
Anchor the patterns to the repo root (`/lib/`, `/lib64/`) so they only match
the intended top-level build artifacts and no longer exclude the source package.
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Empty commit to re-dispatch a wedged CodeQL run that never started, unblocking code scanning merge protection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
Thank you! |
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.
Summary
Installing from source (e.g.
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git) currently produces a completely broken CLI — every command crashes on startup:This affects
init,check, everything — becausecommands/bundle/__init__.pyis imported at top level inspecify_cli/__init__.py, and it importsspecify_cli.bundler.lib.project. Introduced together with thespecify bundlecommand (#3070), which added thesrc/specify_cli/bundler/lib/package.Root cause
The package
src/specify_cli/bundler/lib/is tracked in git, but it is missing from the built wheel. The cause is the root.gitignore:These come from the standard GitHub Python template and are meant to ignore a top-level build/virtualenv
libdirectory. Because the patterns are unanchored, they also match the source packagesrc/specify_cli/bundler/lib/. Hatchling applies.gitignorepatterns as build-exclusion rules, so it silently dropsbundler/libfrom the wheel even though the files are tracked.Sibling packages (
bundler/models/,bundler/services/, …) are unaffected because only the directory literally namedlibmatches the pattern.Reproduction (current
main)Fix
Anchor the patterns to the repository root so they only match the intended top-level build artifacts:
This preserves the original intent (ignore a root-level
lib/lib64build/venv dir) while no longer excluding the source package.Verification (with this change)
The CLI now loads, and
specify bundleworks.