Adding a default extra_require environment

They can be deselected though and regular requirements cannot be? Like, neither proposal prevents the extra from being deselected, the question is whether including a single extra should automatically deselect all default extras, or whether default extras should be explicitly disabled.

To use your azure example, I can see how if you’re targeting one or two services, it’s nice that someone could do azure-cli[service1,service2] and get only those things… but where that breaks down, is let’s say Azure had an optional Rust based speed up that it could also optionally depend on. Perfect use case for an extra, so I go and change my azure-cli to azure-cli[speedups]… and suddenly my cli does basically nothing. Now I have to either spend time to audit and figure out which extras are actually important for me, and manually tweak that list OR I have to go through and just duplicate the entire list of default extras into my azure-cli[speedup, ... literally every default extra] just to try and restore my “state” back to what it was. This breaks that expectations people have with extras, which is that selecting one will add functionality to my install, not suddenly remove a bunch of functionality.

The flip side here, is if you have to explicitly remove them, then that eliminates that entire footgun, at the cost of the person who needs a single one of azure cli’s dependencies AND they don’t want the dependencies for all services, only has to type like, an extra couple characters. So it would be something like azure-cli[-*, service1].

So basically the four scenarios are:

  1. I’m a person who doesn’t care what I get, just give me something working.
    • Implicit: azure-cli
    • Explicit: azure-cli
  2. I’m a person who only cares about getting a very minimal subset of dependencies, with explicit extras installed.
    • Implicit: azure-cli[service1]
    • Explicit: azure-cli[-*, service1]
  3. I’m a person who generally wants the defaults, but I want to select one specific extra (whether that’s a truely optional speed up extra, or picking one specific backend, or whatever).
    • Implicit: azure-cli[speedups, service1, service2, service3, service4, service5, service6, service7, service8, service9, service10, ..., service73] (a quick look at azure-cli looks like it depends on 73 sub service packages, maybe some of those would be grouped though into top level extras, idk).
    • Explicit: azure-cli[speedups].
  4. Sort of a riff on #3, but: I’m a person who generally wants the defaults, but this time I want to exclude a couple of the default extras, but still want the rest.
    • Implicit: azure-cli[service1, service2, service6, service7, service8, service9, service10, ..., service73]
    • Explciit: azure-cli[-service3, -service4, -service5]

The cpu vs gpu case is basically either 2, 3, or 4 depending on if there are other extras or if that’s the only extra, and whether the person doing the installing cares if the cpu backend is installed alongside the gpu backend.

7 Likes