Skip to main content

licensr

A command-line interface for easily licensing your project and make it compliant to the REUSE-Initiative's guidelines


reuse compliant PyPI PyPI

Making your project compliant to the guidelines of the REUSE Initiative i.e. adding license and copyright information to every file in your project is an annoying process and can be quite tedious.

Licensr allows you to quickly add your chosen to your project from the command line. You just have to download the full license texts of your chosen licenses (and the one of your project's dependencies) and configure the config file to make the tool match your needs.

Don't see what you need? Open an issue to suggest any changes or improvements!

Prerequisites

  • Python 3.4+

Installation

$ pip install licensr

Alternatively, grab the zip!

Usage

From the command line:

$ licensr -c "config file" -p "project name"

The arguments are optional and will default to "config.json" and the current working directory.

Configuration

#license_text The path to the file with the full license text. This file itself will be excluded from the licensing process. You are responsible for removing afterwards from your project. Don't place your license_text files into the LICENSES folder, because it will be rewritten during the licensing.

#SPDX The short identifier of the license.

Source Code Header

#src_extensions_and_comment You are required to add a comment-header to every source code file in your project. Therefore you have to specify under src_extensions_and_comment the src_extensions and the corresponding comment characters for every programming language used. For the comments you can put either one (single-line comment), two (opening and closing) or three (opening - middle - closing) strings into a list.

#header The header has to include a copyright notice and the SPDX Identifier of the license. In the config file it can be given as a path to a file or as string of the full header (be sure to include "\n")

For the src files this information is sufficient. However we often don't have the ability to add the necessary information to every file for several reasons (e.g. binary files). The REUSE Initiative's practices specify two other possibilities to add the licensing and copyright information also for those files.

  • Debian File a file in the DEP-5/copyright file format
  • .license File a file with the same name but the .license extension, containing the header.

Debian File

For this method in addition to the SPDX we need: #copyright Year and Name of the copyright holder(s)

.license File

For this method we only need the header.

#exceptions If we have different licenses or copyright holders, we have to consider them in the exceptions. Here we have to specify the "path" variable for the desired directory or file. For the rest, based on which of the three preceding methods you want to use, you have to specify exactly the same options like before (except for the license_text, if the license is the same)

If more that one licensing-method is possible the order in which the methods are used is:

  1. Source Code Header
  2. Debian File
  3. .license File

ATTENTION: The tool overwrites all old headers with the new ones. Be sure to save them if you need them.

Contributing

I accept pull requests;

Metadata

Release files for licensr 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for licensr 0.1.1
File Size Uploaded Provenance Actions
licensr-0.1.1.tar.gz 5.5 kB Without provenance Details for licensr-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for licensr 0.1.1
File Interpreter ABI Platform Actions
licensr-0.1.1-py3-none-any.whl Python 3 none any Details for licensr-0.1.1-py3-none-any.whl

Total release size: 11.5 kB

Release files / licensr-0.1.1.tar.gz

Download URL licensr-0.1.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c67dd06064e823357a3f68e6a432dcc4651045c23060fb2363d6e6ce85360793
BLAKE2b-256 checksum
How to use checksums
7faa537658d3f74feed1ecbdf797990a0186d49da50a340b556f62d12ed55267
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Release files / licensr-0.1.1-py3-none-any.whl

Download URL licensr-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
647755ad9943e5a439a6f206323f6f06e46f221557a04aba46e71742467076d0
BLAKE2b-256 checksum
How to use checksums
155fd2051a6b5357417601d24da8ccd7b118b167d10925b542f51e30f13bf4cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Security for licensr 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page