Copyright License Manager
Project description
Copyright License Manager
A cli tool for easy management of copyright and licenses in source code headers.
Installation
pip install clmgr
Features
Current supported languages
- C#
- Java
- Python
- TypeScript
Usage
Basic usage:
clmgr -c path/to/config.yml -d path/to/source/directory
Options:
-c, --config FILE Path to the configuration file (default: copyright.yml)
-d, --dir DIR Input directory to process (default: current working directory)
-i, --file FILE Process a single input file
--region REGION Copyright search region (default: 10)
--debug Enable verbose logging
--version Show version information
Arguments
| Argument | Default | Description |
|---|---|---|
-c, --config FILE |
copyright.yml |
Path to the configuration file |
-i, --file FILE |
None | Path to a single input file to process |
-d, --dir DIR |
Current working directory | Input directory to process |
--debug |
false | Enable verbose logging |
--version |
N/A | Show version information and exit |
Configuration
Configuration File
The Copyright License Manager (clmgr) uses a YAML configuration file to specify how copyright notices should be managed. By default, it looks for a file named copyright.yml in the current directory, but you can specify a different file using the -c or --config option.
Here's a detailed explanation of the configuration options:
Basic Structure
source:
- py
- java
- cs
- ts
include:
- "src/**/*"
exclude:
- "**/*.min.js"
legal:
- inception: 2014
name: Enovation Group B.V.
locality: Capelle aan den IJssel
country: NL
format: "Copyright (c) {inception} - {year} [{name} - {locality} - {country}]"
license:
enabled: true
external: false
content: All rights reserved.
Configuration Options
source
A list of file extensions to process. Supported values include 'py', 'java', 'cs', 'ts'.
include
A list of glob patterns to include files for processing.
exclude
A list of glob patterns to exclude files from processing.
legal
A list of legal entities associated with the copyright. Each entity can have the following properties:
- inception: The year when the copyright started
- name: The name of the copyright holder
- locality: The city or locality of the copyright holder
- country: The country code of the copyright holder
format
The format string for each row in the copyright notice. This property is optional and by default,
it is set to SPDX-FileCopyrightText: Copyright (c) {inception} - {year} [{name} - {locality} - {country}].
The following placeholders can be used:
- inception: The year when the copyright started
- year: The current year
- name: The name of the copyright holder
- locality: The city or locality of the copyright holder
- country: The country code of the copyright holder
license
Settings for the license notice:
- enabled: Whether to include a license notice (true/false)
- external: Whether to use an external license file (true/false)
- content: The content of the license notice (if not using an external file)
Advanced Configuration
Multiple Legal Entities
You can specify multiple legal entities in the legal section:
legal:
- inception: 2014
name: Mars Hospital
locality: Rotterdam
country: NL
- inception: 2016
name: Lunar Base
locality: Capelle aan den IJssel
country: NL
- inception: 2018
name: Enovation Group B.V.
locality: Capelle aan den IJssel
country: NL
This is useful when the copyright has been transferred between different entities over time.
Removing Copyright Notices
Copyright statements that are not defined in the legal block will be removed.
External License File
If you want to use an external file for the license notice:
license:
enabled: true
external: true
Examples
-
Basic configuration for a single company with license:
source: - py - java legal: - inception: 2015 name: Enovation Group B.V. locality: Capelle aan den IJssel country: NL license: enabled: true content: All rights reserved.
-
Configuration with multiple legal entities, removals, and custom license:
source: - java - ts - cs - py legal: - inception: 2014 name: Mars Hospital locality: Rotterdam country: NL - inception: 2017 name: Lunar Base locality: Capelle aan den IJssel country: NL - inception: 2019 name: Enovation Group B.V. locality: Capelle aan den IJssel country: NL license: enabled: true external: false content: All rights reserved. include: exclude:
Docker
Build the docker container locally.
docker build -t clmgr:latest .
--network=host might be needed for the container build to resolve the DNS from the host machine.
Run the docker container in a project.
docker run -v .:/work -it clmgr:latest
-v .:/work will mount the current directory to work dir in the docker container.
Contributing
We welcome contributions to the Copyright License Manager!
For information on contributing to this project, please see our Development Guide <DEVELOPMENT.rst>_.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clmgr-1.1.0.tar.gz.
File metadata
- Download URL: clmgr-1.1.0.tar.gz
- Upload date:
- Size: 52.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e84a3c35f9b7bc4a7fc6d31c5e76e058f1ee70fef00b293b77bc214dfa78104c
|
|
| MD5 |
08b56b454956f0d41eed44f965fe44ad
|
|
| BLAKE2b-256 |
ca939fb33a35761a1b611bdba99a675b45aa8e49489b80524431d3c183a6f5ca
|
File details
Details for the file clmgr-1.1.0-py3-none-any.whl.
File metadata
- Download URL: clmgr-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25e62f32b0c29499ff94f3b25d9de941f8737367d90f8ca6683f12cef803593b
|
|
| MD5 |
d27f9b1836b6342574be2ea1290be8da
|
|
| BLAKE2b-256 |
26602cd45d49964583777cb66aef720b843a36850ab734519650ec126e13c64f
|