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 to0.1
: next version will be0.1
- e.g.: pypi is
- Supports computing pre-release versions
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
Release history Release notifications | RSS feed
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.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for coveo_pypi_cli-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33acfdaac5da370ab522eec0cc52355814e460ec3821fb1b157287c926c1e673 |
|
MD5 | 9c2a103727b96f6ab79224f46a534cb9 |
|
BLAKE2b-256 | 00909fa1ffc7473f0d0e4c9ba62ef7199b74f9f588fec26b1ce5c51f9c9a7fee |