Refer to [poetry's documentation](https://python-poetry.org/docs/pyproject/) for additional configuration options.
Refer to [poetry's documentation](https://python-poetry.org/docs/pyproject/) for additional configuration options.
The following job can be used to deploy the image. Note that PyPI uses [trusted publishers](https://docs.pypi.org/trusted-publishers/), no keys are necessary when the CI pipeline is configured.
To configure deployment of the PyPI package:
```yaml
1.[Authenticate to PyPI](https://pypi.org/account/login/) using the "PyPI GitLab" credentials found in 1Password (PyPI does not support organizations as of now).
deploy:
1. Create a token under `Account Settings > Add API Tokens`.
stage:deploy
1. For the initial publish, select `Entire account (all projects)` scope. If the project already exists, scope the token to the specific project.
image:python:3.12
1. Configure credentials:
script:
-poetry --build publish
Locally:
rules:
-if:$CI_COMMIT_TAG =~ /^v-/
```shell
```
poetry config pypi-token.pypi <your-api-token>
```
To configure deployment with CI, set the `POETRY_PYPI_TOKEN_PYPI` to the token created. Alternatively, define a [trusted publisher](https://docs.pypi.org/trusted-publishers/) for the project, in which case no token is needed.
1. Use [Poetry to publish](https://python-poetry.org/docs/cli/#publish) your package: