Skip to content

fix: scope hatch packages directive to wheel target only#637

Merged
mihaimaruseac merged 1 commit into
sigstore:mainfrom
jonburdo:fix/sdist-build-config-sigstore
May 30, 2026
Merged

fix: scope hatch packages directive to wheel target only#637
mihaimaruseac merged 1 commit into
sigstore:mainfrom
jonburdo:fix/sdist-build-config-sigstore

Conversation

@jonburdo

Copy link
Copy Markdown
Contributor

The packages directive was under [tool.hatch.build] (general), which applies to both wheel and sdist targets. Hatchling's sdist builder flattens the src-layout, placing model_signing/ at the archive root, but the embedded pyproject.toml still references src/model_signing - a path that no longer exists in the sdist. This causes pip to install an empty wheel with zero Python modules.

Moving the directive to [tool.hatch.build.targets.wheel] lets the sdist target use hatchling's default behavior (preserve the full source tree including the src/ prefix), so the packages path matches the actual layout when installing from source distributions.

Resolves: #636

Summary

This allows installation from sdist. I've tested with a script:
test-sdist.sh

#!/bin/bash
# Test whether rh-model-signing installs correctly from sdist.
# Usage: ./test-sdist.sh <branch>
set -euo pipefail

branch=${1}

git checkout "$branch" --quiet
rm -rf dist/ .venv-sdist-test
hatch build -t sdist
python -m venv .venv-sdist-test
.venv-sdist-test/bin/pip install dist/*.tar.gz --no-cache-dir --quiet
.venv-sdist-test/bin/python -c "import model_signing; print('PASS')"
rm -rf dist/ .venv-sdist-test

This fails on the current main (7643e29):

$ ./test-sdist.sh main
──────────────────────────────────────────────────────────────────────────────────────────── sdist ─────────────────────────────────────────────────────────────────────────────────────────────
dist/model_signing-1.1.1.tar.gz

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import model_signing; print('PASS')
    ^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'model_signing'

But is fixed on this branch:

$ ./test-sdist.sh fix/sdist-build-config-sigstore
──────────────────────────────────────────────────────────────────────────────────────────── sdist ─────────────────────────────────────────────────────────────────────────────────────────────
dist/model_signing-1.1.1.tar.gz

PASS
Checklist
  • All commits are signed-off, using DCO
  • All new code has docstrings and type annotations
  • All new code is covered by tests. Aim for at least 90% coverage. CI is configured to highlight lines not covered by tests.
  • Public facing changes are paired with documentation changes
  • Release note has been added to CHANGELOG.md if needed

The packages directive was under [tool.hatch.build] (general), which
applies to both wheel and sdist targets. Hatchling's sdist builder
flattens the src-layout, placing model_signing/ at the archive root,
but the embedded pyproject.toml still references src/model_signing —
a path that no longer exists in the sdist. This causes pip to install
an empty wheel with zero Python modules.

Moving the directive to [tool.hatch.build.targets.wheel] lets the sdist
target use hatchling's default behavior (preserve the full source tree
including the src/ prefix), so the packages path matches the actual
layout when installing from source distributions.

Resolves: sigstore#636

Signed-off-by: Jon Burdo <jon@jonburdo.com>
@jonburdo jonburdo requested review from a team as code owners May 29, 2026 21:00

@mihaimaruseac mihaimaruseac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you

@mihaimaruseac mihaimaruseac enabled auto-merge (squash) May 30, 2026 14:52
@mihaimaruseac mihaimaruseac merged commit 030f05b into sigstore:main May 30, 2026
52 checks passed
@jonburdo jonburdo deleted the fix/sdist-build-config-sigstore branch May 31, 2026 16:28
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.

sdist installs produce empty wheel due to packages directive scope

2 participants