pychoosealicense
¶
Provides license metadata from choosealicense.com.
Classes:
|
Represents a license, with its text and associated metadata. |
Functions:
|
Return the license text and metadata for the given identifier. |
-
class
License
(title, spdx_id, description, how, conditions, permissions, limitations, content, featured=False, hidden=True, nickname=None, note=None)[source]¶ Bases:
tuple
Represents a license, with its text and associated metadata.
Changed in version 0.2.0:
conditions
,permissions
andlimitations
are nowtuples
rather thanlists
to maintain immutability of theLicense
object.Methods:
Attributes:
Bulleted list of required rules.
The text of the license.
A human-readable description of the license.
Whether the license is be featured on the choosealicense.com main page.
Whether the license is neither popular nor fills out the spectrum of licenses from strongly conditional to unconditional.
Instructions on how to implement the license.
Bulleted list of limited rules.
Customary short name if applicable (e.g, GPLv3)
Additional information about the licenses
Bulleted list of permitted rules.
Short identifier specified by https://spdx.org/licenses/
The license full name specified by https://spdx.org/licenses/
Type:
bool
Whether the license is neither popular nor fills out the spectrum of licenses from strongly conditional to unconditional.
-
spdx_id
¶ Type:
str
Short identifier specified by https://spdx.org/licenses/
-
title
¶ Type:
str
The license full name specified by https://spdx.org/licenses/
The content
attribute of License
can be populated with project-specific metadata using the str.format()
method:
l = get_license("MIT")
l.format(year=2021, fullname="Dominic Davis-Foster")
The supported fields as as follows. Note that not all licenses support all fields.
fullname – The full name or username of the repository owner
login – The repository owner’s username
email – The repository owner’s primary email address
project – The repository name
description – The description of the repository
year – The current year
projecturl – The repository URL or other project website