pyproject.toml (PEP518), build isolation (PEP517) and optional build dependencies
See original GitHub issueWhat’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
Issue Analytics
- State:
- Created 5 years ago
- Comments:48 (29 by maintainers)
Top GitHub Comments
Really, this option
--no-isolation
is not a solution for us.I’d like to use the
build-system.requires
option of pyproject.toml. It would allow users to just dopip install fluidfft
. Of course I don’t want to use--no-isolation
because with this option,build-system.requires
is not taken into account and we loose all the benefice of pyproject.toml.We need to be able to detect in setup.py if some packages are installed and if they are installed to use them during the build.
Then packages with optional build dependencies CAN NOT (and won’t be able to) use pyproject.toml ?
it is a problem! it is not something completely crazy to have a
try: import ... except ImportError:
in a setup.py.Note that the solution with
build-system.optional
seems very simple to implement.