Skip to content

fix: anchor lib/ and lib64/ patterns to repo root in .gitignore#3083

Merged
mnriem merged 1 commit into
github:mainfrom
siosig:fix/gitignore-lib-pattern-anchored-to-root
Jun 22, 2026
Merged

fix: anchor lib/ and lib64/ patterns to repo root in .gitignore#3083
mnriem merged 1 commit into
github:mainfrom
siosig:fix/gitignore-lib-pattern-anchored-to-root

Conversation

@siosig

@siosig siosig commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

specify bundle commands fail with a ModuleNotFoundError when the package is installed directly from git (e.g. uvx --from git+https://github.com/github/spec-kit.git):

ModuleNotFoundError: No module named 'specify_cli.bundler.lib'

Root cause

.gitignore contains an unanchored lib/ pattern (line 13) inherited from the GitHub Python gitignore template added in the initial commit. Hatchling uses .gitignore as its file-exclusion filter when building wheels. The unanchored pattern matches any lib/ directory at any depth, including src/specify_cli/bundler/lib/ which was introduced in #3070. As a result the entire subpackage is silently dropped from the built wheel.

Fix

Prefix both lib/ and lib64/ with / to anchor them to the repository root:

-lib/
-lib64/
+/lib/
+/lib64/

A leading / in .gitignore anchors the pattern to the root of the repository, which is the intended scope — excluding top-level lib/ artefacts produced by old-style setuptools installs — without affecting any nested source package named lib/.

Verification

python -m hatchling build --target wheel
python -c "
import zipfile
whl = zipfile.ZipFile('dist/specify_cli-*.whl')
hits = [n for n in whl.namelist() if 'bundler/lib' in n]
print(hits)
"
# ['specify_cli/bundler/lib/__init__.py',
#  'specify_cli/bundler/lib/project.py',
#  'specify_cli/bundler/lib/versioning.py',
#  'specify_cli/bundler/lib/yamlio.py']

bundler/lib is now present in the wheel. Before this fix it was absent.

The unanchored `lib/` pattern matched any nested `lib/` directory, including
`src/specify_cli/bundler/lib/` added in github#3070. Hatchling uses .gitignore as
its file-exclusion filter, so the bundler subpackage was silently dropped from
wheels built via `uvx --from git+...`, causing:

    ModuleNotFoundError: No module named 'specify_cli.bundler.lib'

Prefixing with `/` anchors both patterns to the repository root, which is the
intended scope (exclude top-level lib/ artefacts from old-style setuptools
installs) without affecting nested source packages.
@siosig siosig requested a review from mnriem as a code owner June 22, 2026 02:57
@mnriem mnriem requested a review from Copilot June 22, 2026 14:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@mnriem mnriem requested a review from Copilot June 22, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@mnriem mnriem merged commit f63c3d7 into github:main Jun 22, 2026
11 checks passed
@mnriem

mnriem commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

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.

3 participants