[英]Setup.py skip dev dependency from requirements.txt
I have a requirements.txt file with following dependecies:我有一个具有以下依赖项的 requirements.txt 文件:
PyYAML
requests
nose
tox
mock
coverage
I would like setup.py to skip nose, tox mock and coverage dependencies.我希望 setup.py 跳过鼻子、tox 模拟和覆盖范围的依赖关系。 My setup.py file looks like:我的 setup.py 文件如下所示:
#!/usr/bin/env python3
"""Setup Information."""
from setuptools import setup, find_packages
with open('requirements.txt') as f:
required_dependencies = f.read().splitlines()
setup(
name="DemoModule",
version="1.0",
description="A library with inputs",
packages=find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: SomeLicences.com",
"Operating System :: OS Independent",
],
install_requires=required_dependencies,
)
The simple answer would be to add a line to your setup.py like the following简单的答案是在 setup.py 中添加一行,如下所示
#!/usr/bin/env python3
"""Setup Information."""
from setuptools import setup, find_packages
with open('requirements.txt') as f:
required_dependencies = f.read().splitlines()
# Do not install nose
required_dependencies.remove('nose')
setup(
name="DemoModule",
version="1.0",
description="A library with inputs",
packages=find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: SomeLicences.com",
"Operating System :: OS Independent",
],
install_requires=required_dependencies,
)
However, removing it from the requirements.txt would perhaps be cleaner and accomplish the same thing.但是,从 requirements.txt 中删除它可能会更清晰并完成同样的事情。
It would be helpful to know more about the issue and why installing nose is giving you problems.了解更多关于这个问题以及为什么安装鼻子会给你带来问题会很有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.