This document attempts to refine Python's PEP 440 to include the principles of Semantic Versioning.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
-
Versions will first follow the specification described in PEP 440. Before interpreting a version according to this specification, it should be normalized per PEP 440.
-
Software using Semantic Versioning MUST declare a public API. This API could be declared in the code itself or exist strictly in documentation. However it is done, it should be precise and comprehensive.
-
A release segment MUST contain three values, which shall be referred to herein as the major version, the minor version, and the patch version.
-
Once a versioned package has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version.
-
Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.
-
Version 1.0.0 defines the public API. The way in which the version number is incremented after this release is dependent on this public API and how it changes.
-
Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards compatible bug fixes are introduced. A bug fix is defined as an internal change that fixes incorrect behavior.
-
Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards compatible functionality is introduced to the public API. It MUST be incremented if any public API functionality is marked as deprecated. It MAY be incremented if substantial new functionality or improvements are introduced within the private code. It MAY include patch level changes. Patch version MUST be reset to 0 when minor version is incremented.
-
Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API. It MAY include minor and patch level changes. Patch and minor version MUST be reset to 0 when major version is incremented.
The following table demonstrates equivalent versions in Semver 2.0 and 440 Semver:
Semver 2.0 | 440 Semver |
---|---|
1.0.0-DEV.1 | 1.0.0.dev1 |
1.0.0-a.0.DEV.3 | 1.0.0a0.dev3 |
1.0.0-alpha.0 | 1.0.0a0 |
1.0.0-b.2.DEV.5 | 1.0.0b2.dev5 |
1.0.0-beta.2 | 1.0.0b2 |
1.0.0-c.4.DEV.7 | 1.0.0rc4.dev7 |
1.0.0-rc.4 | 1.0.0rc4 |
Other possible conversions to Semver 2.0 include:
D1: No DEV segment
D2: DEV lowercase except in initial position within pre-release version
R1: Short name of rc is pre
R2: rc renamed to preview, with short name pre