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.1.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.1-py3-none-any.whl (89.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: licgen-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4b7ab63e2c08b7c0d9232a54eae79a4a940e24af42e4cd9fb44ddadf3a6f243b
MD5 41a7a57e68deb9cdca5ab321ebdedcca
BLAKE2b-256 58a3599b2ca428825812be86b6b1e7e5995cefc3abd2d8c58a83b8c8b5937309

See more details on using hashes here.

File details

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

File metadata

  • Download URL: licgen-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc168d9745de652e34dcc8e53c1b9b63b3710927ca9f3bee7ede4d9a05626fd2
MD5 a137e87403f086a885d21eacf40f7e47
BLAKE2b-256 c54d3556fc3ff4ec460c46e4198b530dcc3f030c36c46650b7512c113ec5ebc9

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