CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-reuse

A tool for compliance with the REUSE recommendations for software licensing and copyright management.

Pending
Overview
Eval results
Files

cli.mddocs/

Command Line Interface

REUSE provides a comprehensive command-line interface with 7 subcommands for managing REUSE compliance, licensing, and copyright information in software projects.

Capabilities

Main CLI Entry Point

The main reuse command provides global configuration options that apply to all subcommands.

reuse [OPTIONS] COMMAND [ARGS]...

# Global Options:
--debug                      Enable debug statements
--suppress-deprecation       Hide deprecation warnings  
--include-submodules         Do not skip Git submodules
--include-meson-subprojects  Do not skip Meson subprojects
--no-multiprocessing         Do not use multiprocessing
--root PATH                  Define project root directory
--version                    Show version information
--help                       Show help message

Lint Command

Lint the project directory for REUSE compliance, checking all files for proper copyright and licensing information.

reuse lint [OPTIONS]

# Options:
--quiet, -q                 Prevent output
--json, -j                  Format output as JSON
--plain, -p                 Format output as plain text (default)
--lines, -l                 Format output as errors per line

Usage Example:

# Basic linting
reuse lint

# JSON output for processing
reuse lint --json > compliance-report.json

# Quiet mode (only show errors)
reuse lint --quiet

The lint command examines all files in the project and reports:

  • Files missing copyright information
  • Files missing license information
  • Files with incorrect or malformed headers
  • Overall compliance status

Annotate Command

Add copyright and licensing information to file headers.

reuse annotate [OPTIONS] FILE [FILE...]

# Options:
--copyright TEXT            Copyright notice (can be used multiple times)
--license SPDX_IDENTIFIER   SPDX license identifier (can be used multiple times)
--contributor TEXT          Contributor information (can be used multiple times)
--year INTEGER              Copyright year
--style [python|c|html|...]  Comment style to use
--template FILE             Template file for header
--force                     Force annotation even if file has existing info
--recursive                 Recursively annotate directories
--exclude-patterns TEXT     Exclude files matching these patterns

Usage Examples:

# Add copyright and license to a single file
reuse annotate --copyright="2023 Jane Doe" --license="MIT" src/example.py

# Add multiple copyrights and licenses
reuse annotate \
  --copyright="2023 Jane Doe" \
  --copyright="2023 Company Inc" \
  --license="MIT" \
  --license="GPL-3.0-or-later" \
  src/example.py

# Annotate all Python files recursively
reuse annotate --recursive --copyright="2023 Jane Doe" --license="MIT" src/

# Use specific year
reuse annotate --copyright="Jane Doe" --license="MIT" --year=2020 old-file.py

# Force annotation (overwrite existing)
reuse annotate --force --copyright="2023 Jane Doe" --license="MIT" src/example.py

SPDX Command

Generate an SPDX bill of materials for the project.

reuse spdx [OPTIONS]

# Options:
--output FILE, -o FILE      Output file (default: stdout)
--add-license-concluded     Add license concluded field (requires creator info)
--creator-person TEXT       Name of person signing off on SPDX report
--creator-organization TEXT Name of organization signing off on SPDX report

Usage Examples:

# Generate SPDX document
reuse spdx > project.spdx

# Save to file
reuse spdx --output=project.spdx

# Generate with license conclusions
reuse spdx --add-license-concluded \
  --creator-person="Jane Doe" \
  --output=detailed.spdx

# With organization creator
reuse spdx --add-license-concluded \
  --creator-organization="Example Corp" \
  --output=project.spdx

Download Command

Download a license from the SPDX License List and place it in the LICENSES/ directory.

reuse download [OPTIONS] SPDX_IDENTIFIER [SPDX_IDENTIFIER...]

# Options:
--output DIRECTORY  Directory to store license files (default: LICENSES/)

Usage Examples:

# Download single license
reuse download MIT

# Download multiple licenses
reuse download MIT GPL-3.0-or-later Apache-2.0

# Download to specific directory
reuse download --output=licenses/ MIT

The download command:

  • Fetches the official license text from the SPDX License List
  • Creates the LICENSES/ directory if it doesn't exist
  • Saves the license with the SPDX identifier as filename (e.g., MIT.txt)
  • Validates the SPDX identifier before downloading

Supported Licenses Command

List all licenses available on the SPDX License List.

reuse supported-licenses [OPTIONS]

# Options:
--format [plain|json]  Output format (default: plain)

Usage Examples:

# List all supported licenses
reuse supported-licenses

# JSON output for processing
reuse supported-licenses --format=json > supported-licenses.json

Convert DEP5 Command

Convert a .reuse/dep5 file to a REUSE.toml file format.

reuse convert-dep5 [OPTIONS]

# Options:
--no-backup        Do not create backup of original file
--output FILE      Output file (default: REUSE.toml)

Usage Examples:

# Convert .reuse/dep5 to REUSE.toml
reuse convert-dep5

# Convert without creating backup
reuse convert-dep5 --no-backup

# Convert to specific output file
reuse convert-dep5 --output=new-reuse.toml

Lint File Command

Lint individual files for REUSE compliance instead of the entire project.

reuse lint-file [OPTIONS] FILE [FILE...]

# Options:
--json, -j                  Format output as JSON
--plain, -p                 Format output as plain text (default)
--lines, -l                 Format output as errors per line

Usage Examples:

# Lint specific files
reuse lint-file src/example.py src/other.py

# JSON output for individual files
reuse lint-file --json src/example.py

Exit Codes

All REUSE commands use standard exit codes:

  • 0: Success (or compliant project for lint commands)
  • 1: General error or non-compliant project
  • 2: Invalid command usage or missing arguments

Global Configuration

The global options can be used with any subcommand:

# Debug mode with custom root
reuse --debug --root=/path/to/project lint

# Include submodules and disable multiprocessing
reuse --include-submodules --no-multiprocessing annotate --license=MIT file.py

# Suppress deprecation warnings
reuse --suppress-deprecation spdx --format=json

Environment Variables

  • REUSE_SUPPRESS_DEPRECATION: Set to suppress deprecation warnings
  • _SUPPRESS_DEP5_WARNING: Internal variable to suppress DEP5 warnings during conversion

Install with Tessl CLI

npx tessl i tessl/pypi-reuse

docs

cli.md

comment-handling.md

global-licensing.md

index.md

project-management.md

report-generation.md

reuse-info.md

vcs-integration.md

tile.json