Description
Currently tox
does not yet appear have support for the buildsystem.requires
key of pyproject.toml
as defined in PEP-518.
PIP has implemented this: pypa/pip#4144 (will be part of PIP 10.0) and it would be nice if tox could also add support for installing packages defined using that key, instead of having to use the broken setup_requires
key of ./setup.py
.
Example of a pyproject.toml
file that creates a setuptools 34+ environment:
[build-system]
requires = ["setuptools >= 34", "wheel"]
Example of a pyproject.toml
file that creates an environment for building flit
packages:
[build-system]
requires = ["flit"]
(Note that this kind of setup is pretty useless without support for PEP-517.)
Approximate step by step algorithm for supporting both PEP-517
and "legacy" ./setup.py
deployments (based on PEP-518 & how PIP choose to implement it):
- If
skipsdist
in thetox
section oftox.ini
istrue
, do nothing - Create a new
virtualenv
to host thesdist
generation environment - If a file named
pyproject.toml
exists in thetoxinidir
:- Parse the
pyproject.toml
as TOML file (using the python toml library for instance) - Search for the
build-system.requires
key and treat each entry in the array as anPEP-508
dependency specification - If the key was missing or not an array, report an informative error message and exit
- Install each found build dependency into the
virtualenv
- Parse the
- Otherwise install
setuptools
andwheel
into thevirtualenv
- Execute
./setup.py sdist
within thevirtualenv
to generate thesdist
used for the subsequent testing steps
(The build environment may be reused between subsequent testing sessions, as long as the list of requirements doesn't change.)