I.M Blogging

Using Reuse

reuse is a software tool that can annotate your git repos with copyright information, download licences, and automatically check for compliance with the reuse standard. All from the command line. Leaving you with more time to work on what actually matters instead of the tedium of copyright law.

Installation

reuse is widely packaged1 so its likely already present in your distros repo. Making installation through your preferred package manager simple.

Usage

The first and most important command is reuse annotate, which creates the copyright notice, and references to the licences. It needs three arguments, the first being the notice information (-c "YOUR_NAME <YOUR_EMAIL@example.com>"), as well as the licence to use (-l "SPDX_LICENSE_IDENTIFIER"), along with files to be annotated. Putting it all together will give you this.

reuse annotate -c "YOUR_NAME <YOUR_EMAIL@example.com>" -l "SPDX_LICENSE_IDENTIFIER" YOUR_FILE

This will add a header compliant with the reuse standard to the file in question. it will look something like below, though it can change depending on the specific notice style2 and file type.

# SPDX-FileCopyrightText: YOUR_NAME <YOUR_EMAIL@example.com> 
#
# SPDX-License-Identifier: SPDX_LICENSE_IDENTIFIER

Now this command is quite unwieldy, which is why I would recommend you to create aliases or abbreviations in your shell to infill the data.

While this will cover most of your uses, sometimes you'll need to annotate a binary file or one that you shouldn't edit. In these situations you should pass --force-dot-license which will create a seprate file with the notice. Other times reuse wont recognize a file type, in which case you can use a dot licence like before or as a fallback (--fallback-dot-license). Forcing a style with --style=STYLE3 is useful when you know the correct encoding for a particular file.

After you have notices for all the files, reuse download --all will place the needed licenses into a LICENSES folder at the root of the repo.

reuse lint is a simple command that will check the repo for files that have no notices, and other missing information. Giving a few recommendations on how to fix the issues and insure compliance.

Footnotes


2

This is the table of supported styles

nameexample
spdxSPDX-FileCopyrightText: 2025 YOUR_NAME <YOUR_EMAIL@example.com>
spdx-cSPDX-FileCopyrightText: (C) 2025 YOUR_NAME <YOUR_EMAIL@example.com>
spdx-symbolSPDX-FileCopyrightText: © 2025 YOUR_NAME <YOUR_EMAIL@example.com>
stringCopyright 2025 YOUR_NAME <YOUR_EMAIL@example.com>
string-cCopyright (C) 2025 YOUR_NAME <YOUR_EMAIL@example.com>
string-symbolCopyright © 2025 YOUR_NAME <YOUR_EMAIL@example.com>
symbol© 2025 YOUR_NAME <YOUR_EMAIL@example.com>
3

Here is the complete list of styles.

  • applescript
  • aspx
  • bat
  • bibtex
  • c
  • cpp
  • cppsingle
  • f
  • ftl
  • handlebars
  • haskell
  • html
  • jinja
  • julia
  • lisp
  • m4
  • ml
  • f90
  • plantuml
  • python
  • rst
  • semicolon
  • tex
  • man
  • vst
  • vim
  • xquery

Tags: