semver 3.0.4


pip install semver

  Latest version

Released: Jan 24, 2025


Meta
Author: Kostiantyn Rybnikov, Tom Schraitle
Maintainer: Tom Schraitle, Sebastien Celles
Requires Python: >=3.7

Classifiers

Environment
  • Web Environment

Intended Audience
  • Developers

Development Status
  • 5 - Production/Stable

License
  • OSI Approved :: BSD License

Operating System
  • OS Independent

Programming Language
  • Python :: 3
  • Python :: 3.7
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Topic
  • Software Development :: Libraries :: Python Modules

A Python module to simplify semantic versioning.

Python Python versions Monthly downloads from PyPI Software license Documentation Status Black Formatter Percentage of open issues GitHub Discussion

The module follows the MAJOR.MINOR.PATCH style:

  • MAJOR version when you make incompatible API changes,

  • MINOR version when you add functionality in a backwards compatible manner, and

  • PATCH version when you make backwards compatible bug fixes.

Additional labels for pre-release and build metadata are supported.

To import this library, use:

>>> import semver

Working with the library is quite straightforward. To turn a version string into the different parts, use the semver.Version.parse function:

>>> ver = semver.Version.parse('1.2.3-pre.2+build.4')
>>> ver.major
1
>>> ver.minor
2
>>> ver.patch
3
>>> ver.prerelease
'pre.2'
>>> ver.build
'build.4'

To raise parts of a version, there are a couple of functions available for you. The function semver.Version.bump_major leaves the original object untouched, but returns a new semver.Version instance with the raised major part:

>>> ver = semver.Version.parse("3.4.5")
>>> ver.bump_major()
Version(major=4, minor=0, patch=0, prerelease=None, build=None)

It is allowed to concatenate different “bump functions”:

>>> ver.bump_major().bump_minor()
Version(major=4, minor=1, patch=0, prerelease=None, build=None)

To compare two versions, semver provides the semver.compare function. The return value indicates the relationship between the first and second version:

>>> semver.compare("1.0.0", "2.0.0")
-1
>>> semver.compare("2.0.0", "1.0.0")
1
>>> semver.compare("2.0.0", "2.0.0")
0

There are other functions to discover. Read on!

3.0.4 Jan 24, 2025
3.0.3 Jan 18, 2025
3.0.2 Oct 09, 2023
3.0.1 Jun 14, 2023
3.0.0 Apr 02, 2023
3.0.0rc1 Mar 19, 2023
3.0.0.dev4 Dec 19, 2022
3.0.0.dev3 Jan 20, 2022
3.0.0.dev2 Nov 01, 2020
3.0.0.dev1 Oct 26, 2020
2.13.0 Oct 20, 2020
2.12.0 Oct 19, 2020
2.11.0 Oct 17, 2020
2.10.2 Jun 15, 2020
2.10.1 May 13, 2020
2.10.0 May 05, 2020
2.9.1 Feb 16, 2020
2.9.0 Oct 30, 2019
2.8.1 Jul 09, 2018
2.8.0 May 16, 2018
2.7.9 Sep 23, 2017
2.7.8 Aug 25, 2017
2.7.7 May 25, 2017
2.7.6 Feb 28, 2017
2.7.5 Jan 29, 2017
2.7.4 Jan 16, 2017
2.7.3 Dec 19, 2016
2.7.2 Nov 08, 2016
2.7.1 Oct 20, 2016
2.7.0 Oct 20, 2016
2.6.0 Jun 07, 2016
2.5.0 May 24, 2016
2.4.2 May 15, 2016
2.4.1 Mar 03, 2016
2.4.0 Feb 11, 2016
2.3.1 Jan 29, 2016
2.3.0 Jan 28, 2016
2.2.1 Aug 03, 2015
2.2.0 Jun 20, 2015
2.1.2 May 22, 2015
2.1.1 May 22, 2015
2.1.0 May 22, 2015
2.0.2 Apr 14, 2015
2.0.1 Sep 24, 2014
2.0.0 Sep 12, 2014
0.0.2 May 09, 2012
0.0.1 May 09, 2012
2.7.8.macosx Aug 25, 2017
2.7.7.macosx May 25, 2017
2.7.6.macosx Feb 28, 2017
2.7.5.macosx Jan 29, 2017
2.7.4.macosx Jan 16, 2017
2.7.3.macosx Dec 19, 2016
2.7.2.macosx Nov 08, 2016
2.7.1.macosx Oct 20, 2016
2.7.0.macosx Oct 20, 2016
2.6.0.macosx Jun 07, 2016
2.5.0.macosx May 24, 2016
2.4.2.macosx May 15, 2016
2.4.1.macosx Mar 03, 2016
2.4.0.macosx Feb 11, 2016
2.3.1.macosx Jan 29, 2016
2.3.0.macosx Jan 28, 2016
2.2.1.macosx Aug 03, 2015
2.2.0.macosx Jun 20, 2015
2.1.2.macosx May 22, 2015
2.1.1.macosx May 22, 2015
2.1.0.macosx May 22, 2015
2.0.2.macosx Apr 14, 2015

Wheel compatibility matrix

Platform Python 3
any

Files in release

No dependencies