智能许可证扫描程序。
atarashi的Python项目详细描述
阿塔拉希
开源软件是使用开源许可证授权的。有很多 开放源代码许可证的数量 包有时涉及不同文件的多个许可证。
atarashi提供了不同的方法来扫描 开源软件。与现有的基于规则的方法不同,例如 来自Fossology项目的Nomos许可扫描器-Atarashi实现了多个 文本统计和信息检索算法。
预期的优势是提高了精度,同时提供了 尽可能添加新许可文本或新许可引用的方法。
阿塔拉希是设计独立工作和化石。更多信息 http://fossology.github.io/atarashi
要求
- python>;=3.5版
- pip>;=18.1
code_comments
(参见下面的安装)
安装步骤
安装
从pypi安装
- 安装其他依赖代码注释
pip install code_comment@git+https://github.com/amanjain97/code_comment@master#egg=code_comment
pip install atarashi
源代码安装
- 安装其他依赖项代码注释
pip install code_comment@git+https://github.com/amanjain97/code_comment@master#egg=code_comment
pip install .
- 它将下载所需的所有依赖项并触发构建。
- 生成将在当前目录中生成3个新文件
data/Ngram_keywords.json
licenses/<SPDX-version>.csv
licenses/processedList.csv
- 这些文件将由安装脚本放置到适当的位置。
仅安装依赖项
pip install -r requirements.txt
构建(可选)
$ python3 setup.py build
如何运行
pip install code_comment@git+https://github.com/amanjain97/code_comment@master#egg=code_comment
pip install atarashi
pip install code_comment@git+https://github.com/amanjain97/code_comment@master#egg=code_comment
pip install .
data/Ngram_keywords.json
licenses/<SPDX-version>.csv
licenses/processedList.csv
pip install -r requirements.txt
$ python3 setup.py build
通过运行atarashi -h
或atarashi --help
示例
运行dld代理
atarashi -a DLD /path/to/file.c
运行wordfrequencysimilarity代理
atarashi -a wordFrequencySimilarity /path/to/file.c
运行tfidf代理
具有余弦相似性
atarashi -a tfidf /path/to/file.c
atarashi -a tfidf -s CosineSim /path/to/file.c
与得分相似性
atarashi -a tfidf -s ScoreSim /path/to/file.c
运行ngram代理
具有余弦相似性
atarashi -a Ngram /path/to/file.c
atarashi -a Ngram -s CosineSim /path/to/file.c
具有dice相似性
atarashi -a Ngram -s DiceSim /path/to/file.c
具有bigram余弦相似性
atarashi -a Ngram -s BigramCosineSim /path/to/file.c
在verbose模式下运行
atarashi -a DLD -v /path/to/file.c
使用自定义csv和json运行
- 请参考构建说明以获取csv和json 阿塔拉希可以理解。
atarashi -a DLD -l /path/to/processedList.csv /path/to/file.c
atarashi -a Ngram -l /path/to/processedList.csv -j /path/to/ngram.json /path/to/file.c
运行docker image
拉动Docker图像
docker pull fossology/atarashi:latest
运行图像
docker run --rm -v <path/to/scan>:/project fossology/atarashi:latest <options> /project/<path/to/file>
由于Docker无法直接访问主机fs,我们从
包含要扫描到容器中/project
的文件的目录。简单地
将选项和路径传递到相对于装入路径的文件。
测试
- 使用代理的名称运行imtihaan(在印地语中是指exam)。
- 例如
python atarashi/imtihaan.py /path/to/processedList.csv <DLD|tfidf|Ngram> <testfile>
- 有关详细信息,请参见
python atarashi/imtihaan.py --help
创建Debian包
- 安装依赖项
# apt-get install python3-setuptools python3-all debhelper
# pip install stdeb
- 创建debian包
$ python3 setup.py --command-packages=stdeb.command bdist_deb
- 找到
deb_dist
下的文件
许可证
SPDX许可证标识符:GPL-2.0
此程序是免费软件;您可以重新分发和/或修改 根据GNU通用公共许可第2版的条款 由自由软件基金会出版。
这个程序的发布是希望它能有用, 但没有任何保证;甚至没有 适销性特殊目的。 有关更多详细信息,请参阅GNU通用公共许可证。
你应该收到GNU通用公共许可证的副本 如果没有,请写信给自由软件基金会, 美国马萨诸塞州波士顿市富兰克林街51号,5楼,邮编:02110-1301。
如何使用sphinx生成文档
转到项目目录“atarashi”。
安装sphinx和m2r
pip install sphinx m2r
(由于此项目基于python,因此pip
已安装)。用
初始化sphinx-quickstart
docs/
目录mkdir docs cd docs/ sphinx-quickstart
Root path for the documentation [.]: .
Separate source and build directories (y/n) [n]: n
autodoc: automatically insert docstrings from modules (y/n) [n]: y
intersphinx: link between Sphinx documentation of different projects (y/n) [n]: y
- 否则使用默认选项
设置
conf.py
并包括README.md
启用以下行并更改插入路径:
importosimportsyssys.path.insert(0,os.path.abspath('../'))
启用
m2r
在sphinx文档中插入.md
文件:[...]extensions=[...'m2r',][...]source_suffix=['.rst','.md']
通过编辑
包括index.rst
README.md
..toctree:: [...] readme ..mdinclude:: ../README.md
在
docs/source
中自动生成.rst
文件,用于生成文档cd docs/ sphinx-apidoc -o source/ ../atarashi
cd docs
make html
这将在docs/_build/html
中生成文件。转到:index.html
您可以通过更改docs/
文件夹中config.py文件中的html_theme
来更改文档的主题。
你可以从{'alabater'、'classic'、'sphinxdoc'、'scrolls'、'agogo'、'traditional'、'nature'、'haiku'、'pyramid'、'bizstyle'}中选择。
Reference