Pin the build backend so sdist filenames stay PEP 625 compliant - #114
Merged
Conversation
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.
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.
Building 0.17.0 produced
python-dwca-reader-0.17.0.tar.gz, which PyPI rejects:Cause
PEP 625 requires sdist filenames to use the normalised project name. setuptools started
emitting that form in 69.3, but
python setup.py sdistbuilds with whatever setuptoolshappens to be first on
PATH. On the release machine that was 68.0.0, which predates thechange, 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 buildresolves its own requirements in anisolated 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 namedpython_dwca_reader-0.17.0.tar.gz, because isolation honours the floor declared here.Checked the change is otherwise inert:
pyproject.tomlitself now being included
Metadata-Version,Name,VersionandRequires-Pythonare unchangedpython -m pip install .(what CI runs) still works and the installed package readsarchives correctly
Package metadata deliberately stays in
setup.py. This only pins how the build happens, notwhat 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.rstis reStructuredText and that isalready the inferred default, so this changes nothing about the rendered page - it just silences
the warning twine prints on every upload.
twine checknow reports PASSED with no warnings.Not included
The
build/directory left behind bysetup.pyshadows the PyPAbuildmodule, sopython -m buildfrom a dirty working tree fails with a confusing "No module named build".Worth knowing when releasing; not worth a code change here.