Small repo that adds or updates the Apache v2 license header to source code files of your project
Project description
head_of_apache
Small repo that adds or updates the Apache v2 license header to source code files of your project
The code is mostly taken from the IAM-CMS pre-commit-hooks project. The major changes were that the license header is fuzzily matched, meaning that if the year changes, the license header will be updated inplace instead of being prepended to the previous header.
Usage
The hook is intended to the following:
- Add the Apache 2.0 License header for the desired author and a date range that finishes with the current year or the string "present" to source code files that do not have the Apache 2.0 License header
- If there's an existing Apache 2.0 License header with another author, it keeps it while prepending a new License header under the desired author and the year range
- If there's an existing Apache 2.0 License header for the desired author but for an incorrect year range, the year range is updated while keeping the start year of the original license header.
- Any special shebang or encoding opennings are left are they were found.
To run the pre-commit hook, you must pass the following configuration:
repos:
- repo: https://github.com/lucianopaz/head_of_apache
rev: "0.1.0"
hooks:
- id: head_of_apache
args:
- --author
- name of author
- --exclude
- excluded/directory_or_file
- --last-year-present
Using the args keyword, the default behaviour of the hook can be adapted. The following options exist:
-a/--author: The author to use in the license header.
-m/--mapping: Overwrite existing or add additional file types to the default file/comment style mapping. For example, to use Jinja comment styles in HTML files, the following mapping can be used: -m html jinja.
-x/--exclude: A path to exclude. A file will be excluded if it starts with the given path. Can be specified more than once.
-d/--dry-run: If present, head_of_apache will only print the list of the files that need a license update instead of changing them inplace.
-l/--last-year-present: If present, the end year in the license date range is set to the string "present". If the flag is not supplied, then the current year number will be used in the year range instead.
--start-year: If present, this year will overwrite the start year found in all matched scripts. If absent, the existing start year will be preserved, and if there is no start year present, the current year (the year at which head_of_apache was called) will be used in the license header.
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 head_of_apache-0.1.1.tar.gz.
File metadata
- Download URL: head_of_apache-0.1.1.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8523dee939ca1a2722b9ddc4b42da537b4d1f6245b16e5dd98ed947a90099062
|
|
| MD5 |
4ca2bf3f1764f12749d42d012a873170
|
|
| BLAKE2b-256 |
1b832453a369a129af3b4a33d9d9b79d25af6ff1262881c8ac476797c4d58282
|
Provenance
The following attestation bundles were made for head_of_apache-0.1.1.tar.gz:
Publisher:
release.yaml on lucianopaz/head_of_apache
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
head_of_apache-0.1.1.tar.gz -
Subject digest:
8523dee939ca1a2722b9ddc4b42da537b4d1f6245b16e5dd98ed947a90099062 - Sigstore transparency entry: 180177667
- Sigstore integration time:
-
Permalink:
lucianopaz/head_of_apache@6e75275f0d3ce21db7513f62ca120fb330b1edd0 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/lucianopaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@6e75275f0d3ce21db7513f62ca120fb330b1edd0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file head_of_apache-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: head_of_apache-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8145b68c65ec3f93ea7e3c118de9b2f6742a58c5dc8aa21c41c13188cba6dfcd
|
|
| MD5 |
6caa129ead7cd59364479190126f6539
|
|
| BLAKE2b-256 |
eec9436783c80ae0c663732e25ede4747553b9a38e20563183261f5118f2d630
|
Provenance
The following attestation bundles were made for head_of_apache-0.1.1-py2.py3-none-any.whl:
Publisher:
release.yaml on lucianopaz/head_of_apache
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
head_of_apache-0.1.1-py2.py3-none-any.whl -
Subject digest:
8145b68c65ec3f93ea7e3c118de9b2f6742a58c5dc8aa21c41c13188cba6dfcd - Sigstore transparency entry: 180177669
- Sigstore integration time:
-
Permalink:
lucianopaz/head_of_apache@6e75275f0d3ce21db7513f62ca120fb330b1edd0 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/lucianopaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@6e75275f0d3ce21db7513f62ca120fb330b1edd0 -
Trigger Event:
release
-
Statement type: