I think that I would like to use this for some packages. My use case is pure Python packages that have optional non-Python accelerator modules. One example is that SymPy can now make use of python-flint as an optional dependency to speed up some operations. Eventually I would like users who do pip install sympy
to get python-flint by default but there will always be a need to opt out because python-flint includes libraries with a different license and also is much more difficult to build. We might also want to have other optional dependencies like numpy, scipy and matplotlib be part of the default extras.
Ideally I would want to have the default requirement conditional on the presence of a wheel for the accelerator module i.e. “install python-flint if there is a wheel but otherwise don’t try to build it”. I guess I could make that effectively happen with environment markers though at least for someone installing from PyPI.
Currently the way to achieve this without default-extras is to split a package up so then you have an empty sympy
package and a sympy-minimal
package that contains the actual code. The sympy
package’s requirements would include the default extra requirements but the sympy-minimal
package would not and then downstream packages can depend on sympy-minimal
if they want. This is awkward to do mainly just because it is awkward to make multiple packages from a single git repo and coordinate releasing them. An alternative that could achieve what I want then would be if there was better tooling for generating multiple packages from a single git repo although it would still be nicer to use default-extras rather than making another package. (There are other reasons to want multiple packages though like to split out the test suite into a sympy-test
package.) The separate packages approach is possibly easier to adapt for downstream packagers like distros etc.
The PEP seems to describe things in terms of setup.cfg but should these things not be in pyproject.toml?