Skip to content

pyproject.toml (PEP518), build isolation (PEP517) and optional build dependencies #6144

Closed
@paugier

Description

@paugier

What's the problem this feature will solve?

Projects that have build requirements and optional build requirements can not use pyproject.toml because of the build isolation.

Example (https://bitbucket.org/fluiddyn/fluidfft): depending if mpi4py is installed, MPI extensions are built or not. It's very important to be able to install/use the package without MPI so mpi4py can not be added in build-system.requires.

If a pyproject.toml is used, we get ImportError when importing mpi4py in the setup.py even when mpi4py is installed because of the isolation! So the MPI extensions are never build.

Describe the solution you'd like

Something like this could work:

[build-system]
# Minimum requirements for the build system to execute.
requires = [
    "setuptools", "wheel", "numpy", "cython", "jinja2", "fluidpythran>=0.1.7"
]
# packages that are used during the build only if they are installed
optional = ["mpi4py", "pythran"]

Then mpi4py would be available during the build only if it is installed. We keep the advantages of the isolation (discussed in https://www.python.org/dev/peps/pep-0517/) but optional build dependencies are allowed.

Alternative Solutions

[build-system]
# Minimum requirements for the build system to execute.
requires = [
    "setuptools", "wheel", "numpy", "cython", "jinja2", "fluidpythran>=0.1.7"
]
isolation = False

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions