State install version notation

Installing a package (“package_name”) using the State Tool can be done using the following syntax to:

  1. Install a specific package version, or
  2. Install a relative or unspecified package version. Installing an unspecified package will default to the package that is defined by the comparators shown below.
  3. Uninstall a package from your project

alt_text


To install a specific package version

The following syntax will install a specific version of the package (package_name) to your project.

state install <package_name@version_number>

For example

state install requests@2.31.0

To install an unspecified or relative package version

You can select or exclude specific versions of the package from installation using the comparators shown in the image above. Installing “package_name@<2” will install the latest version before the release of 2.0.0. Note the inclusion of quotes surrounding the package name and version.

state install "<package_name[@[<=>]version]>"

For example

state install "requests@<3"

Or using the following format without quotes surrounding the package name and approximate version (“approximate_version”). This will install the most stable version of the package available in the relative version. Use “x” to denote the approximate version.

state install <package_name>@<approximate_version>

For example

state install django@4.x

To uninstall a package

Enter the following format, the package will be uninstalled without the need to specify the version

state uninstall <package_name>

For example

state uninstall requests