@@ -166,19 +166,15 @@ version
166166
167167 version='1.2.0',
168168
169+ This is the current version of your project, allowing your users to determine whether or not
170+ they have the latest version, and to indicate which specific versions they've tested their own
171+ software against.
169172
170- Projects should comply with the `version scheme
171- <http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers> `_
172- specified in :ref: `PEP440 <pypa:PEP440s >`. Here are some examples:
173+ Versions are displayed on :term: `PyPI <Python Package Index (PyPI)> ` for each release if you
174+ publish your project.
173175
174- ::
175-
176- 1.2.0.dev1 # Development release
177- 1.2.0a1 # Alpha Release
178- 1.2.0b1 # Beta Release
179- 1.2.0rc1 # RC Release
180- 1.2.0 # Final Release
181- 1.2.0.post1 # Post Release
176+ See :ref: `Choosing a versioning scheme ` for more information on ways to use versions to convey
177+ compatibility information to your users.
182178
183179If the project code itself needs run-time access to the version, the simplest
184180way is to keep the version in both ``setup.py `` and your code. If you'd rather
@@ -418,6 +414,120 @@ For more information, see `Automatic Script Creation
418414<http://pythonhosted.org/setuptools/setuptools.html#automatic-script-creation> `_
419415from the `setuptools docs <http://pythonhosted.org/setuptools/setuptools.html >`_.
420416
417+ Choosing a versioning scheme
418+ ----------------------------
419+
420+ Standards compliance for interoperability
421+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
422+
423+ Different Python projects may use different versioning schemes based on the needs of that
424+ particular project, but all of them are required to comply with the flexible `public version
425+ scheme <https://www.python.org/dev/peps/pep-0440/#public-version-identifiers> `_ specified
426+ in :ref: `PEP440 <pypa:PEP440s >` in order to be supported in tools and libraries like ``pip ``
427+ and ``setuptools ``.
428+
429+ Here are some examples of compliant version numbers::
430+
431+ 1.2.0.dev1 # Development release
432+ 1.2.0a1 # Alpha Release
433+ 1.2.0b1 # Beta Release
434+ 1.2.0rc1 # Release Candidate
435+ 1.2.0 # Final Release
436+ 1.2.0.post1 # Post Release
437+ 15.10 # Date based release
438+ 23 # Serial release
439+
440+ To further accommodate historical variations in approaches to version numbering,
441+ :ref: `PEP440 <pypa:PEP440s >` also defines a comprehensive technique for `version
442+ normalisation <https://www.python.org/dev/peps/pep-0440/#normalization> `_ that maps
443+ variant spellings of different version numbers to a standardised canonical form.
444+
445+ Scheme choices
446+ ~~~~~~~~~~~~~~
447+
448+ Semantic versioning (preferred)
449+ *******************************
450+
451+ For new projects, the recommended versioning scheme is based on `Semantic Versioning
452+ <http://semver.org> `_, but adopts a different approach to handling pre-releases and
453+ build metadata.
454+
455+ The essence of semantic versioning is a 3-part MAJOR.MINOR.MAINTENANCE numbering scheme,
456+ where the project author increments:
457+
458+ 1. MAJOR version when they make incompatible API changes,
459+ 2. MINOR version when they add functionality in a backwards-compatible manner, and
460+ 3. MAINTENANCE version when they make backwards-compatible bug fixes.
461+
462+ Adopting this approach as a project author allows users to make use of `"compatible release"
463+ <https://www.python.org/dev/peps/pep-0440/#compatible-release> `_ specifiers, where
464+ ``name ~= X.Y `` requires at least release X.Y, but also allows any later release with
465+ a matching MAJOR version.
466+
467+ Python projects adopting semantic versioning should abide by clauses 1-8 of the
468+ `Semantic Versioning 2.0.0 specification <http://semver.org >`_.
469+
470+ Date based versioning
471+ *********************
472+
473+ Semantic versioning is not a suitable choice for all projects, such as those with a regular
474+ time based release cadence and a deprecation process that provides warnings for a number of
475+ releases prior to removal of a feature.
476+
477+ A key advantage of date based versioning is that it is straightforward to tell how old the
478+ base feature set of a particular release is given just the version number.
479+
480+ Version numbers for date based projects typically take the form of YEAR.MONTH (for example,
481+ ``12.04 ``, ``15.10 ``).
482+
483+ Serial versioning
484+ *****************
485+
486+ This is the simplest possible versioning scheme, and consists of a single number which is
487+ incremented every release.
488+
489+ While serial versioning is very easy to manage as a developer, it is the hardest to track
490+ as an end user, as serial version numbers convey little or no information regarding API
491+ backwards compatibility.
492+
493+ Hybrid schemes
494+ **************
495+
496+ Combinations of the above schemes are possible. For example, a project may combine date
497+ based versioning with serial versioning to create a YEAR.SERIAL numbering scheme that
498+ readily conveys the approximate age of a release, but doesn't otherwise commit to a particular
499+ release cadence within the year.
500+
501+ Pre-release versioning
502+ ~~~~~~~~~~~~~~~~~~~~~~
503+
504+ Regardless of the base versioning scheme, pre-releases for a given final release may be
505+ published as:
506+
507+ * zero or more dev releases (denoted with a ".devN" suffix)
508+ * zero or more alpha releases (denoted with a ".aN" suffix)
509+ * zero or more beta releases (denoted with a ".bN" suffix)
510+ * zero or more release candidates (denoted with a ".rcN" suffix)
511+
512+ ``pip `` and other modern Python package installers ignore pre-releases by default when
513+ deciding which versions of dependencies to install.
514+
515+
516+ Local version identifiers
517+ ~~~~~~~~~~~~~~~~~~~~~~~~~
518+
519+ Public version identifiers are designed to support distribution via
520+ :term: `PyPI <Python Package Index (PyPI)> `. Python's software distribution tools also support
521+ the notion of a `local version identifier
522+ <https://www.python.org/dev/peps/pep-0440/#local-version-identifiers> `_, which can be used to
523+ identify local development builds not intended for publication, or modified variants of a release
524+ maintained by a redistributor.
525+
526+ A local version identifier takes the form ``<public version identifier>+<local version label> ``.
527+ For example::
528+
529+ 1.2.0.dev1+hg.5.b11e5e6f0b0b # 5th VCS commmit since 1.2.0.dev1 release
530+ 1.2.1+fedora.4 # Package with downstream Fedora patches applied
421531
422532
423533Working in "Development Mode"
0 commit comments