Skip to main content

Small repo that adds or updates the Apache v2 license header to source code files of your project

Project description

head_of_apache

codecov

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.

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

head_of_apache-0.1.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

head_of_apache-0.1.0-py2.py3-none-any.whl (15.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file head_of_apache-0.1.0.tar.gz.

File metadata

  • Download URL: head_of_apache-0.1.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for head_of_apache-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d7996381630ab58d3a395ca774eab61a106123dc018a3a3757e97ec08b5a2ad0
MD5 4ce60cd12e6c39498d23b311c06f6b22
BLAKE2b-256 136c0c258e7f2c4f66affdb16e83c0f310fc995d6e97f8ed761fbb976523744e

See more details on using hashes here.

Provenance

The following attestation bundles were made for head_of_apache-0.1.0.tar.gz:

Publisher: release.yaml on lucianopaz/head_of_apache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file head_of_apache-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for head_of_apache-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c51ea9fbee1664ba43d77ab8056900850e7133d6ae371a6911bd5a0918818683
MD5 eecb7ac1c8be132e0bee114a3664a1e3
BLAKE2b-256 3360932fae4f63d8f2b44e863f514612f3a945d73dcf176ba1a382393796966a

See more details on using hashes here.

Provenance

The following attestation bundles were made for head_of_apache-0.1.0-py2.py3-none-any.whl:

Publisher: release.yaml on lucianopaz/head_of_apache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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