-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
skipsdistin thetoxsection oftox.iniistrue, do nothing - Create a new
virtualenvto host thesdistgeneration environment - If a file named
pyproject.tomlexists in thetoxinidir:- Parse the
pyproject.tomlas TOML file (using the python toml library for instance) - Search for the
build-system.requireskey and treat each entry in the array as anPEP-508dependency 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
setuptoolsandwheelinto thevirtualenv - Execute
./setup.py sdistwithin thevirtualenvto generate thesdistused 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.)