I am trying to set up Azure Devops to publish to a PyPI feed with Poetry.
I know about Twine authentication and storing credentials to an Azure Key Vault. But is there any more straightforward method? Something like this:
- script: |
source .venv/bin/activate
poetry build
displayName: Build wheel
- script: |
source .venv/bin/activate
poetry publish -u USER -p PASS
displayName: Publish wheel
Yes. In the Azure DevOps web interface:
username
and password
and valued with the PyPI credentials (Pipelines > Edit > Variables > New variable > Keep this value secret > OK).azure-pipelines.yml
CI file with this:trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.7
displayName: Install Python
- script: |
python -m pip install -U pip
pip install poetry
poetry install
displayName: Install software
- script: |
poetry run python -m unittest discover tests/ -v
displayName: Test software
- script: |
poetry build
displayName: Package software
- script: |
poetry config repositories.azure https://pkgs.dev.azure.com/{your organization}/_packaging/{your feed}/pypi/upload
poetry config http-basic.azure $(username) $(password)
poetry publish -r azure
exit 0
displayName: Publish software