我试图访问PyPI包的依赖项(即其install_requires元数据).
JSON或XMLRPC API似乎无法提供此信息. XMLRPC API的
documentation表示release_data方法应该返回带有requires键的dict,但是当我使用API时,我没有看到这个.
>>> import xmlrpclib
>>> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
>>> info = client.release_data('Flask', '0.10.1')
>>> 'requires' in info
False
>>> info
{'_pypi_hidden': False,
'_pypi_ordering': 17,
'author': 'Armin Ronacher',
'author_email': 'armin.ronacher@active-4.com',
'bugtrack_url': None,
'cheesecake_code_kwalitee_id': None,
'cheesecake_documentation_id': None,
'cheesecake_installability_id': None,
'classifiers': ['Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'],
'description': 'Flask\n-----\n\nFlask is a microframework for Python based on Werkzeug, Jinja 2 and good\nintentions. And before you ask: It\'s BSD licensed!\n\nFlask is Fun\n````````````\n\n.. code:: python\n\n from flask import Flask\n app = Flask(__name__)\n\n @app.route("/")\n def hello():\n return "Hello World!"\n\n if __name__ == "__main__":\n app.run()\n\nAnd Easy to Setup\n`````````````````\n\n.. code:: bash\n\n $pip install Flask\n $python hello.py\n * Running on http://localhost:5000/\n\nLinks\n`````\n\n* `website <http://flask.pocoo.org/>`_\n* `documentation <http://flask.pocoo.org/docs/>`_\n* `development version\n <http://github.com/mitsuhiko/flask/zipball/master#egg=Flask-dev>`_',
'docs_url': '',
'download_url': 'UNKNOWN',
'downloads': {'last_day': 4723, 'last_month': 267891, 'last_week': 64752},
'home_page': 'http://github.com/mitsuhiko/flask/',
'keywords': None,
'license': 'BSD',
'maintainer': None,
'maintainer_email': None,
'name': 'Flask',
'package_url': 'http://pypi.python.org/pypi/Flask',
'platform': 'any',
'release_url': 'http://pypi.python.org/pypi/Flask/0.10.1',
'requires_python': None,
'stable_version': None,
'summary': 'A microframework based on Werkzeug, Jinja2 and good intentions',
'version': '0.10.1'}
有没有其他方法可以在不安装软件包的情况下获得软件包的依赖关系?
最佳答案 我知道从pypi中提取依赖关系的唯一方法是:
>下载包并将其解压缩到某个目录
>运行setup.py egg_info
> Parse生成requires.txt
对于烧瓶0.10.1,它将是
Werkzeug>=0.7
Jinja2>=2.4
itsdangerous>=0.21