[Distutils] Metadata 2.0: Warning if optional features are missing
p.f.moore at gmail.com
Tue Dec 15 10:20:14 EST 2015
This is more a thought for something that would be good to include in
Metadata 2.0, or whatever ends up taking its place.
I was installing some packages on a new PC, that doesn't have a
compiler. As I did so, I noticed a dependency on sqlalchemy fly by,
and I thought "oh, that's going to fail", as it's always needed a
compiler. But it didn't. I presume sqlalchemy has an optional
dependency on something like a speedup module.
What would be good is a way for packages to declare that they provide
optional features like this, and for pip (and user code) to be able to
introspect that data. The n"extras" feature in Metadata 2.0 is sort of
like that, but in an "on request" form (I can install foo[speedups]
and that has additional requirements, but the install will fail if
they are not present).
What I'd like to be able to do:
1. pip install sqlalchemy works, but shows a warning "optional feature
speedups not installed - no C compiler"
2. A command to list any installed packages with optional features
that aren't installed:
$ pip options -l
sqlalchemy speedups [C compiler]
3. A command to reinstall the currently installed version with new options
pip install --add-options sqlalchemy[speedups]
(Note that a plain pip install doesn't do this, as it won't
reinstall. And --upgrade or --ignore-installed will install newer
The use case is the one I described: installing on a system with no
compiler (and no wheels provided by the project) where I want to do
the install for now, but know I'm missing some stuff, and at a later
date when I get a compiler installed I want to update things to add
what I would have got if I'd had the compiler in the first place.
Thoughts? Is this something that could be practical (obviously it
needs projects to *add* the metadata, but they'd need the facility to
be there before they could do so).
More information about the Distutils-SIG