I have a wishlist item for the PyPA: first-class support for build-and-run-time dependencies. I mean dependencies that are needed both while building a package and also while running that package. A typical example is a package using the C API of another package (either through Cython or a manually exposed C API like
There is too much an underlying assumption in
pip and PEP 518 that every dependency is either a build tool or a run-time dependency. That may be true for the vast majority of Python projects, but it ignores the C API use case.
A solution would be to improve support for
install_requires such that a package can use its
install_requires dependencies at build time. That’s basically pip issue #6406.
build-system from PEP 518 could truly refer to the build system. These build-and-run-time dependencies conceptually don’t belong there. These dependencies are typically only needed inside the
setup() function, so the issue of importing them inside
setup.py is not relevant.
I’m not expecting an immediate fix here, but it would help to put this somehow on the PyPA roadmap.
See also pip issue #6411.