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

    • 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
    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.0.tar.gz (26.4 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.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: licenser_h-1.0.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for licenser_h-1.0.tar.gz
Algorithm Hash digest
SHA256 f94be3267cb3800c666ebdfec2857e92168deb5181a1b8920365dbf1694fddde
MD5 dd9d33b527e7295a2bd9141989293826
BLAKE2b-256 c32fdde7060f256f6655a3f9e25192de01f40f4547f032c24032d963622da53f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: licenser_h-1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for licenser_h-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ae5645c97cf584890faada001b81e479a78880b5da582b0dabf79e18b0df1fa
MD5 6f533ec18145b7b71ee751f47503c1ef
BLAKE2b-256 558a74a89cb164be54cffc180868fa3358e81765cd95e82a89cc3cc2d9aed10a

See more details on using hashes here.

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