# 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
```shell
$ 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:
```shell
$ 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](../.github/workflows/actions/publish-to-pypi), 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:
```shell
$ 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/coveooss/coveo-python-oss/tree/main/coveo-pypi-cli",
"name": "coveo-pypi-cli",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Jonathan Pich\u00e9",
"author_email": "tools@coveo.com",
"download_url": "https://files.pythonhosted.org/packages/f9/4f/e00c636fc4c20f56e08c89829221d819de6b1f466891c11f64060c059ecd/coveo_pypi_cli-2.1.13.tar.gz",
"platform": null,
"description": "# coveo-pypi-cli\n\nA very simple pypi cli that can be used to obtain the latest version of a package, or calculate the next one.\n\nServes our automatic pypi push github action.\n\n\n## `pypi current-version`\n\nDisplay the current version of a package from `pypi.org`\n\n\n## `pypi next-version`\n\nCompute the next version of a package.\n\n- Can be given a minimum version\n - e.g.: pypi is `0.0.3` and mininum set to `0.1`: next version will be `0.1`\n- Supports computing pre-release versions\n\n# private index support\n\nYou can target a private pypi server through a switch or an environment variable.\n\n## Using the `--index` switch\n\n```shell\n$ pypi current-version secret-package --index https://my.pypi.server.org\n1.0.0\n\n$ pypi current-version secret-package --index https://my.pypi.server.org:51800/urlprefix\n1.0.0\n```\n\n## Using the environment variable:\n\n```shell\n$ PYPI_CLI_INDEX=\"https://my.pypi.server.org\" pypi current-version secret-package\n```\n\nNote: Unlike `pip --index-url`, **you must omit** the `/simple` url prefix.\nThe API used by `coveo-pypi-cli` is served by the `/pypi` endpoint _and should not be specified either!_\n\n\n# pypi-cli in action\n\nThe best example comes from the [github action](../.github/workflows/actions/publish-to-pypi), which computes the next version based on the current release and what's in the `pyproject.toml`.\n\nHere's what you can expect from the tool:\n\n```shell\n$ pypi current-version coveo-functools\n0.2.1\n\n$ pypi next-version coveo-functools\n0.2.2\n\n$ pypi next-version coveo-functools --prerelease\n0.2.2a1\n\n$ pypi next-version coveo-functools --minimum-version 0.2\n0.2.2\n\n$ pypi next-version coveo-functools --minimum-version 0.3\n0.3\n\n$ pypi next-version coveo-functools --minimum-version 0.3 --prerelease\n0.3a1\n\n\n# Here's an example of how we use it in the github action\n\n$ poetry version\ncoveo-pypi-cli 0.1.0\n$ minimum_version=$(poetry version | cut --fields 2 --delimiter ' ' )\n0.1.0\n\n# when left unattended, the next-version increments the patch number\n$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version\n0.2.2\n\n# in order to change the minor or major, because the script uses `poetry version` to obtain the minimum version, \n# just set it in `pyproject.toml` manually or by calling `poetry version <new-version>` (and commit!)\n$ poetry version 0.3\nBumping version from 0.1.0 to 0.3\n$ minimum_version=$(poetry version | cut --fields 2 --delimiter ' ' )\n0.3\n$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version\n0.3\n\n# IMPORTANT: the publish step MUST set the computed version for poetry before publishing!\n$ poetry version $minimum_version\n0.3\n$ poetry publish\n...\n\n# after publishing the above, repeating the steps would yield:\n$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version\n0.3.1\n\n# for completeness, you can also publish pre-releases:\n$ pypi next-version coveo-pypi-cli --minimum-version $minimum_version --prerelease\n0.3.1a1\n\n \n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Query and compute pypi versions from command line.",
"version": "2.1.13",
"project_urls": {
"Homepage": "https://github.com/coveooss/coveo-python-oss/tree/main/coveo-pypi-cli",
"Repository": "https://github.com/coveooss/coveo-python-oss/tree/main/coveo-pypi-cli"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1a5f5005ee745e9ef73c3d79981f8f1c9df9d0b873cf7e08641554b35083bcc5",
"md5": "fa59b6b346dffd6a6907431232f40865",
"sha256": "e330da90532eaa2b605a82ea56baa9a248654c785a8d02148b084a4359bcee7a"
},
"downloads": -1,
"filename": "coveo_pypi_cli-2.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa59b6b346dffd6a6907431232f40865",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.8",
"size": 6639,
"upload_time": "2024-08-13T21:09:30",
"upload_time_iso_8601": "2024-08-13T21:09:30.516775Z",
"url": "https://files.pythonhosted.org/packages/1a/5f/5005ee745e9ef73c3d79981f8f1c9df9d0b873cf7e08641554b35083bcc5/coveo_pypi_cli-2.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f94fe00c636fc4c20f56e08c89829221d819de6b1f466891c11f64060c059ecd",
"md5": "e5b23276bc194f0ff316f4aeb7d5380c",
"sha256": "b1bff2c865ab6ecb0b3cf23fdd43a5c026c946bc4313d5e0621e446029ab9851"
},
"downloads": -1,
"filename": "coveo_pypi_cli-2.1.13.tar.gz",
"has_sig": false,
"md5_digest": "e5b23276bc194f0ff316f4aeb7d5380c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.8",
"size": 5191,
"upload_time": "2024-08-13T21:09:32",
"upload_time_iso_8601": "2024-08-13T21:09:32.096002Z",
"url": "https://files.pythonhosted.org/packages/f9/4f/e00c636fc4c20f56e08c89829221d819de6b1f466891c11f64060c059ecd/coveo_pypi_cli-2.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-13 21:09:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "coveooss",
"github_project": "coveo-python-oss",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "coveo-pypi-cli"
}