Skip to main content

Generate license files for your projects

Project description

lice

Lice generates license files. No more hunting down licenses from other projects.

Changes from the original 'Lice' project

[!NOTE] This project is forked from the original lice project which seems to have been abandoned and is not compatible with Python 3.12.

I have created a new project rather than issue a PR because the changes are quite large, and no-one is merging PR's on the original project. Otherwise, the Git history is identical to the original.

This version fixes the compatibility issue and updates the tooling :

  • It now uses Poetry for dependency management
  • The code has been modernized and cleaned up, all type-hinting has been added
  • It passes strict linting with the latest 'Ruff'
  • GitHub actions set up for Dependabot and Dependency Review

In addition, future plans are to

  • Convert from 'argparse' to 'Typer' for CLI handling.
  • Update the existing test suite to full coverage, its at about 39% right now.
  • Integrate with 'codacy' for code-quality and test coverage checks.

[!IMPORTANT] This library is now only compatible with Python 3.9 and above. If you wish to use an older version, use the original 'lice' package.

Installation

Installation is standard. If you are using pipx (recommended) install it as:

pipx install lice2

Otherwise use pip as standard:

pip install lice2

Overview

Generate a BSD-3 license, the default:

$ lice
Copyright (c) 2013, Jeremy Carbaugh

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
...

Generate an MIT license:

$ lice mit
The MIT License (MIT)
Copyright (c) 2013 Jeremy Carbaugh

Permission is hereby granted, free of charge, to any person obtaining a copy
...

Generate a BSD-3 license, specifying the year and organization to be used:

$ lice -y 2012 -o "Sunlight Foundation"
Copyright (c) 2012, Sunlight Foundation

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
...

Generate a BSD-3 license, formatted for python source file:

$ lice -l py

# Copyright (c) 2012, Sunlight Foundation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
...

Generate a python source file with a BSD-3 license commented in the header:

$ lice -l py -f test
$ ls
test.py
$ cat test.py

# Copyright (c) 2012, Sunlight Foundation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
...

Generate a source file (language detected by -f extension):

$ lice -f test.c && cat test.c
/*
 * Copyright (c) 2012, Sunlight Foundation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 ...

If organization is not specified, lice will first attempt to use git config to find your name. If not found, it will use the value of the $USER environment variable. If the project name is not specified, the name of the current directory is used. Year will default to the current year.

You can see what variables are available to you for any of the licenses:

$ lice --vars mit
The mit license template contains the following variables:
  year
  organization

I want XXXXXXXXX license in here!

Great! Is it a license that is commonly used? If so, open an issue or, if you are feeling generous, fork and submit a pull request.

Usage

    usage: lice [-h] [-o ORGANIZATION] [-p PROJECT] [-t TEMPLATE_PATH] [-y YEAR]
                [--vars] [license]

    positional arguments:
      license               the license to generate, one of: agpl3, apache, bsd2,
                            bsd3, cddl, cc0, epl, gpl2, gpl3, lgpl, mit, mpl

    optional arguments:
      -h, --help            show this help message and exit
      -o ORGANIZATION, --org ORGANIZATION
                            organization, defaults to .gitconfig or
                            os.environ["USER"]
      -p PROJECT, --proj PROJECT
                            name of project, defaults to name of current directory
      -t TEMPLATE_PATH, --template TEMPLATE_PATH
                            path to license template file
      -y YEAR, --year YEAR  copyright year
      -l LANGUAGE, --language LANGUAGE
                            format output for language source file, one of: js, f,
                            css, c, m, java, py, cc, h, html, lua, erl, rb, sh,
                            f90, hpp, cpp, pl, txt [default is not formatted (txt)]
      -f OFILE, --file OFILE Name of the output source file (with -l, extension can be omitted)
      --vars                list template variables for specified license

Changelog

See the CHANGELOG.md file for details for this fork, and the OLD_CHANGELOG.md file for the original project.

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

lice2-0.8.0.tar.gz (76.3 kB view details)

Uploaded Source

Built Distribution

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

lice2-0.8.0-py3-none-any.whl (124.0 kB view details)

Uploaded Python 3

File details

Details for the file lice2-0.8.0.tar.gz.

File metadata

  • Download URL: lice2-0.8.0.tar.gz
  • Upload date:
  • Size: 76.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.8.0-40-generic

File hashes

Hashes for lice2-0.8.0.tar.gz
Algorithm Hash digest
SHA256 398548f7a12ca9815d417be2b33e7125b570b34755e6b318c8cecc32cf6a41cb
MD5 f250105b30ea2e892e25650e9545dfeb
BLAKE2b-256 b4cadcbd14d91cc4832ee449bba46db7bce908e4346527ece3919e5bb84491e0

See more details on using hashes here.

File details

Details for the file lice2-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: lice2-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 124.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.8.0-40-generic

File hashes

Hashes for lice2-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06b186dc8bc93fd2e4e4f98fc983f1ec2e5d78a0f1c823cc5556af6cf4c4a8e0
MD5 d6e869f5848e8e177c0a37789ccc3614
BLAKE2b-256 9c724db3085b5bee0317aa17ede178f5c088b484921d26f7f5b2e981ac844b63

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