Skip to content

Add support for PEP-517 #573

Closed
Closed
@ntninja

Description

@ntninja

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):

  1. If skipsdist in the tox section of tox.ini is true, do nothing
  2. Create a new virtualenv to host the sdist generation environment
  3. If a file named pyproject.toml exists in the toxinidir:
    1. Parse the pyproject.toml as TOML file (using the python toml library for instance)
    2. Search for the build-system.requires key and treat each entry in the array as an PEP-508 dependency specification
    3. If the key was missing or not an array, report an informative error message and exit
    4. Install each found build dependency into the virtualenv
  4. Otherwise install setuptools and wheel into the virtualenv
  5. Execute ./setup.py sdist within the virtualenv to generate the sdist 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.)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions