You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the developer readme suggests to use python3 setup.py sdist bdist_wheel to build packages, in a freshly created virtual environment too. The official Python packaging docs recommend using python -m build. I think we should switch to this, also for consistency because explicit use of setup.py is no longer recommended for installing the package either. Mainly though because it is a lot simpler; it creates the virtual environment itself and so makes the instructions a lot shorter.
This requires:
Updating the README.dev.md instructions: replace almost all of the code in the first code block in subsection "2/3" with just python -m build (keep twine as well).
Adding the build package to the dev extras section in setup.cfg.
While we're at it, the instructions should also note that an account on PyPI and on TestPyPI (two separate accounts) are necessary for using twine.
Static metadata (setup.cfg) should be preferred. Dynamic metadata (setup.py) should be used only as an escape hatch when absolutely necessary. setup.py used to be required, but can be omitted with newer versions of setuptools and pip.
We should make sure that everything still works though. @bouweandela mentioned that possibly pip install -e . wouldn't work anymore and there were indeed discussions about this (https://discuss.python.org/t/pip-19-1-and-installing-in-editable-mode-with-pyproject-toml/1553/65). I tried it myself, and it doesn't seem to be a problem in my relatively fresh project, but there may be other things. For instance, I see that tox doesn't immediately work without setup.py, it mentions that it needs additional configuration when I remove setup.py:
ERROR: pyproject.toml file found.
To use a PEP 517 build-backend you are required to configure tox to use an isolated_build:
https://tox.readthedocs.io/en/latest/example/package.html
Activity
egpbos commentedon Apr 8, 2022
As part of this, we should in fact remove
setup.pyaltogether, since its use has been deprecated. See for instance https://packaging.python.org/en/latest/tutorials/packaging-projects/#configuring-metadata:And https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html
egpbos commentedon Apr 8, 2022
We should make sure that everything still works though. @bouweandela mentioned that possibly
pip install -e .wouldn't work anymore and there were indeed discussions about this (https://discuss.python.org/t/pip-19-1-and-installing-in-editable-mode-with-pyproject-toml/1553/65). I tried it myself, and it doesn't seem to be a problem in my relatively fresh project, but there may be other things. For instance, I see thattoxdoesn't immediately work withoutsetup.py, it mentions that it needs additional configuration when I removesetup.py:egpbos commentedon Apr 8, 2022
The fix for
toxis to just add isolated_build = True to the tox configuration section inpyproject.toml.