@lets-release/pypi
v5.0.0
Published
Let's Release pypi plugin
Downloads
361
Readme
@lets-release/pypi
lets-release plugin for publishing PyPI packages.
This plugin only supports python projects with valid [pyproject.toml][] file.
| Step | Description |
| ------------------ | ------------------------------------------------------------------- |
| findPackages | Find packages in workspace. |
| verifyConditions | Verify the authentication method is valid. |
| prepare | Update the [pyproject.toml][] project version and build packages. |
| publish | Publish the packages to the registry. |
Usage
The plugin can be configured in the lets-release configuration file:
{
"plugins": ["@lets-release/commit-analyzer", "@lets-release/release-notes-generator", "@lets-release/pypi"]
}Configuration
Options
| Options | Description | Default |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| skipPublishing | Whether to publish the package to the registry. If true, the [pyproject.toml][] project version will still be updated. | true if the project table in [pyproject.toml][] has classifiers beginning with Private ::; false otherwise. |
| distDir | The output directory to which distributions should be written. Relative to the package root. | dist |
[tool.lets-release] table in pyproject.toml
There are no standard fields in the [pyproject.toml][] specification for setting the registry and token for publishing,
and different package managers have different ways of configuring them.
Therefore, this plugin allows reading the [tool.lets-release] configuration table in [pyproject.toml][] to obtain the relevant settings,
and this configuration will take precedence over all other configurations.
registry: The registry for publishing.token: Token for the registry.username: Username for the registry.password: Password for the registry.
For example:
[tool.lets-release]
registry = { name = "testpypi", url = "https://test.pypi.org/simple/", publish-url = "https://test.pypi.org/legacy/" }
token = "${PYPI_TOKEN}"
username = "__token__"
password = "${PYPI_PASSWORD}"Note: PyPI does not support publishing with username and password anymore, instead you need to generate a token.
Note: If both token and password are configured, token will take precedence over password.
Note: Do not save the actual token/password in [pyproject.toml][] and commit it to the repo. Use environment variables or temporarily alter [pyproject.toml][] file in the CI system.
Package manager
The supported package managers are: uv, and poetry.
uv
The registry for publishing will be determined in the following order:
registryconfig in [tool.lets-release] table, ifpublish-urlis setUV_PUBLISH_URLaspublish-urlandUV_PUBLISH_CHECK_URLasurl- registry found from uv config files, which
namematchesUV_PUBLISH_INDEXandpublish-urlis set - default to PyPI
The token for publishing will be determined in the following order:
tokenconfig in [tool.lets-release] tableUV_PUBLISH_TOKEN
The username for publishing will be determined in the following order:
usernameconfig in [tool.lets-release] tableUV_PUBLISH_USERNAME- default to
__token__
The password for publishing will be determined in the following order:
passwordconfig in [tool.lets-release] tableUV_PUBLISH_PASSWORD
poetry
The registry for publishing will be determined in the following order:
- registry found in
POETRY_REPOSITORIES_<NAME>_URLenvironment variables, which value matchespublish-urlproperty inregistryconfig in [tool.lets-release] table - registry found by
poetry configcommand, whichpublish-urlmatches withregistryconfig in [tool.lets-release] table - registry found in
POETRY_REPOSITORIES_<NAME>_URLenvironment variables, which<NAME>matchesnameproperty inregistryconfig in [tool.lets-release] table - registry found by
poetry configcommand, whichnamematches withregistryconfig in [tool.lets-release] table
The token for publishing will be determined in the following order:
tokenconfig in [tool.lets-release] tablePOETRY_PYPI_TOKEN_<NAME>- value return by
poetry config pypi-token.<name>
The username for publishing will be determined in the following order:
usernameconfig in [tool.lets-release] tablePOETRY_HTTP_BASIC_<NAME>_USERNAME- value return by
poetry config http-basic.<name>.username - default to
__token__
The password for publishing will be determined in the following order:
passwordconfig in [tool.lets-release] tablePOETRY_HTTP_BASIC_<NAME>_PASSWORD- value return by
poetry config http-basic.<name>.password
