Skip to main content

Query and compute pypi versions from command line.

Project description


A very simple pypi cli that can be used to obtain the latest version of a package, or calculate the next one.

Serves our automatic pypi push github action.

pypi current-version

Display the current version of a package from

pypi next-version

Compute the next version of a package.

  • Can be given a minimum version
    • e.g.: pypi is 0.0.3 and mininum set to 0.1: next version will be 0.1
  • Supports computing pre-release versions

private index support

You can target a private pypi server through a switch or an environment variable.

Using the --index switch

$ pypi current-version secret-package --index

$ pypi current-version secret-package --index

Using the environment variable:

$ PYPI_CLI_INDEX="" pypi current-version secret-package

Note: Unlike pip --index-url, you must omit the /simple url prefix. The API used by coveo-pypi-cli is served by the /pypi endpoint and should not be specified either!

pypi-cli in action

The best example comes from the github action, which computes the next version based on the current release and what's in the pyproject.toml.

Here's what you can expect from the tool:

$ pypi current-version coveo-functools

$ pypi next-version coveo-functools

$ pypi next-version coveo-functools --prerelease

$ pypi next-version coveo-functools --minimum-version 0.2

$ pypi next-version coveo-functools --minimum-version 0.3

$ pypi next-version coveo-functools --minimum-version 0.3 --prerelease

# Here's an example of how we use it in the github action

$ poetry version
coveo-pypi-cli 0.1.0
$ minimum_version=$(poetry version | cut --fields 2 --delimiter ' ' )

# when left unattended, the next-version increments the patch number
$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version

# in order to change the minor or major, because the script uses `poetry version` to obtain the minimum version, 
# just set it in `pyproject.toml` manually or by calling `poetry version <new-version>` (and commit!)
$ poetry version 0.3
Bumping version from 0.1.0 to 0.3
$ minimum_version=$(poetry version | cut --fields 2 --delimiter ' ' )
$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version

# IMPORTANT: the publish step MUST set the computed version for poetry before publishing!
$ poetry version $minimum_version
$ poetry publish

# after publishing the above, repeating the steps would yield:
$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version

# for completeness, you can also publish pre-releases:
$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version --prerelease


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for coveo-pypi-cli, version 2.0.1
Filename, size File type Python version Upload date Hashes
Filename, size coveo_pypi_cli-2.0.1-py3-none-any.whl (6.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size coveo-pypi-cli-2.0.1.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page