Skip to main content

A simple tool for adding licenses and license headers to your projects.

Project description

licenser-h

PyPI - Version PyPI - License PyPI - Python Version

A Python tool to add or update license headers in your project files.

Description

licenser-h is a command-line utility designed to automate the process of adding or updating licenses and license headers in your project's source code files. It supports multiple programming languages and license types, ensuring that your code complies with the licensing requirements of your choice.

Features

  • Supports Multiple Licenses :

    • MIT License

    • Apache License 2.0

    • GNU General Public License v3.0

    • GNU Affero General Public License v3

    • BSD 2-Clause Simplified License

  • Multi-language Support :

    • Python, Shell Script, C, C++, Java, JavaScript, C#, Go, Ruby, PHP, HTML, XML, CSS, and more.
  • Automatic Detection and Replacement :

    • Detects existing license headers and replaces them.

    • Only updates the license header at the top of the file without affecting other comments.

  • Customizable Placeholders :

    • Inserts custom values representing the current year, project name, and author name.

Installation

Prerequisites

  • Python 3.6 or higher

  • pip package manager Using setup.py You can install licenser-h by cloning the repository and running the setup.py script:

# Clone the repository
git clone https://github.com/yummydirtx/licenser-h.git
cd licenser-h

# Install the package
python -m pip install .

Using pip licenser-h is available on PyPI, you can install it directly:

pip install licenser-h

Usage

Command-Line Interface

Run the licenser-h tool from your command line:

licenser-h

Example Interaction

Select a license:
   MIT License
    Apache License 2.0
    GNU General Public License v3.0
    GNU Affero General Public License v3
    BSD 2-Clause Simplified License
Enter the project name: MyAwesomeProject
Enter the author name: Jane Doe

After providing the necessary information, licenser-h will:

  • Generate a LICENSE file in your project's root directory.

  • Add or update license headers in all supported source code files within your project.

Supported File Extensions

licenser-h automatically detects files with the following extensions:

  • Script Languages : .py, .sh, .rb, .php

  • Compiled Languages : .c, .cpp, .h, .java, .cs, .go

  • Web Technologies : .js, .html, .xml, .css

  • Others : Additional language support is coming!

How It Works

  1. License Selection : Prompts you to select a license from the supported options.

  2. User Information : Asks for the project name and author name.

  3. License Text Generation : Uses the provided information to generate the full license text and license header, replacing placeholders.

  4. File Processing :

  • Walks through the project directory.

  • Detects files with supported extensions.

  • Adds or updates the license header at the top of each file.

  1. Existing License Detection :
  • Detects existing license headers by matching patterns, even if placeholder values are unknown.

  • Replaces the old license header with the new one without affecting other comments or code.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! If you have suggestions for improvements or encounter any issues, please feel free to open an issue or submit a pull request.

Steps to Contribute

  1. Fork the repository.

  2. Create a new branch for your feature or bugfix.

  3. Commit your changes with descriptive messages.

  4. Push the branch to your forked repository.

  5. Open a pull request against the main branch.

Contact

For questions or support, please contact theJunkyard webadmin.

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

licenser_h-1.2.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

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

licenser_h-1.2-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file licenser_h-1.2.tar.gz.

File metadata

  • Download URL: licenser_h-1.2.tar.gz
  • Upload date:
  • Size: 37.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for licenser_h-1.2.tar.gz
Algorithm Hash digest
SHA256 dfdfe3acc93438009603427451728876f4c8cd653590fd251c4f4663997dcff1
MD5 1b34fab1162431e8e9ab29d5d0ad326b
BLAKE2b-256 db1893ac82b6e6156f29dacfda146e125f0bea90954f373b70a76e22e36f90b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for licenser_h-1.2.tar.gz:

Publisher: publish-to-pypi.yml on yummydirtx/licenser-h

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

File details

Details for the file licenser_h-1.2-py3-none-any.whl.

File metadata

  • Download URL: licenser_h-1.2-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for licenser_h-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5cc3d86e2f5ec5c0e7d2f9b2b486937e4c43b1d7915657573574992e2db395d5
MD5 f1b752b21046b7da0ccf0c44bcc87746
BLAKE2b-256 2f97e5de6df14bcd78ac42991caa38cfa01e3f98defd4b328e43b4b75598de8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for licenser_h-1.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on yummydirtx/licenser-h

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