Python包依赖关系树

编程入门 行业动态 更新时间:2024-10-28 06:31:21
本文介绍了Python包依赖关系树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想分析Python软件包的依赖关系树。我如何获取这些数据?

I would like to analyze the dependency tree of Python packages. How can I obtain this data?

我已经知道的事情

  • setup.py 有时包含一个 requires 字段,其中列出了程序包的依赖项
  • PyPi是一个Python软件包的在线存储库
  • PyPi具有API
  • setup.py sometimes contains a requires field that lists package dependencies
  • PyPi is an online repository of Python packages
  • PyPi has an API
  • 我不知道的事情

  • PyPi上的极少数项目(约10%)在要求字段,但 pip / easy_install 仍然可以下载正确的软件包。我想念什么?例如,流行的统计计算库 pandas 没有列出 requires ,但仍设法安装了 numpy , pytz 等。是否有更好的方法来自动收集依赖项的完整列表?
  • 某处是否存在预先存在的数据库?我要重复现有的工作吗?
  • 使用分发系统(R,Clojure等)是否存在类似的,易于访问的其他语言的数据库?
  • Very few projects (around 10%) on PyPi explicitly list dependencies in the requires field but pip/easy_install still manage to download the correct packages. What am I missing? For example the popular library for statistical computing, pandas, doesn't list requires but still manages to install numpy, pytz, etc.... Is there a better way to automatically collect the full list of dependencies?
  • Is there a pre-existing database somewhere? Am I repeating existing work?
  • Do similar, easily accessible, databases exist for other languages with distribution systems (R, Clojure, etc...?)
  • 推荐答案

    您应该查看 install_requires 字段 ,请参见新的和已更改的设置关键字。

    You should be looking at the install_requires field instead, see New and changed setup keywords.

    需要被认为过于模糊依赖进行依赖项安装。另外,还有 setup_requires 和 test_requires 字段,用于 setup.py所需的依赖项和用于运行测试。

    requires is deemed too vague a field to rely on for dependency installation. In addition, there are setup_requires and test_requires fields for dependencies required for setup.py and for running tests.

    当然,以前已经对依赖图进行了分析;摘自Olivier Girardot的这篇博客文章出现了这张奇妙的图片:

    Certainly, the dependency graph has been analyzed before; from this blog article by Olivier Girardot comes this fantastic image:

    img src = ogirardot.files.wordpress/2013/01/pypi-deps.png?w=480&h=480 alt = PyPI依赖关系> 图片链接到图形的交互式版本。

    The image is linked to the interactive version of the graph.

    更多推荐

    Python包依赖关系树

    本文发布于:2023-07-04 17:06:12,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1026834.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:关系   Python

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!