{"id":7673,"library":"reuse","title":"REUSE Compliance Tool","description":"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.","status":"active","version":"6.2.0","language":"python","source_language":"en","source_url":"https://github.com/fsfe/reuse-tool","tags":["cli","licensing","compliance","spdx","open-source"],"install":[{"cmd":"pip install reuse","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for detecting file encodings.","package":"charset-normalizer"},{"reason":"Handles parsing and managing license expressions.","package":"license-expression"},{"reason":"Provides SPDX license expression validation.","package":"SPDX-License-Expression"},{"reason":"Optional module for additional file encoding detection capabilities.","package":"file-magic","optional":true}],"imports":[{"wrong":"from reuse import main","symbol":"main","correct":"import reuse"}],"quickstart":{"code":"import sys\nfrom pathlib import Path\nfrom reuse.main import main\n\n# Create a dummy project for demonstration\nproject_path = Path(\"my_reuse_project\")\nproject_path.mkdir(exist_ok=True)\n\n# Create a Python file with an SPDX license identifier\n(project_path / \"main.py\").write_text(\"# SPDX-License-Identifier: MIT\")\n\n# Create a dummy LICENSE file\n(project_path / \"LICENSE\").write_text(\"MIT License\\nCopyright (c) 2024 User\")\n\n# Simulate running 'reuse lint my_reuse_project'\nprint(\"\\n--- Running 'reuse lint my_reuse_project' ---\")\noriginal_argv = sys.argv\nsys.argv = ['reuse', 'lint', str(project_path)]\ntry:\n    main()\nexcept SystemExit as e:\n    # main() calls sys.exit() with 0 for success, non-zero for failure\n    if e.code != 0:\n        print(f\"Command 'lint' failed with exit code {e.code}\")\nfinally:\n    sys.argv = original_argv # Restore original argv\n\n# Simulate running 'reuse spdx --json my_reuse_project'\nprint(\"\\n--- Running 'reuse spdx --json my_reuse_project' ---\")\nsys.argv = ['reuse', 'spdx', '--json', str(project_path)]\ntry:\n    main()\nexcept SystemExit as e:\n    if e.code != 0:\n        print(f\"Command 'spdx' failed with exit code {e.code}\")\nfinally:\n    sys.argv = original_argv\n\n# Clean up dummy files and directory\n(project_path / \"main.py\").unlink()\n(project_path / \"LICENSE\").unlink()\nproject_path.rmdir()","lang":"python","description":"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."},"warnings":[{"fix":"To resolve new false positives, ensure any ignored sections are explicitly marked with `REUSE-IgnoreStart` and `REUSE-IgnoreEnd` tags in the relevant files.","message":"Starting 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.","severity":"breaking","affected_versions":">=6.0.0"},{"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>`.","message":"In 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.","severity":"gotcha","affected_versions":">=6.1.0"},{"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.","message":"The `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`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'6.2.0':46 'achiev':16 'ad':27 'check':34 'cli':58 'command':9 'command-lin':8 'complianc':2,19,36,60 'copyright':28 'current':43 'design':12 'download':38 'everi':52 'exist':35 'facilit':26 'file':33 'help':14 'inform':31 'licens':30,40,59 'line':10 'minor':56 'month':54 'occur':49 'open':63 'open-sourc':62 'project':15 'python':7 'recommend':23 'regular':50 'releas':48 'reus':1,4,22 'reuse.software':24 'sourc':64 'spdx':39,61 'text':41 'tool':3,11 'typic':51 'verifi':18 'version':44,57","created_at":"2026-04-16T14:08:28.766878+00:00","updated_at":"2026-04-16T14:08:28.766878+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"6.2.0","cli_name":"reuse","cli_version":"reuse, version 6.2.0","type":"library","homepage":"https://reuse.software/","github":"https://github.com/fsfe/reuse-tool","docs":"https://reuse.readthedocs.org/","changelog":null,"pypi":"https://pypi.org/project/reuse/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}