Registry / devops / reuse
library6.2.0pypypi✓ verified 82d ago

reuse is a Python command-line tool designed to help projects achieve and verify compliance with the REUSE recommendations (https://reuse.software). It facilitates adding copyright and licensing information to files, checking existing compliance, and downloading SPDX license texts. The current version is 6.2.0, with releases occurring regularly, typically every few months for minor versions.

pip install reuse
INSTALL
IMPORT
SIG · REUSE
R
reuse
devopspythonv6.2.0
Install
3.7s avg
Import
Disk
24MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 25.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.7s · import 0.000s · 26MB
24MB installed
● package 24MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

main
import reuse
from reuse import main

This quickstart demonstrates how to use the `reuse` tool programmatically by directly calling its `main` function. It simulates command-line execution by manipulating `sys.argv` and creating a temporary project structure to run `lint` and `spdx` commands.

import sys from pathlib import Path from reuse.main import main # Create a dummy project for demonstration project_path = Path("my_reuse_project") project_path.mkdir(exist_ok=True) # Create a Python file with an SPDX license identifier (project_path / "main.py").write_text("# SPDX-License-Identifier: MIT") # Create a dummy LICENSE file (project_path / "LICENSE").write_text("MIT License\nCopyright (c) 2024 User") # Simulate running 'reuse lint my_reuse_project' print("\n--- Running 'reuse lint my_reuse_project' ---") original_argv = sys.argv sys.argv = ['reuse', 'lint', str(project_path)] try: main() except SystemExit as e: # main() calls sys.exit() with 0 for success, non-zero for failure if e.code != 0: print(f"Command 'lint' failed with exit code {e.code}") finally: sys.argv = original_argv # Restore original argv # Simulate running 'reuse spdx --json my_reuse_project' print("\n--- Running 'reuse spdx --json my_reuse_project' ---") sys.argv = ['reuse', 'spdx', '--json', str(project_path)] try: main() except SystemExit as e: if e.code != 0: print(f"Command 'spdx' failed with exit code {e.code}") finally: sys.argv = original_argv # Clean up dummy files and directory (project_path / "main.py").unlink() (project_path / "LICENSE").unlink() project_path.rmdir()
reuse --version
Debug
Known issues
breakingStarting from v6.0.0, `reuse lint` now reads entire files for REUSE information instead of just the first 4 KiB. This change can lead to new 'false positive' findings if ignored sections exist deeper in files.
fix
To resolve new false positives, ensure any ignored sections are explicitly marked with `REUSE-IgnoreStart` and `REUSE-IgnoreEnd` tags in the relevant files.
affects: >=6.0.0
gotchaIn v6.1.0, a bug was identified where `charset-normalizer` (the default encoding detection module) could incorrectly detect UTF-8 files as binary if the 2048th byte was a non-final byte of a multi-byte glyph.
fix
As a workaround, you can force the use of `chardet` for encoding detection by setting the environment variable: `REUSE_ENCODING_MODULE=chardet reuse <command>`.
affects: >=6.1.0
gotchaThe `reuse` library is primarily designed as a command-line interface (CLI) tool. While programmatic access via `reuse.main.main` is possible, the internal APIs are not officially stable or guaranteed to maintain compatibility across versions for direct Python imports beyond `main`.
fix
For scripting and automation, prefer invoking `reuse` as a subprocess (`subprocess.run(['reuse', ...])`) for maximum stability and robustness, rather than relying on direct imports of internal modules.
affects: All versions
Upgrade
Version history
6.2.0latest on PyPI · released Oct 27, 2025
Audit
Dependencies
charset-normalizerrequiredUsed for detecting file encodings.
license-expressionrequiredHandles parsing and managing license expressions.
SPDX-License-ExpressionrequiredProvides SPDX license expression validation.
file-magicoptionalOptional module for additional file encoding detection capabilities.
Agent activity
23 hits · last 30 days
node
22
Resources
reuse — pip install reuse · libregistry