Skip to main content

licgen - fast and simple LICENSE file generator

Project description

licgen 📃

PyPI Version Python Versions License CI Status

licgen is a fast, reliable, and dependency-free CLI tool designed to instantly generate standard open-source LICENSE files for your projects.

Whether you need a quick permissive license for a hobby script or a strict copyleft license for an enterprise repository, licgen handles template rendering, copyright holder injection, and automated project/year detection out of the box.

✨ Features

  • 🗃️ Curated License Library: Includes all major open-source licenses (MIT, Apache 2.0, GPLv3, AGPLv3, Unlicense, and more) pre-loaded as native resources.
  • 🤖 Smart Autocomplete & Detection: Automatically resolves the current copyright year and dynamically infers the project name from your current directory if omitted.
  • 🔍 Interactive Discovery: Built-in quick list command (--list) to instantly view all available license types directly in your terminal.
  • 📦 Zero Dependencies: Pure Python implementation with zero third-party dependencies, leveraging modern importlib.resources and argparse for maximum portability and speed.
  • 🪶 Lightweight & Global: Seamlessly installs as a global binary command that can be invoked from any directory.

🎯 Motivation

While creating open-source projects (like pairgen or manigen), setting up the right LICENSE file is always annoying. You usually have to search for the template online, copy-paste it, and manually edit the year and author name.

licgen was created to standardize and automate this routine into a single, straightforward CLI command. It perfectly complements your existing development workflow, making project initialization effortless and compliant from second one.

📦 Installation

You can install licgen directly from PyPI using pip:

pip install licgen

Or, if you use uv (recommended for CLI tools):

uv tool install licgen

🚀 Quick Start

Generate a standard MIT license for the current year in your working directory:

licgen mit -a "Your Name"

💡 Advanced Usage Examples

1. Listing Available Licenses

If you are unsure which license type string to pass, list all built-in templates:

licgen -l

2. Setup with Specific Year and Project Name

Generate desired license, explicitly defining the project name and a custom copyright year:

licgen apache-2.0 -a "Your name" -y 2048 -p "Project name"

3. Custom Output Directory

Initialize a license inside a specific sub-folder or a newly initialized git repository path:

licgen mit -a "Your name" -o ./my-new-project

🛠️ CLI Reference

Argument Short Description Default
LICENSE_TYPE - (Required) Type of license to generate. -
--author -a (Required) Name of the copyright holder / author. -
--list -l Show all available license types and exit. False
--year -y Copyright year. Current Year
--project -p Project name. Current Dir Name
--output-path -o Directory where the LICENSE file will be saved. Current Dir

🤝 Contributing

1. Clone the repository

git clone https://github.com/ash1ra/licgen
cd licgen

2. Install dependencies using uv

uv sync
# On Windows
.venv\Scripts\activate
# on Unix or MacOS
source .venv/bin/activate

3. Format and lint the code

uv run ruff format .
uv run ruff check .

4. Run the tests

uv run pytest tests/ -v

5. Submit a pull request

If you'd like to contribute, please fork the repository and open a pull request to the main branch.

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

licgen-1.0.2.tar.gz (70.2 kB view details)

Uploaded Source

Built Distribution

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

licgen-1.0.2-py3-none-any.whl (89.5 kB view details)

Uploaded Python 3

File details

Details for the file licgen-1.0.2.tar.gz.

File metadata

  • Download URL: licgen-1.0.2.tar.gz
  • Upload date:
  • Size: 70.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for licgen-1.0.2.tar.gz
Algorithm Hash digest
SHA256 23468a7a341be3efc8ee6f67fa620b374a93de65cbd408a12289f841dd425729
MD5 5d48d70d91cb0892b48c903ab9594e41
BLAKE2b-256 68ddd89eedb3b944aa8e3dfd6ddc7d41d3eb8b7a32fbf556d7849c6d01aa8e24

See more details on using hashes here.

File details

Details for the file licgen-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: licgen-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 89.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for licgen-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f2609d2333d406fa3058933f267156b75d1d562f2cd2f93b3772f6e8bab14ed6
MD5 f53a2ea2744627cb3cb2e3b2e9e16747
BLAKE2b-256 fa330eba4d43837803147fab2f5ec0fdaf43ae551704427719c8d84cea3b9d9b

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