我正在尝试访问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'}
我是否有另一种方法可以在不安装软件包的情况下获得软件包的依赖关系?
答案 0 :(得分:2)
我知道从pypi中提取依赖关系的唯一方法是:
setup.py egg_info
requires.txt
将是
Werkzeug>=0.7
Jinja2>=2.4
itsdangerous>=0.21