packaging-problems icon indicating copy to clipboard operation
packaging-problems copied to clipboard

Opt-out optional dependencies/extras

Open smheidrich opened this issue 1 year ago • 2 comments

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

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.

smheidrich avatar Sep 10 '24 21:09 smheidrich

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)

henryiii avatar Sep 10 '24 22:09 henryiii

Not sure if the question is addressed to me or "the room" :sweat_smile: But in any case I don't know :shrug:

smheidrich avatar Sep 11 '24 18:09 smheidrich

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.

merwok avatar Feb 11 '25 16:02 merwok