我正在构建一个新的 PyPI package基于使用 setuptools 的现有开源项目并添加一些代码修改(它们不一样)。 示例:
opensource-custom=2.13.1
由于该项目需要依赖项来查找开源
在构建轮子文件时,我可以将哪些选项传递给我的 setup.py
,这样当我执行 pip freeze
/pip list
时我可以看到两者?
opensource-custom=2.13.1
opensource=2.13.0
此场景的一个示例是 intel-numpy
,如果您对其进行 pip install
,它将生成 numpy
的副本。
>pip install intel-numpy
>pip freeze
icc-rt==2019.0
intel-numpy==1.15.1
intel-openmp==2019.0
mkl==2019.0
mkl-fft==1.0.6
mkl-random==1.0.1.1
numpy==1.15.1
tbb==2019.0
tbb4py==2019.0
最佳答案
听起来您想让 opensource
成为 opensource-custom
的依赖项。为此,您可以在 setup.py
中指定 install_requires
参数:
from setuptools import setup
setup(
name='opensource-custom',
install_requires=[
'opensource',
],
...
)
参见https://packaging.python.org/guides/distributing-packages-using-setuptools/#install-requires
关于Python 包附加名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57277642/