如何使用诗歌发布到Azure Devops PyPI feed? [英] How to publish to an Azure Devops PyPI feed with Poetry?
本文介绍了如何使用诗歌发布到Azure Devops PyPI feed?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将Azure Devops设置为通过诗歌发布到PyPI feed.
I am trying to set up Azure Devops to publish to a PyPI feed with Poetry.
我了解Twine身份验证以及将凭据存储到Azure密钥保管库的知识.但是,还有其他更简单的方法吗?像这样:
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
推荐答案
是.在Azure DevOps Web界面中:
Yes. In the Azure DevOps web interface:
- 创建新的PyPI提要(工件>新建提要>创建).
- 创建PyPI凭据(连接到供稿> Python>生成Python凭据).
- 创建名为
username
和password
的 secret 管道变量,并使用PyPI凭据对其进行赋值(管道>编辑>变量>新变量>保持此状态)价值机密>确定). - 使用以下命令更新
azure-pipelines.yml
CI文件的内容:
- Create a new PyPI feed (Artifacts > New feed > Create).
- Create PyPI credentials (Connect to feed > Python > Generate Python credentials).
- Create secret pipeline variables named
username
andpassword
and valued with the PyPI credentials (Pipelines > Edit > Variables > New variable > Keep this value secret > OK). - Update the contents of the
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
这篇关于如何使用诗歌发布到Azure Devops PyPI feed?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文