使用poetry发布python包到pypi.io

Ref:

https://johnfraney.ca/posts/2019/05/28/create-publish-python-package-poetry/

第一步:注册pypi.org和test.pypi.org的用户,注意他们俩是不通用的

第二步:修改项目的pyproject.toml文件,例如(https://gitee.com/waketzheng/aiopathlib.git):

[tool.poetry]
name = "aiopathlib"
version = "0.1.0"
description = "Pathlib support for asyncio"
authors = ["Waket Zheng <waketzheng@gmail.com>"]
license = "MIT"
readme = "README.rst"
homepage = "https://github.com/waketzheng/aiopathlib"
repository = "https://github.com/waketzheng/aiopathlib"
keywords = ["aiopathlib", "asyncpath", "aiopath"]
classifiers = [
    "License :: OSI Approved :: MIT License",
    "Development Status :: 4 - Beta",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3 :: Only",
    "Operating System :: POSIX",
    "Environment :: Web Environment",
    "Intended Audience :: Developers",
    "Topic :: Software Development",
    "Topic :: Software Development :: Libraries",
    "Framework :: AsyncIO",
]
include = [
    "LICENSE",
]

[tool.poetry.dependencies]
python = "^3.8"
aiofiles = "^0.7.0"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

第三步:发布前测试配置是否如预期

poetry build
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi  # 注:README.rst会报错,README.md则不会
pip install --index-url https://test.pypi.org/simple/ your-package-name

第四步:发布到pypi

poetry publish

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值