2015年4月5日 星期日

reference requirements.txt for the install_requires in setup.py

from pip.req import parse_requirements

# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements(<requirements_path>)

# reqs is a list of requirement
# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
reqs = [str(ir.req) for ir in install_reqs]

setup(
...
    install_requires=reqs
)

* 若 requirements.txt 裏有網址會有問題




References :
python - How can I reference requirements.txt for the install_requires kwarg in setuptools' setup.py file? - Stack Overflow

沒有留言:

張貼留言