Skip to main content

Copyright License Manager

PyPI PyPI - Python Version PyPI - Wheel PyPI - Format PyPI - License GitHub Actions - CI GitHub Actions - pre-commit Codecov

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

  1. 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.
    
  2. 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>_.

Release files for clmgr 1.1.0

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

Source distribution (sdist)

Source distribution for clmgr 1.1.0
File Size Uploaded
clmgr-1.1.0.tar.gz 52.8 kB Details

Built distribution (wheel)

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

Total release size: 57.2 kB

Release files / clmgr-1.1.0.tar.gz

Download URL clmgr-1.1.0.tar.gz
Size 52.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e84a3c35f9b7bc4a7fc6d31c5e76e058f1ee70fef00b293b77bc214dfa78104c
BLAKE2b-256 checksum
How to use checksums
ca939fb33a35761a1b611bdba99a675b45aa8e49489b80524431d3c183a6f5ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / clmgr-1.1.0-py3-none-any.whl

Download URL clmgr-1.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25e62f32b0c29499ff94f3b25d9de941f8737367d90f8ca6683f12cef803593b
BLAKE2b-256 checksum
How to use checksums
26602cd45d49964583777cb66aef720b843a36850ab734519650ec126e13c64f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.6.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

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