Skip to main content

jk_licenses

Introduction

This python module provides OS licenses.

Information about this module can be found here:

Why this module?

It is quite tiresome to maintain various instances of a program using all the same data. Therefore the functionality of providing a set of licenses has been factored out into this module jk_licenses.

This module is intended as a building block in module/package/application management.

What licenses are supported?

The following table provides an overview about the licenses available in this module as well as their identifiers and variables:

Main license ID Alternative license IDs Human readable name Placeholders
0BSD Free Public License 1.0.0
AGPLv3 AGPL-3.0, AGPLv3 GNU Affero General Public License version 3
Apache2 Apache2 GNU Lesser General Public License version 3
BSD2 BSD2 The 2-Clause BSD License year, copyrightHolder
BSD3 BSD3 The 3-Clause BSD License year, copyrightHolder
GPLv3 GPL-3.0, GPLv3 GNU General Public License version 3
LGPLv3 LGPL-3.0, LGPLv3 GNU Lesser General Public License version 3
MIT MIT License year, copyrightHolder
Proprietary proprietary Propriertary License year, copyrightHolder

How to use this module

Import this module

Please include this module into your application using the following code:

import jk_licenses

What this module provides

The python module jk_licenses provides a constant (= global variable) and three classes:

  • constant LICENSE_MGR that provides an instance of LicenseMgr
  • class LicenseMgr that maintaines the available licenses
  • class License that represents a single license
  • class VariableDef: licenses may contain VariableDef to represent placeholders within the license text

The class License

Each license is represented by an instance of class License.

This section gives a short explanation about the structure of an instance of License in pseudocode notation.

This class provides the following properties:

  • str name : The human readable name of this license.
  • str[] licenseIDs : A list of strings that are associated with this license as identifiers. The first license ID is always the main license ID.
  • str licenseID : The main license ID that identifies this license.
  • str classifier : A string that contains a possible python trove classifier. See pypi.org for details.
  • VariableDef[] variableDefinitions : A list of variable definitions. These give information about placeholders to fill if you want to produce the license text.

This class provides the following methods:

  • str produceText(dict<str,str> variableAssignments) : Produce the license text. If a license has placeholder, you need to provide a value for every placeholder. An exception is thrown on error.
  • void validateVariableAssignments(dict<str,str> variableAssignments) : You can check if data is provided for all placeholders as required using this method. An exception is thrown on error.

You do not need to instantiate this class yourself. Instead you obtain an instance of this class through the license manager.

The class LicenseMgr

The license manager is represented by an instance of class LicenseMgr.

This section gives a short explanation about the structure of the license manager in pseudocode notation.

This class provides the following properties:

  • str name : The human readable name of this license.
  • str[] licenseIDs : A list of strings that are associated with this license as identifiers. The first license ID is always the main license ID.
  • str licenseID : The main license ID that identifies this license.
  • str classifier : A string that contains a possible python trove classifier. See pypi.org for details.
  • VariableDef[] variableDefinitions : A list of variable definitions. These give information about placeholders to fill if you want to produce the license text.

This class provides the following methods:

  • str produceText(dict<str,str> variableAssignments) : Produce the license text. If a license has placeholder, you need to provide a value for every placeholder. An exception is thrown on error.
  • void validateVariableAssignments(dict<str,str> variableAssignments) : You can check if data is provided for all placeholders as required using this method. An exception is thrown on error.

You do not need to instantiate this class yourself. Instead you access a default license manger instance using the constant (= variable) LICENSE_MGR this module provides.

Access the licenses

You can display the licenses that are available via the license manager. Example:

for licenseID in LICENSE_MGR.mainLicenseIDs:
	print(licenseID)

If you specify the licenses available you can use the license identifiers to access a license object. Example:

license = LICENSE_MGR.getLicense("0BSD")
print(license.name)

Producing a license text

Once you have a license object obtained from the license manager you can then produce the license text. Example:

license = LICENSE_MGR.getLicense("0BSD")
licenseText = license.produceText()

And with arguments:

license = LICENSE_MGR.getLicense("MIT")
licenseText = license.produceText({
	"year": 2020,
	"copyrightHolder": "Jürgen Knauth"
})

Contact Information

This work is Open Source. This enables you to use this work for free.

Please have in mind this also enables you to contribute. We, the subspecies of software developers, can create great things. But the more collaborate, the more fantastic these things can become. Therefore Feel free to contact the author(s) listed below, either for giving feedback, providing comments, hints, indicate possible collaborations, ideas, improvements. Or maybe for "only" reporting some bugs:

License

This software is provided under the following license:

  • Apache Software License 2.0

Metadata

Release files for jk_licenses 0.2024.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jk_licenses 0.2024.8.4
File Size Uploaded
jk_licenses-0.2024.8.4.tar.gz 39.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jk_licenses 0.2024.8.4
File Interpreter ABI Platform
jk_licenses-0.2024.8.4-py3-none-any.whl Python 3 none any Details

Total release size: 85.1 kB

Release files / jk_licenses-0.2024.8.4.tar.gz

Download URL jk_licenses-0.2024.8.4.tar.gz
Size 39.0 kB
Tags Source
SHA-256 checksum
How to use checksums
14cda1a2a5c12e7b736d119c14ff27b28f47e6f44842f55557e962bb9b975cd1
BLAKE2b-256 checksum
How to use checksums
0dbbe698cc3bc9cdf5ee98d60ee16595b4b16c9f61932c60bdb70085cb747b66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / jk_licenses-0.2024.8.4-py3-none-any.whl

Download URL jk_licenses-0.2024.8.4-py3-none-any.whl
Size 46.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ebbf6d6089c951578fed4d90a48ced9043a7c92814370b3cd9bc30e0c2bbf1f
BLAKE2b-256 checksum
How to use checksums
79bf2b7ad2a8d0931932488325b7f94bcd1b2fd349d671ceea640c8545343fff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

0.2024.8.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page