bdist 轮的引脚依赖项,同时保持未固定以进行开发

问题描述

我打算将我的 Python 项目作为带有固定依赖项版本的 bdist 轮分发,以便对上游依赖项的更改不会破坏我的代码。但是,当有人安装我的项目的开发版本时,例如通过 pip install -e,我希望引入最新版本的依赖项,以便我可以不断针对它们测试我的代码

依赖项列在 setup.py 中:

from setuptools import setup

setup(
    ...
    install_requires=["numpy","scipy","matplotlib"],)

我从项目根目录(包含 setup.py 的那个)创建轮子:

pip wheel . --no-deps

创建的轮子在安装后,还将安装最新版本的 Numpy、Scipy 和 Matplotlib。解压后的轮子的 MetaDATA 文件(pip 在安装时用来确定项目的依赖项)显示了这种情况:

...other Metadata...
Requires-dist: numpy
Requires-dist: scipy
Requires-dist: matplotlib

如果我更改 install_requires 中的 setup.py 以设置依赖项的显式版本(例如使用 install_requires=["numpy==1.20.0",...etc...]),则创建的轮子的 MetaDATA 会改为列出:

...other Metadata...
Requires-dist: numpy (==1.20.0)
...other dependencies...

这会告诉最终用户机器上的 pip 获取 Numpy 1.20.0。这就是我想要的轮子,但是每当有人运行 pip install -e . 时,他们也会得到这些固定版本。

有没有办法以编程方式指定“开发”依赖项而不是“轮”依赖项?还是我一直在告诉人们手动运行 pip install -r unpinned-requirements.txtpip install -e . --no-deps

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)