2. Installing semver¶
2.1. Release Policy¶
As semver uses Semantic Versioning, breaking changes are only introduced in major
releases (incremented X
in “X.Y.Z”).
Refer to section Version Policy for a general overview.
For users who want or need to stay with major 3 releases only, add the
following version restriction (setup.py
, requirements.txt
,
or pyproject.toml
):
semver>=3,<4
This line avoids surprises. You will get any updates within the major 3 release like 3.1.x and above. However, you will never get an update for semver 4.0.0.
For users who have to stay with major 2 releases only, use the following line:
semver>=2,<3
2.2. With Pip¶
pip3 install semver
If you want to install this specific version (for example, 3.0.0), use the command pip with an URL and its version:
pip3 install git+https://github.com/python-semver/python-semver.git@3.0.0
2.3. With uv¶
First, install the uv command. Refer to https://docs.astral.sh/uv/getting-started/installation/ for more information.
Then use the command uv to install the package:
uv pip install semver
2.4. Linux Distributions¶
Note
Some Linux distributions can have outdated packages. These outdated packages does not contain the latest bug fixes or new features. If you need a newer package, you have these option:
Ask the maintainer to update the package.
Update the package for your favorite distribution and submit it.
Use a Python virtual environment and pip install.
2.4.1. Arch Linux¶
Enable the community repositories first:
[community] Include = /etc/pacman.d/mirrorlist
Install the package:
$ pacman -Sy python-semver
2.4.2. Debian¶
Update the package index:
$ sudo apt-get update
Install the package:
$ sudo apt-get install python3-semver
2.4.3. Fedora¶
$ dnf install python3-semver
2.4.4. FreeBSD¶
$ pkg install py36-semver
2.4.5. openSUSE¶
Enable the
devel:languages:python
repository of the Open Build Service:$ sudo zypper addrepo --refresh \ --name devel_languages_python \ "https://download.opensuse.org/repositories/devel:/languages:/python/\$releasever"
Install the package:
$ sudo zypper install --repo devel_languages_python python3-semver
2.4.6. Ubuntu¶
Update the package index:
$ sudo apt-get update
Install the package:
$ sudo apt-get install python3-semver