Repository navigation
chore(packaging): move package metadata to pyproject.toml - #467
Conversation
The metadata now lives in the [project] table of pyproject.toml and setup.py is removed. The version is still read from nodeenv_version in nodeenv.py, and the long description is still README.rst followed by CHANGES, now declared as text/x-rst. The license is declared as the SPDX expression BSD-3-Clause, which needs setuptools 77 or later. make deploy-pypi builds with python -m build, so the sdist no longer depends on a leftover nodeenv.egg-info/SOURCES.txt in the checkout. Fixes #374
There was a problem hiding this comment.
🟡 Changes recommended
The Debian sdist command fails in a clean build environment because the build frontend is not declared as a Debian build dependency and the legacy /usr/bin/python interpreter cannot run the new setuptools backend.
1 open issue
What changed in this PR
This PR completes the PEP 517 packaging migration requested in #374 by moving metadata into pyproject.toml and removing setup.py, while retaining the setuptools backend.
Changes:
- Declares project metadata, extras, entry point, dynamic version and readme, and an SPDX license in
pyproject.toml. - Switches build and installation commands to standards-based frontends.
- Removes obsolete
setup.pyreferences from tooling and documents the migration.
| File | Description |
|---|---|
| tox.ini | Removes setup.py from lint targets. |
| setup.py | Deletes the legacy packaging script. |
| requirements-dev.txt | Adds the build frontend. |
| pyproject.toml | Defines package metadata and requires setuptools 77 or later. |
| Makefile | Uses modern build/install commands and removes PyPI registration. |
| debian-upstream/rules | Switches sdist creation to build and extracts gzip archives. |
| CONTRIBUTING.md | Updates the documented lint command. |
| CHANGES | Records the packaging migration and backend requirement. |
| .github/workflows/tests.yml | Removes setup.py from CI lint targets. |
| .coveragerc | Removes the obsolete coverage exclusion. |
Review effort: Balanced
|
|
||
| build-arch: | ||
| /usr/bin/python setup.py sdist --formats tar | ||
| /usr/bin/python -m build --sdist |
There was a problem hiding this comment.
The Debian packaging is broken before this PR, at the build-dependency
check: neither python from Build-Depends nor python2.7-minimal from
Pre-Depends exists in Debian 12 or 13, so dpkg-buildpackage stops
before rules runs (dpkg-checkbuilddeps on debian:12-slim and
debian:stable-slim reports python as unmet on master).
Moving only the sdist step to Python 3 would not give a package that
builds: DH_VENV_ARGS still creates the virtualenv with /usr/bin/python,
and the package still pre-depends on Python 2.7. This PR only replaces the
setup.py call, so that rules no longer refers to a removed file.
Moving the Debian packaging to Python 3 is out of scope here.

See CONTRIBUTING.md for the rules behind this checklist.
#374 asks to finish the PEP 517 move and drop
setup.py. #338 added the[build-system]table, but the metadata stayed insetup.py, and therelease was still built by calling
setup.py sdist bdist_wheeldirectly.That made the sdist depend on the checkout: env-dev has no setuptools-scm,
so
setup.py sdisttook its file list from thenodeenv.egg-info/SOURCES.txtleft bypip install -e .. Without thatfile the 1.12.0 sdist would have had 35 entries instead of 56, and no
tests/__init__.py,tests/nodeenv_test.pyortests/nodejs_index.json.The metadata now lives in
[project]inpyproject.toml, andsetup.pyis removed. The backend is still
setuptools.build_meta:nodeenv_versioninnodeenv.py, read withattr, somake deploy-githubis unchanged. setuptools-scm stays forthe sdist file list and does not touch the version, also on a commit
after the tag.
declared as
text/x-rst, sotwine checkno longer warns aboutlong_description_content_type.BSD-3-Clause(PEP 639), which needssetuptools>=77. setuptools refuses aLicense ::classifier next toit, so the classifier is gone.
make deploy-pypibuilds withpython -m build,make envusespip install ., andmake update-pypiis removed, since PyPI turnedregisteroff long ago.debian-upstream/rulesbuilds the sdist withpython -m build --sdistand unpacks
dist/*.tar.gz. The Debian package itself still targetsPython 2.7; that is left for a separate change.
setup.pyin tox, CI andCONTRIBUTING.md.Compared with a build of master, the wheel has the same files,
dependencies, extras,
Requires-Pythonand entry point. METADATA differsonly in the fields
[project]writes differently:Project-URL: Homepageinstead of
Home-page, a singleAuthor-email,License-Expressioninstead of
License,Description-Content-Type, and noPlatformorDynamiclines. The sdist has the same files exceptsetup.pyandnodeenv.egg-info/not-zip-safe, with or without a leftovernodeenv.egg-info/, and the unit tests pass from it.Fixes #374
package)
toxpasses: the tests and flake8CHANGEShas an entry underVersion [unreleased], if nodeenv'sbehavior changes
README.rstis updated, if the change affects what it documentstype(scope): subject