You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In all three cases, installing the package without any extras results in a
97
-
broken installation, and this is a commonly reported issue for some of these
97
+
broken installation, and this is a commonly reported support issue for some of these
98
98
packages.
99
99
100
100
Rationale
@@ -214,7 +214,7 @@ once with no extras specified.
214
214
215
215
An empty set of extras, such as ``package[]`` should be interpreted as meaning
216
216
that the package should be installed *without* any default extras (unless
217
-
``package`` appears elsewhere in the dependency tree as mentioned above), so
217
+
``package`` appears elsewhere in the dependency tree as mentioned above). This
218
218
would provide a universal way of obtaining a minimal installation of a package.
219
219
220
220
We also note that some tools such as `pip`_ currently ignore unrecognized
@@ -236,9 +236,9 @@ Finally, we note (as also discussed in `Relying on tooling to deselect
236
236
any default extras`_) that package installers are allowed to implement their
237
237
own options to control the above behavior, for example implementing an option
238
238
that disables default extras for some or all packages regardless of where these
239
-
packages appear in the dependency tree -- although if such options are
240
-
implemented, they should be opt-in, and users should experience the above
241
-
behavior as default.
239
+
packages appear in the dependency tree. If such tool-specific options are
240
+
implemented, tool developers should make these opt-in,
241
+
and users should experience the above PEP 771 behavior as default.
242
242
243
243
Examples
244
244
--------
@@ -673,13 +673,9 @@ In essence, default extras should be considered just as 'weighty' as a required
673
673
dependency. In some cases, if a package is widely used by many others, if it
674
674
adds a default extra, then unless all downstream packages update their
675
675
dependencies to specifically request a minimal installation, the defaults will
676
-
often end up getting installed. A concrete example of this is that the `pytest
677
-
<https://docs.pytest.org>`_ package has almost 1500 plugins at the time of
678
-
writing, all of which depend on pytest. If pytest was to start using a default
679
-
extra, it would need to consider this very carefully, as if the plugins are not
680
-
updated, installing any plugin will result in the default extra being
681
-
installed. This is not to say that it should not use default extras, but just
682
-
that the decision should be considered and planned carefully.
676
+
Default extras should generally be treated with the same "weight" as required dependencies. When a package is widely used, introducing a default extra will result in that extra's dependencies being transitively included -- unless all downstream packages are updated to explicitly opt out using minimal installation specifications.
677
+
678
+
As an example, the `pytest <https://docs.pytest.org/>`_ package currently has nearly 1,500 plugins that depend on it. If pytest were to add a default extra and those plugins were not updated accordingly, installing a plugin would include the default extras' dependencies. This doesn’t preclude the use of default extras, but addition of default extras requires careful evaluation of its downstream effects.
683
679
684
680
Inheriting from default extras
685
681
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -752,7 +748,7 @@ Documenting packages with default extras
752
748
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
753
749
754
750
Regardless of how default extras are used, package authors should aim to ensure
755
-
that the documentation for their package makes it clear how extras are to be
751
+
that their package's documentation makes it clear how extras are to be
756
752
used. 'Best practices' documentation should mention:
757
753
758
754
* that installing ``package`` will be equivalent to ``package[<default extras>]``
0 commit comments