The tool for checking and helping with compliance with the REUSE Initiative recommendations
Go to file
2021-08-04 18:01:15 +02:00
.github/workflows Improve extra Docker image, add a Debian-based (#321) 2021-06-11 11:48:32 +02:00
.reuse Add contact address to all FSFE copyright statements 2020-04-21 16:02:04 +01:00
docs Bump version: 0.12.1 → 0.13.0 2021-06-11 12:23:30 +02:00
LICENSES Do a massive refactoring 2019-04-16 22:44:18 +02:00
po Add contact address to all FSFE copyright statements 2020-04-21 16:02:04 +01:00
src/reuse Allow creating .license file for write-protected files (#347) 2021-08-04 18:01:15 +02:00
tests Allow creating .license file for write-protected files (#347) 2021-08-04 18:01:15 +02:00
.bumpversion.cfg Bump version: 0.12.1 → 0.13.0 2021-06-11 12:23:30 +02:00
.editorconfig Adjust indent sizes for .md, ,yaml, .json 2021-02-02 17:31:21 +01:00
.gitignore Add contact address to all FSFE copyright statements 2020-04-21 16:02:04 +01:00
.pre-commit-config.yaml Reformat some yaml and markdown files 2021-02-02 17:32:04 +01:00
.pre-commit-hooks.yaml Reformat some yaml and markdown files 2021-02-02 17:32:04 +01:00
.pylintrc Satisfy linters 2021-01-27 18:21:22 +01:00
AUTHORS.rst Validate file is readable in addheader subcommand 2021-01-28 13:38:16 +01:00
CHANGELOG.md Allow creating .license file for write-protected files (#347) 2021-08-04 18:01:15 +02:00
CODE_OF_CONDUCT.md Add contact address to all FSFE copyright statements 2020-04-21 16:02:04 +01:00
Dockerfile Bump alpine to 3.13 (#369) 2021-06-11 11:55:02 +02:00
Dockerfile-debian Improve extra Docker image, add a Debian-based (#321) 2021-06-11 11:48:32 +02:00
Dockerfile-extra Bump alpine to 3.13 (#369) 2021-06-11 11:55:02 +02:00
Makefile Add isort check to blackcheck (#319) 2021-04-30 15:24:40 +02:00
MANIFEST.in Add contact address to all FSFE copyright statements 2020-04-21 16:02:04 +01:00
pyproject.toml Add contact address to all FSFE copyright statements 2020-04-21 16:02:04 +01:00
README.md docs: update package reference for Arch Linux (#393) 2021-07-06 11:05:53 +02:00
requirements-dev.txt Bump versions of requirements 2021-01-27 18:21:13 +01:00
requirements.txt Bump jinja2 from 2.11.2 to 2.11.3 (#333) 2021-03-29 17:55:42 +02:00
setup.py Explicitly require setuptools (#342) 2021-06-15 18:06:53 +02:00
tox.ini Add Python 3.9 to tests 2020-12-16 20:06:27 +01:00

reuse

REUSE status

reuse is a tool for compliance with the REUSE recommendations.

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:

  1. Choose and provide licenses
  2. Add copyright and licensing information to each file
  3. 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.

This tool exists to facilitate the developer in complying with the above recommendations.

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 helper tool, on the other hand, is solely designed to be a simple tool to assist in compliance with the REUSE recommendations.

Example demo

In this screencast, we are going to follow the tutorial, making the REUSE example repository compliant.

Demo of some basic REUSE tool commands

Install

Installation via pip

To install reuse, you need to have the following pieces of software on your computer:

  • Python 3.6+
  • pip

You then only need to run the following command:

pip3 install --user reuse

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\Python39\Scripts, depending on the Python version you have installed.

To update reuse, run this command:

pip3 install --user --upgrade reuse

For full functionality, the following pieces of software are recommended:

  • Git
  • Mercurial 4.3+

Installation via package managers

There are packages available for easy install on some operating systems. You are welcome to help us package this tool for more distributions!

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.

python3 setup.py install

Usage

First, read the REUSE tutorial. In a nutshell:

  1. Put your licenses in the LICENSES/ directory.
  2. Add a comment header to each file that says SPDX-License-Identifier: GPL-3.0-or-later, and SPDX-FileCopyrightText: $YEAR $NAME. You can be flexible with the format, just make sure that the line starts with SPDX-FileCopyrightText:.
  3. 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

To check against the recommendations, use reuse lint:

~/Projects/reuse-tool $ reuse lint
[...]

Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)

This tool can do various more things, detailed in the documentation. Here a short summary:

  • addheader --- Add copyright and/or licensing information to the header of a file.

  • download --- Download the specified license into the LICENSES/ directory.

  • init --- Set up the project for REUSE compliance.

  • lint --- Verify the project for REUSE compliance.

  • spdx --- Generate an SPDX Document of all files in the project.

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

There are a number of tags available:

  • latest is the most recent stable release.
  • dev follows the master branch of this repository. Up-to-date, but potentially unstable.
  • latest-extra has a few extra packages installed, currently openssh-client.
  • latest-debian is based on python:slim. It 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://github.com/fsfe/reuse-tool
    rev: latest
    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.

Maintainers

Contribute

Any pull requests or suggestions are welcome at https://github.com/fsfe/reuse-tool or via e-mail to one of the maintainers. General inquiries can be sent to reuse@lists.fsfe.org.

Interaction within this project is covered by the FSFE's Code of Conduct.

Starting local development is very simple, just execute the following commands:

git clone git@github.com:fsfe/reuse-tool.git
cd reuse-tool/
python3 -mvenv venv
source venv/bin/activate
make develop

You need to run make develop at least once to set up the virtualenv.

Next, run make help to see the available interactions.

License

This work is licensed under multiple licences. Because keeping this section up-to-date is challenging, here is a brief summary as of April 2020:

  • 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/tool-python is licensed under Apache-2.0.

For more accurate information, check the individual files.