python - 上传 python 包而不重建

标签 python distutils

我想构建一个 python 包,针对构建工件运行测试,然后将 python 包上传到 PyPI,无需重新构建包。

我们正在构建 CI/CD 管道,并希望确保发布的是我们构建和测试的确切包,而不是事后重新构建的版本。

目前,如果我运行以下命令:

$ python setup.py egg_info -b .$BUILD_NUM sdist bdist_wheel

然后运行我的测试并运行:

$ python setup.py egg_info -b .$BUILD_NUM sdist bdist_wheel upload

然后文件上的时间戳显示该文件已第二次重建。

有没有办法提交文件而不重新构建它们?

最佳答案

通过在命令中使用 sdistbdist_wheel,您可以明确命令 setup.py 来重建软件包。如果您想上传而不重建,只需使用python setup.py upload。或者更好的是,使用 twine ;这是推荐上传到 PyPI 的方式。

twine upload dist/*

twine 查找 dist,获取包名称和版本并上传包。

关于python - 上传 python 包而不重建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44953847/

相关文章:

Python静态方法,为什么?

python - 检测颜色并从图像中删除该颜色

python - 为什么 Python 2.6 没有设置字面量和推导式或字典推导式?

覆盖 cmdclass 时忽略 python setuptools install_requires

python - Homebrew 软件/Python : Convince distutils to link against a specific library on OS X?

python - 在 Raspberry Pi 中使用 OpenCV 和套接字通过 TCP 发送视频

python - 强制 matrix_world 在 Blender 中重新计算

cython - 分发 python 包时处理 dylibs

python - distutils:如何将用户定义的参数传递给 setup.py?

python - 让 py2exe 包含我的数据文件(如 include_package_data)