
REUSE Tool
CLI自由软件基金会欧洲分会(FSFE)官方命令行工具:按 REUSE 规范检查项目里每个文件是否写明版权与许可证,可批量给文件添加声明、下载许可证原文并生成 SPDX 清单,便于法务核对开源许可合规。需要本机 Python 环境,检查结论需法务人员复核。
reuse
reuse is a tool for compliance with the REUSE recommendations.
- Documentation: https://reuse.readthedocs.io and https://reuse.software
- Source code: https://codeberg.org/fsfe/reuse-tool
- PyPI: https://pypi.python.org/pypi/reuse
- REUSE: 3.3
- Python: 3.10+
Table of contents
Background
Copyright and licensing is difficult, especially when reusing software from different projects that are released under various different licenses. REUSE was started by the Free Software Foundation Europe (FSFE) to provide a set of recommendations to make licensing your Free Software projects easier. Not only do these recommendations make it easier for you to declare the licenses under which your works are released, but they also make it easier for a computer to understand how your project is licensed.
As a short summary, the recommendations are threefold:
- Choose and provide licenses
- Add copyright and licensing information to each file
- Confirm REUSE compliance
You are recommended to read our tutorial for a step-by-step guide through these three steps. The FAQ covers basic questions about licensing, copyright, and more complex use cases. Advanced users and integrators will find the full specification helpful.
There are other tools that have a lot more features and functionality surrounding the analysis and inspection of copyright and licenses in software projects. The REUSE tool, on the other hand, is solely designed to be a simple tool to assist in compliance with the REUSE recommendations.
Install
Dependencies
Unless you install via a package manager, it may be helpful to be aware of the
following system dependencies of reuse:
- Python 3.10+
- libmagic
- Version control systems
- Git
- Mercurial 4.3+
- Pijul
- Jujutsu
- Fossil
Excepting Python, these dependencies are all optional. reuse will still work
if they are not installed.
If a version control system (VCS) is not installed, then reuse will not
correctly ignore files which are ignored by the VCS, for example via
.gitignore.
If libmagic is not installed, then a slower mechanism will be used to detect the
encodings of files. You may need to explicitly install the fall-back. When
installing reuse as Python package, install reuse[charset-normalizer]
instead. For example: pipx install reuse[charset-normalizer].
Installation via package manager (Recommended)
There are packages available for easy install on many operating systems. You are welcome to help us package this tool for more distributions!
For Debian and derivatives:
apt install reuse
For Fedora and derivatives:
dnf install reuse
An automatically generated list of available packages can be found at repology.org, without any guarantee for completeness.
Install and run via pipx (Recommended)
The following one-liner both installs and runs this tool from PyPI via pipx:
pipx run reuse lint
pipx automatically isolates reuse into its own Python virtualenv, which means that it won't interfere with other Python packages, and other Python packages won't interfere with it.
If you want to be able to use reuse without prepending it with pipx run every
time, install it globally like so:
pipx install reuse
reuse will then be available in ~/.local/bin, which must be added to your
$PATH.
After this, make sure that ~/.local/bin is in your $PATH. On Windows, the
required path for your environment may look like
%USERPROFILE%\AppData\Roaming\Python\Python310\Scripts, depending on the
Python version you have installed.
To upgrade reuse, run this command:
pipx upgrade reuse
Installation via pip
To install reuse into ~/.local/bin, run:
pip3 install --user reuse
Subsequently, make sure that ~/.local/bin is in your $PATH like described in
the previous section.
To upgrade reuse, run this command:
pip3 install --user --upgrade reuse
Installation from source
You can also install this tool from the source code, but we recommend the methods above for easier and more stable updates. Please make sure the requirements for the installation via pip are present on your machine.
pip install .
Usage
First, read the REUSE tutorial. In a nutshell:
- Put your licenses in the
LICENSES/directory. - Add a comment header to each file that says
SPDX-License-Identifier: GPL-3.0-or-later, andSPDX-FileCopyrightText: $YEAR $NAME. You can be flexible with the format, just make sure that the line starts withSPDX-FileCopyrightText:. - Verify your work using this tool.
Example of header:
# SPDX-FileCopyrightText: 2017 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: CC-BY-SA-4.0
CLI
To check against the recommendations, use reuse lint:
~/Projects/reuse-tool $ reuse lint
[...]
Congratulations! Your project is compliant with version 3.3 of the REUSE Specification :-)
This tool can do various more things, detailed in the documentation. Here a short summary:
annotate--- Add copyright and/or licensing information to the header of a file.download--- Download the specified license into theLICENSES/directory.lint--- Verify the project for REUSE compliance.lint-file--- Verify REUSE compliance of individual files.spdx--- Generate an SPDX Document of all files in the project.supported-licenses--- Prints all licenses supported by REUSE.convert-dep5--- Convert .reuse/dep5 to REUSE.toml.
Example demo
In this screencast, we are going to follow the tutorial, making the REUSE example repository compliant.

Run in Docker
The fsfe/reuse Docker image is available on
Docker Hub. With it, you can easily
include REUSE in CI/CD processes. This way, you can check for REUSE compliance
for each build. In our resources for developers
you can learn how to integrate the REUSE tool in Drone, Travis, GitHub, or
GitLab CI.
You can run the helper tool simply by providing the command you want to run
(e.g., lint, spdx). The image's working directory is /data by default. So
if you want to lint a project that is in your current working directory, you can
mount it on the container's /data directory, and tell the tool to lint. That
looks a little like this:
docker run --rm --volume $(pwd):/data fsfe/reuse lint
You can also provide additional arguments, like so:
docker run --rm --volume $(pwd):/data fsfe/reuse --include-submodules spdx -o out.spdx
The available tags are:
latest--- the most recent release of reuse.{major}--- the latest major release.{major}.{minor}--- the latest minor release.{major}.{minor}.{patch}--- a precise release.
You can add -debian to any of the tags to get a Debian-based instead of an
Alpine-based image, which is larger, but may be better suited for license
compliance.
Run as pre-commit hook
You can automatically run reuse lint on every commit as a pre-commit hook for
Git. This uses pre-commit. Once you
have it installed, add this to the
.pre-commit-config.yaml in your repository:
repos:
- repo: https://codeberg.org/fsfe/reuse-tool
rev: v6.2.0
hooks:
- id: reuse
Then run pre-commit install. Now, every time you commit, reuse lint is run
in the background, and will prevent your commit from going through if there was
an error.
If you instead want to only lint files that were changed in your commit, you can use the following configuration:
repos:
- repo: https://codeberg.org/fsfe/reuse-tool
rev: v6.2.0
hooks:
- id: reuse-lint-file
Shell completion
In order to enable shell completion, you need to generate the shell completion
script. You do this with _REUSE_COMPLETE=bash_source reuse. Replace bash
with zsh or fish as needed, or any other shells supported by the Python
click library. You can then source the output in your shell rc file, like so
(e.g.~/.bashrc):
eval "$(_REUSE_COMPLETE=bash_source reuse)"
Alternatively, you can place the generated completion script in
${XDG_DATA_HOME}/bash-completion/completions/reuse.
Maintainers
- Carmen Bianca Bakker carmenbianca@fsfe.org
- Florian Snow floriansnow@fsfe.org
Former maintainers
- Max Mehl max.mehl@fsfe.org
- Linus Sehn linus@fsfe.org
Contributing
If you're interested in contributing to the reuse project, there are several ways to get involved. Development of the project takes place on Codeberg at https://codeberg.org/fsfe/reuse-tool. There, you can submit bug reports, feature requests, and pull requests. Even and especially when in doubt, feel free to open an issue with a question. Contributions of all types are welcome, and the development team is happy to provide guidance and support for new contributors.
You should exercise some caution when opening a pull request to make changes which were not (yet) acknowledged by the team as pertinent. Such pull requests may be closed, leading to disappointment. To avoid this, please open an issue first.
Additionally, the reuse@lists.fsfe.org mailing list is available for discussion and support related to the project.
You can find the full contribution guidelines at https://reuse.readthedocs.io/en/latest/contribute.html.
Licensing
This repository is itself REUSE-compliant. The licensing of each file can be
divined with reuse spdx or reuse lint --json, but here is a best-effort
summary:
- All original source code is licensed under GPL-3.0-or-later.
- All documentation is licensed under CC-BY-SA-4.0.
- Some configuration and data files are licensed under CC0-1.0.
- Some code borrowed from spdx/tools-python is licensed under Apache-2.0.
相關資源

ScanCode Toolkit
CLI扫描代码库与依赖中的开源许可证、版权声明和包清单,用全文比对识别许可证,结果可导出为 JSON、SPDX、CycloneDX 等格式,适合开源合规审查。
aboutcode-org/scancode-toolkit2.6k
OSS Review Toolkit (ORT)
CLILinux 基金会旗下的开源合规工具链:分析软件项目的依赖,扫描许可证与版权信息并查询已知漏洞,按自定义策略标出违规项,生成 SBOM 与开源声明文件,便于法务和研发一起审查许可风险。需要 Java 25 或 Docker,建议 8GB 内存;许可证判定结果需法务人员复核。
oss-review-toolkit/ort2.1k
Presidio CLI
CLI用 Presidio Analyzer 扫描文件与目录中的个人敏感信息(姓名、邮箱、信用卡号等),可配置实体类型、置信度阈值与忽略规则。需要 Python 3.10+ 与 spaCy 语言模型。
data-privacy-stack/presidio11.4k
GDPR Data Handling
Skill面向欧盟 GDPR 的数据合规技能:梳理合法处理依据、同意管理、数据主体访问与删除请求、数据保留和泄露通报,附合规检查清单与示例代码,便于法务和研发共同评审隐私合规。装进 Claude Code 或 Codex 即可用,无需账号或 API Key;内容为英文,结论需律师复核。
wshobson/agents41k
Compliance Tracking
SkillAnthropic 官方运营插件里的合规技能:梳理 SOC 2、ISO 27001、GDPR、HIPAA、PCI DSS 等框架的控制项、负责人与证据,安排审计日程并做差距分析,输出审计准备清单与证据收集计划。结论需法务或合规专业人员复核。
anthropics/knowledge-work-plugins30.3k
AI Governance Legal
PluginAnthropic 官方 AI 治理插件:按内部登记册给 AI 用例分级,跨欧盟 AI 法案等适用法规做影响评估,审查供应商 AI 条款里的数据训练与责任风险,并定期检查 AI 政策与实践的偏差。
anthropics/claude-for-legal9.7k