Skip to main content

Tool to insert license headers at the beginning of text-based files.

Project description

Tool: insert-license-header

This python script automatically inserts your license header at the beginning of specified source code files.

Forked from Lucas-C/pre-commit-hooks and modified to realize the following behaviour:

:warning: The behaviour of --dynamic-years changed in version 1.1.0.

Add argument --dynamic-years which determines the start year of the copyright time range automatically - based on when the file was first tracked with Git. If a start year is already present, it is not touched. If a file is not tracked by Git, the current year is used as start year. The end year is automatically set to the date of the last commit that affected the file. If an end year is already present that is in the future, don't touch it. It is, however, incremented if it lies in the past. If the file is not tracked by Git, use the current year.

Include a {year_start} and {year_end} in your license header to use this feature.

Add argument --license-base64 to include a license not via a file but through a base64 encoded string that is passed as a value for this argument. Obtain your license base64 encoded string with cat LICENSE.txt | base64. Including a license via --license-base64 {base64string} overrides the --license-filepath option.

:warning: This is not a pre-commit hook anymore. Instead, this repository contains just the base script to insert licenses in text-based files. To check out the resulting pre-commit hook, visit: https://github.com/Quantco/pre-commit-insert-license

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

insert_license_header-1.3.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

insert_license_header-1.3.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file insert_license_header-1.3.0.tar.gz.

File metadata

  • Download URL: insert_license_header-1.3.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for insert_license_header-1.3.0.tar.gz
Algorithm Hash digest
SHA256 0f269ec6cc50a39813600d2abb0b59f392be455da71f712e999dcae608c06c72
MD5 618620cee67f21997def1055d7ae6220
BLAKE2b-256 bc73eb624d377054da1b749efb124a0c0a42cc508a9b56423e38ce8b59cb9c60

See more details on using hashes here.

File details

Details for the file insert_license_header-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for insert_license_header-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 554fbecaf2c5247854549873869e3004baa2cffa67ae918d22e1e5dc5c7e762f
MD5 99641de85258e24d423e862939ea5d12
BLAKE2b-256 5d5f2ef0f49c58d9b57cb5b2faf92e28d45943c936598557f7e5d0e902c9f261

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page