- 克隆仓库:
git clone https://github.com/guyue55/py_example.git
cd py_example- 安装开发依赖:
pip install -e .python -m unittest discover tests- Fork 项目仓库
- 创建功能分支
- 提交变更
- 运行测试确保通过
- 提交 Pull Request
- 遵循语义化版本规范
- 在 setup.py 中更新版本号
- 添加版本更新日志
先安装依赖
python -m pip install --upgrade setuptools wheel twine -i https://mirrors.aliyun.com/pypi/simple/- 构建分发包:
python setup.py sdist bdist_wheel- 检查包是否符合PyPI的要求
python -m twine check dist/*- 上传到 PyPI:
python -m twine upload dist/*注意事项
- API token:上传到PyPI需要API token,没有的话先去网站注册账号再生成API token( https://pypi.org/)
- 避免每次都要输入token:设置$HOME/.pypirc
[pypi] username = __token__ password = pypi-xxxxxx