Skip to content

Pin the build backend so sdist filenames stay PEP 625 compliant - #114

Merged
niconoe merged 1 commit into
mainfrom
packaging-pyproject
Jul 29, 2026
Merged

Pin the build backend so sdist filenames stay PEP 625 compliant#114
niconoe merged 1 commit into
mainfrom
packaging-pyproject

Conversation

@niconoe

@niconoe niconoe commented Jul 28, 2026

Copy link
Copy Markdown
Member

Building 0.17.0 produced python-dwca-reader-0.17.0.tar.gz, which PyPI rejects:

400 Filename 'python-dwca-reader-0.17.0.tar.gz' is invalid,
    should be 'python_dwca_reader-0.17.0.tar.gz'.

Cause

PEP 625 requires sdist filenames to use the normalised project name. setuptools started
emitting that form in 69.3, but python setup.py sdist builds with whatever setuptools
happens to be first on PATH. On the release machine that was 68.0.0, which predates the
change, so the sdist got the old dash form. (Wheels were unaffected - they have always used
the normalised name.)

Fix

Declaring the build backend means python -m build resolves its own requirements in an
isolated environment rather than inheriting the caller's setuptools.

Verified rather than assumed: built the project from a virtualenv deliberately pinned to
setuptools==68.0.0 - the exact failure condition - and the artifact is still named
python_dwca_reader-0.17.0.tar.gz, because isolation honours the floor declared here.

Checked the change is otherwise inert:

  • the sdist's file list is identical to the one built before, apart from pyproject.toml
    itself now being included
  • Metadata-Version, Name, Version and Requires-Python are unchanged
  • python -m pip install . (what CI runs) still works and the installed package reads
    archives correctly
  • the test suite is unchanged at 222 passing

Package metadata deliberately stays in setup.py. This only pins how the build happens, not
what is built - a PEP 621 migration is a separate change and not one to make immediately after
a release.

Also

Sets long_description_content_type="text/x-rst". README.rst is reStructuredText and that is
already the inferred default, so this changes nothing about the rendered page - it just silences
the warning twine prints on every upload. twine check now reports PASSED with no warnings.

Not included

The build/ directory left behind by setup.py shadows the PyPA build module, so
python -m build from a dirty working tree fails with a confusing "No module named build".
Worth knowing when releasing; not worth a code change here.

Building 0.17.0 produced 'python-dwca-reader-0.17.0.tar.gz', which PyPI rejects:
sdist filenames must use the normalised name with underscores. setuptools started
emitting that form in 69.3, but 'python setup.py sdist' uses whatever setuptools is
first on PATH, which on this machine was an older one.

Declaring the build backend makes the build resolve its own requirements in an
isolated environment instead. Verified by building from a virtualenv pinned to
setuptools 68.0.0: the artifact is still named correctly, because isolation honours
the floor declared here.

Package metadata stays in setup.py; this only pins how the build happens.

Also sets long_description_content_type explicitly. README.rst is reStructuredText
and that is already the default, so this changes nothing beyond silencing the
warning twine emits on every upload.
@niconoe
niconoe merged commit f7977c1 into main Jul 29, 2026
21 checks passed
@niconoe
niconoe deleted the packaging-pyproject branch July 29, 2026 09:11
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.

1 participant