We are happy to share an updated version of PEP 771!
There was a lot of good feedback and many valid points raised in the previous round of discussion, and we have updated the PEP to reflect as much of the discussion as possible and address the concerns that were voiced. Discussions around the idea of default extras started a little over six years ago (original thread), and thanks to everyone’s feedback we feel that the PEP has now converged on a version that is close to final. This is not to say that we expect to have unanimous agreement on it, but we hope the latest version has as broad an appeal as possible.
We plan for this to be the final round of discussion before we submit the PEP for a decision. During this discussion, we can of course still make small tweaks to the PEP if needed, but we would like to avoid any more significant changes or additions. Therefore, it would be valuable for anyone interested to read the whole PEP at this point, particularly if you had concerns previously, since these may now be addressed.
Whether or not you took part in previous rounds, it would be great if you could state where you stand on this latest version, since this will be important when it comes to making a decision. If you still have concerns, please let us know how you think these could be addressed, or whether your objection is more fundamental.
Changes in this version
Below is a brief summary of the main changes. It is not exhaustive, so as mentioned above, we recommend reading the whole PEP to get the full picture:
- Renamed
pyproject.tomlkey: thedefault-optional-dependency-keyskey is nowdefault-optional-dependencies, as this seemed to be the best compromise based on previous discussion. The specification also explicitly states that a default extra must match an existing extra (and backends must enforce this by erroring if not), and we have now included clarifications about how this key should interact withdynamic. - Clarified the
package[]semantics:package[]means “I don’t need the defaults”, not “I forbid them”. Default extras are installed if the package appears bare anywhere in the dependency tree, and runningpip install packageafterpackage[]installs the default extras. Nothing is ever uninstalled. - New section on the change in meaning of a bare package name: it acknowledges the change directly and explains why we think it is acceptable.
- New guidance for downstream packages: how to depend on a package that has default extras, including in PEP 723 scripts and PEP 735 dependency groups, as well as when to use
package[]and why not to add it to every dependency defensively (section). - More guidance for package authors: what belongs in a default extra, why default extras aren’t a substitute for splitting genuinely independent packages, and a recommendation to have a CI job that tests the minimal installation.
- Prior art and repackaging: comparisons with
Recommendsin Debian/Fedora and with Cargo’s default features. The section for repackaging maintainers (conda, Linux distributions) has been expanded. - New rejected alternatives: a standardized opt-in extra name such as
recommended, a metadata-onlyRecommended-Extrafield that leaves behavior to tools, and a “requires one of several extras” mechanism. - Expanded security implications: the PEP now notes that tools which inspect dependency metadata, such as security scanners, dependency update services, and package indexes, will need to take
Default-Extrainto account to accurately report what a bare install includes. It also explains that default extras introduce no new risks beyond those that already exist with required dependencies.
There have also been a number of clarifications, wording improvements, and other smaller changes.