Note
This PEP has been marked asSuperseded. A decade after this PEPwas written, experience has shown this is a rarely used feature inmanaging the standard library. It has also not helped preventpeople from relying too heavily on provisional modules, such thatchanges can still cause significant breakage in the community.
The process of including a new package into the Python standard library ishindered by the API lock-in and promise of backward compatibility implied bya package being formally part of Python. This PEP describes a methodologyfor marking a standard library package “provisional” for the period of a singlefeature release. A provisional package may have its API modified prior to“graduating” into a “stable” state. On one hand, this state provides thepackage with the benefits of being formally part of the Python distribution.On the other hand, the core development team explicitly states that no promisesare made with regards to the stability of the package’s API, which maychange for the next release. While it is considered an unlikely outcome,such packages may even be removed from the standard library without adeprecation period if the concerns regarding their API or maintenance provewell-founded.
Whenever the Python core development team decides that a new package should beincluded into the standard library, but isn’t entirely sure about whether thepackage’s API is optimal, the package can be included and marked as“provisional”.
In the next feature release, the package may either be “graduated” into a normal“stable” state in the standard library, remain in provisional state, or berejected and removed entirely from the Python source tree. If the package endsup graduating into the stable state after being provisional, its API maybe changed according to accumulated feedback. The core development teamexplicitly makes no guarantees about API stability and backward compatibilityof provisional packages.
A package will be marked provisional by a notice in its documentation page andits docstring. The following paragraph will be added as a note at the top ofthe documentation page:
The <X> package has been included in the standard library on aprovisional basis. Backwards incompatible changes (up to and includingremoval of the package) may occur if deemed necessary by the coredevelopers.
The phrase “provisional basis” will then be a link to the glossary term“provisional package”, defined as:
A provisional package is one which has been deliberately excluded from thestandard library’s backwards compatibility guarantees. While majorchanges to such packages are not expected, as long as they are markedprovisional, backwards incompatible changes (up to and including removal ofthe package) may occur if deemed necessary by core developers. Such changeswill not be made gratuitously – they will occur only if serious flaws areuncovered that were missed prior to the inclusion of the package.This process allows the standard library to continue to evolve over time,without locking in problematic design errors for extended periods of time.SeePEP 411 for more details.
The following will be added to the start of the package’s docstring:
The API of this package is currently provisional. Refer to thedocumentation for details.
Moving a package from the provisional to the stable state simply impliesremoving these notes from its documentation page and docstring.
We expect most packages proposed for addition into the Python standard libraryto go through a feature release in the provisional state. There may, however,be some exceptions, such as packages that use a pre-defined API (for examplelzma, which generally follows the API of the existingbz2 package),or packages with an API that has wide acceptance in the Python developmentcommunity.
In any case, packages that are proposed to be added to the standard library,whether via the provisional state or directly, must fulfill the acceptanceconditions set byPEP 2.
In principle, most provisional packages should eventually graduate to thestable standard library. Some reasons for not graduating are:
Essentially, the decision will be made by the core developers on a per-casebasis. The point to emphasize here is that a package’s inclusion in thestandard library as “provisional” in some release does not guarantee it willcontinue being part of Python in the next release. At the same time, the barfor making changes in a provisional package is quite high. We expect thatmost of the API of most provisional packages will be unchanged at graduation.Withdrawals are expected to be rare.
Currently, the core developers are really reluctant to add new interfaces tothe standard library. This is because as soon as they’re published in arelease, API design mistakes get locked in due to backward compatibilityconcerns.
By gating all major API additions through some kind of a provisional mechanismfor a full release, we get one full release cycle of community feedbackbefore we lock in the APIs with our standard backward compatibility guarantee.
We can also start integrating provisional packages with the rest of the standardlibrary early, so long as we make it clear to packagers that the provisionalpackages should not be considered optional. The only difference betweenprovisional APIs and the rest of the standard library is that provisional APIsare explicitly exempted from the usual backward compatibility guarantees.
For future end users, the broadest benefit lies in a better “out-of-the-box”experience - rather than being told “oh, the standard library tools for task Xare horrible, download this 3rd party library instead”, those superior toolsare more likely to be just be an import away.
For environments where developers are required to conduct due diligence ontheir upstream dependencies (severely harming the cost-effectiveness of, oreven ruling out entirely, much of the material on PyPI), the key benefit liesin ensuring that all packages in the provisional state are clearly underpython-dev’s aegis from at least the following perspectives:
For Python 3.3, there are a number of clear current candidates:
regex (http://pypi.python.org/pypi/regex) - approved by Guido[1].daemon (PEP 3143)ipaddr (PEP 3144)Other possible future use cases include:
requests)html5lib)simplegeneric)SeePEP 408.
This document has been placed in the public domain.
Source:https://github.com/python/peps/blob/main/peps/pep-0411.rst
Last modified:2025-02-01 08:59:27 GMT