Skip to main content

Query and compute pypi versions from command line.

Project description

coveo-pypi-cli

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.org

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 https://my.pypi.server.org
1.0.0

$ pypi current-version secret-package --index https://my.pypi.server.org:51800/urlprefix
1.0.0

Using the environment variable:

$ PYPI_CLI_INDEX="https://my.pypi.server.org" 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
0.2.1

$ pypi next-version coveo-functools
0.2.2

$ pypi next-version coveo-functools --prerelease
0.2.2a1

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

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

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


# 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 ' ' )
0.1.0

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

# 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 ' ' )
0.3
$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version
0.3

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

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

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

 

Project details


Download files

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

Source Distribution

coveo-pypi-cli-1.0.7.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coveo_pypi_cli-1.0.7-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file coveo-pypi-cli-1.0.7.tar.gz.

File metadata

  • Download URL: coveo-pypi-cli-1.0.7.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.5 Linux/5.4.0-1046-azure

File hashes

Hashes for coveo-pypi-cli-1.0.7.tar.gz
Algorithm Hash digest
SHA256 5d703e0eea32faf010fbfbf26fdbbc7874e1b0ac9e3196c67a9c18bbae32e904
MD5 a20ac52432569929ea249d8745c9dba6
BLAKE2b-256 f89ef31a3dd736359dff694bdb66523f6545250a98e2806cfc0359bba1ae7d07

See more details on using hashes here.

File details

Details for the file coveo_pypi_cli-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: coveo_pypi_cli-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.5 Linux/5.4.0-1046-azure

File hashes

Hashes for coveo_pypi_cli-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2d8abced460a261108c407d36087c294b46cbff33aae20b4545a034a5d4cab7d
MD5 f3e1590fcc4785fe385a0e527781ff96
BLAKE2b-256 da7ceca6cefb746b8cf2960dab194c0b40242a6ee702703654a465ddf0ac4519

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page