setup.py "nice to have" 依赖模块
setup.py "nice to have" dependency modules
我正在查看一个看起来有点像这个的 setup.py 文件:
#!/usr/bin/env python
from setuptools import setup, find_packages
import sys
if sys.argv[1] == 'test':
import multiprocessing, logging
from billiard import util
with open('requirements.txt') as f:
required = f.read().splitlines()
if sys.version_info < (2, 7, 0):
required.append('importlib')
setup(
version='0.1',
name='...',
description='...',
author='...',
author_email='...',
packages=find_packages(),
package_data={},
install_requires=required,
include_package_data=True,
tests_require=[
'billiard',
'nose==1.3'
],
test_suite='nose.collector'
)
我正在尝试在 windows 上安装模块。该模块似乎是在另一个 OS 上开发的,因为它无法编译 requirements.txt
.
中的一个模块 (leveldb
)
查看代码,它似乎可以在没有 leveldb
的情况下工作(尽管性能可能较差)。 是否有任何简单的方法来更改 leveldb
库的状态,使其安装失败不会阻止主模块的安装?
显然我可以从 requirements.txt 中删除依赖项,但我正在考虑如何编辑库以适应 windows。
您可以将可选依赖项声明为 extras in your setup.py
我正在查看一个看起来有点像这个的 setup.py 文件:
#!/usr/bin/env python
from setuptools import setup, find_packages
import sys
if sys.argv[1] == 'test':
import multiprocessing, logging
from billiard import util
with open('requirements.txt') as f:
required = f.read().splitlines()
if sys.version_info < (2, 7, 0):
required.append('importlib')
setup(
version='0.1',
name='...',
description='...',
author='...',
author_email='...',
packages=find_packages(),
package_data={},
install_requires=required,
include_package_data=True,
tests_require=[
'billiard',
'nose==1.3'
],
test_suite='nose.collector'
)
我正在尝试在 windows 上安装模块。该模块似乎是在另一个 OS 上开发的,因为它无法编译 requirements.txt
.
leveldb
)
查看代码,它似乎可以在没有 leveldb
的情况下工作(尽管性能可能较差)。 是否有任何简单的方法来更改 leveldb
库的状态,使其安装失败不会阻止主模块的安装?
显然我可以从 requirements.txt 中删除依赖项,但我正在考虑如何编辑库以适应 windows。
您可以将可选依赖项声明为 extras in your setup.py