报告python项目使用的依赖项的许可信息
dep-license的Python项目详细描述
DEP U许可证
dep lic:一个简单的实用程序,用于报告python项目使用的依赖项的许可证信息。它支持从项目目录或其github repo解析来自requirements.txt
和Pipfile
文件的内容。
安装
$ pip install dep_license
命令行选项
$ deplic --help
usage: deplic [-h] [-p PROCESSES] [-f FORMAT] [-o OUTPUT] [-d] [-n NAME]
PROJECT
positional arguments:
PROJECT path or URL to the project repo
optional arguments:
-h, --help show this help message and exit
-p PROCESSES, --processes PROCESSES
number of processes to run in parallel (default: MAX)
-f FORMAT, --format FORMAT
define how result is formatted (default: github)
-o OUTPUT, --output OUTPUT
path for output file (default: None)
-d, --dev include dev packages from Pipfile (default: False)
-n NAME, --name NAME name for pip-requirements file (default: None)
使用量
报告本地项目中使用的依赖项许可证列表:
$ deplic /path/to/python/project
Total number of dependencies: 3
Running with 3 processes...
licenses:
| Name | Meta | Classifier |
|------------|--------|--------------------------------------------------|
| pandas | BSD | |
| matplotlib | PSF | OSI Approved::Python Software Foundation License |
| numpy | BSD | OSI Approved |
指定要分析的文件:
$ deplic /path/to/python/project/requirements.txt
Total number of dependencies: 1
Running with 1 processes...
licenses:
| Name | Meta | Classifier |
|--------|--------|--------------|
| numpy | BSD | OSI Approved |
对pipfile的支持:
$ deplic /path/to/python/project/Pipfile
Total number of dependencies: 3
Running with 3 processes...
licenses:
| Name | Meta | Classifier |
|------------|--------|--------------------------------------------------|
| numpy | BSD | OSI Approved |
| pandas | BSD | |
| matplotlib | PSF | OSI Approved::Python Software Foundation License |
将输出格式化并存储为json文件:
deplic /path/to/python/project -f json -o dep-licenses.json
Total number of dependencies: 3
Running with 3 processes...
licenses:
[
{
"Name": "matplotlib",
"Meta": "PSF",
"Classifier": "OSI Approved::Python Software Foundation License"
},
{
"Name": "pandas",
"Meta": "BSD",
"Classifier": ""
},
{
"Name": "numpy",
"Meta": "BSD",
"Classifier": "OSI Approved"
}
]
从项目的github repo获取list dev包:
$ deplic https://github.com/kennethreitz/requests -p 16 -d -f md
Total number of dependencies: 16
Running with 16 processes...
licenses:
Name Meta Classifier
--------------- ------------------------------------------------------------ -------------------------------------
pytest MIT license OSI Approved::MIT License
codecov http://www.apache.org/licenses/LICENSE-2.0 OSI Approved::Apache Software License
pytest-mock MIT OSI Approved::MIT License
sphinx BSD OSI Approved::BSD License
tox MIT OSI Approved::MIT License
pytest-httpbin MIT OSI Approved::MIT License
docutils public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt) Public Domain
pytest-cov MIT OSI Approved::BSD License
pytest-xdist MIT OSI Approved::MIT License
pysocks BSD
httpbin MIT OSI Approved::MIT License
alabaster OSI Approved::BSD License
readme-renderer Apache License, Version 2.0 OSI Approved::Apache Software License
detox MIT OSI Approved::MIT License
指定要分析的需求文件:
$ deplic https://github.com/pandas-dev/pandas -n requirements-dev.txt -f csv -p 16 -o pandas_dev.csv
输出格式:
支持的表格格式有(感谢python tablate包):
- “普通”
- “简单”
- “github”
- “网格”
- “花式网格”
- “管道”
- “orgtbl”
- “吉拉”
- “普雷斯托”
- “psql”
- “RST”
- “mediawiki”
- “MoinMoin”
- “YouTrack”
- “HTML”
- “乳胶漆”
- “乳胶生”
- “乳胶书架”
- “纺织品”