Skip to content

build: Exclude venv dirs from sdist/wheel#345

Merged
apaolillo merged 1 commit into
mainfrom
venvex
May 5, 2026
Merged

build: Exclude venv dirs from sdist/wheel#345
apaolillo merged 1 commit into
mainfrom
venvex

Conversation

@apaolillo

Copy link
Copy Markdown
Collaborator

The previous configuration only excluded venv directories via the wheel target's exclude list. Since hatchling's sdist target defaults to including everything not in .gitignore, a .venv-release/ created in the project root during the release procedure leaked into the tarball.

Mirror pythainer's fix:

  • add a top-level [tool.hatch.build] exclude for venv/env/cache/git dirs that both targets inherit;
  • add an explicit [tool.hatch.build.targets.sdist] exclude block (the actual fix);
  • harmonize the wheel exclude patterns to use root-anchored globs.

The previous configuration only excluded venv directories via the wheel
target's exclude list. Since hatchling's sdist target defaults to
including everything not in .gitignore, a `.venv-release/` created in
the project root during the release procedure leaked into the tarball.

Mirror pythainer's fix:
- add a top-level [tool.hatch.build] exclude for venv/env/cache/git
  dirs that both targets inherit;
- add an explicit [tool.hatch.build.targets.sdist] exclude block (the
  actual fix);
- harmonize the wheel exclude patterns to use root-anchored globs.

Signed-off-by: Antonio Paolillo <apaolill@gmail.com>
@apaolillo apaolillo requested a review from matsvanmolle May 5, 2026 15:09
@apaolillo apaolillo self-assigned this May 5, 2026

@matsvanmolle matsvanmolle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@apaolillo apaolillo merged commit 7fc4225 into main May 5, 2026
2 checks passed
@apaolillo apaolillo deleted the venvex branch May 5, 2026 16:04
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.

2 participants