Opt-out optional dependencies/extras
Introduction
This has already been discussed in other places (see 2nd section) but I couldn't find an issue for it in this repo yet.
Summary
It would be nice if it was possible for package authors to mark an optional dependency as "opt-out", meaning that it gets installed by default, unless the consumer (dependent package or user installing directly via pip) explicitly opts out of it.
Discussions elsewhere
- Proposal - expanding optional dependencies to support opt-out of recommended/default installables (discuss.python.org, 2023)
- Work-in-progress PEP: https://github.com/RonnyPfannschmidt/python-peps/pull/1
- Optional dependency groups omitting package requirements (discuss.python.org, 2022)
Other ecosystems
- Rust's Cargo has this, of course, in the form of the ability to disable default "features" (their equivalent of optional dependencies / extras).
- A bit more cumbersome than the proposal from the WIP PEP linked above, because they can only be disabled all at once, with consumers then having to re-enable the ones they did want. See issue about this: https://github.com/rust-lang/cargo/issues/3126
Related issues
- https://github.com/pypa/packaging-problems/issues/214
- That issue is about implicit/automatic opt-out for packages that e.g. aren't available for the current Python version or platform, while this issue is about explicit opt-out configurable by library dependents.
Would this make sense at https://github.com/wheel-next/ideas ?
(I'd be a huge fan of these, lots of places I'd use it, but IIRC from the packaging summit a couple of years ago it's pretty hard to add due to back-compat)
Not sure if the question is addressed to me or "the room" :sweat_smile: But in any case I don't know :shrug:
This is now https://peps.python.org/pep-0771/
I think it’s tending toward consensus and acceptance, including a way to request install without the default extra. @woodruffw suggest closing here.