This is very similar to what Debian calls "Recommends". A recommends
relationship is like a soft version of Depends -- if A recommends B, then
installing A will by default pull in B, but if B is unavailable or the user
asks that B not be installed, then that's OK (rather then being an error
like it would be for a full Depends).

This is commonly used for cases where B is the docs for A, or an admin
console for the server A installs, or the client library needed to access
this server. It would also mostly cover your use case, with the addition of
some commands to query for unsatisfied recommendations.

As a general rule, I like the Debian strategy of trying to provide a few
mechanisms like this that are general purpose and semantically simple (in
the sense that it's barely different from the existing depends concept),
instead of adding special case concepts like "optional features".

-n
On Dec 15, 2015 7:20 AM, "Paul Moore" <[email protected]> wrote:

> 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
> versions).
>
> 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).
>
> Paul
> _______________________________________________
> Distutils-SIG maillist  -  [email protected]
> https://mail.python.org/mailman/listinfo/distutils-sig
>
_______________________________________________
Distutils-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to