python依赖文件的解析器
dparse的Python项目详细描述
依赖关系分析器
python依赖文件的解析器
- 自由软件:麻省理工学院许可证
- 文档:https://dparse.readthedocs.io。
支持的文件
File | parse | update |
---|---|---|
requirements.txt | yes | yes |
conda.yml | yes | yes |
tox.ini | yes | yes |
Pipfile | yes | yes |
Pifile.lock | yes | yes |
setup.py | no (# 2) | no (# 2) |
zc.buildout | no (# 3) | no (# 3) |
setup.cfg | no (# 4) | no (# 4) |
安装
要安装dparse,请运行:
$ pip install dparse
如果要更新pipfiles,请安装pipenv extra:
$ pip install dparse[pipenv]
用法
在python项目中使用dparse:
from dparse import parse, filetypes content = """ South==1.0.1 --hash=sha256:abcdefghijklmno pycrypto>=2.6 """ df = parse(content, file_type=filetypes.requirements_txt) print(df.json()) { "file_type": "requirements.txt", "content": "\nSouth==1.0.1 --hash=sha256:abcdefghijklmno\npycrypto>=2.6\n", "path": null, "sha": null, "dependencies": [ { "name": "South", "specs": [ [ "==", "1.0.1" ] ], "line": "South==1.0.1 --hash=sha256:abcdefghijklmno", "source": "pypi", "meta": {}, "line_numbers": null, "index_server": null, "hashes": [ "--hash=sha256:abcdefghijklmno" ], "dependency_type": "requirements.txt", "extras": [] }, { "name": "pycrypto", "specs": [ [ ">=", "2.6" ] ], "line": "pycrypto>=2.6", "source": "pypi", "meta": {}, "line_numbers": null, "index_server": null, "hashes": [], "dependency_type": "requirements.txt", "extras": [] } ] }
历史记录
0.4.1(2018-04-06)
- 修复了打包错误。
0.4.0(2018-04-06)
- pipenv现在是一个可选的依赖项,只在更新pip文件时使用。用dparse[pipenv]安装它
- 添加了对无效toml pipfiles的支持(感谢@pombredane)
0.3.0(2018-03-01)
- 添加了对setup.cfg文件的支持(感谢@kexepal)
- pipfiles中的依赖项现在包括部分(感谢@paulortman)
- 如果标记了多行要求,现在将忽略这些要求
- 增加了对pipfiles的实验支持
0.2.1(2017-07-19)
- 内部重构
0.2.0(2017-07-19)
- 已删除setuptools依赖项
0.1.1(2017-07-14)
- 修正了导致解析器对无效需求抛出错误的错误。
0.1.0(2017-07-11)
- 首字母,这里不多见。