pyTooling.Licensing
The Licensing module implements mapping tables for various license names and identifiers.
Hint
See high-level help for explanations and usage examples.
Variables
Classes
PythonLicenseName
: A data class to represent the license’s short name and the package classifier for a license.License
: Representation of a license.
Variables
- pyTooling.Licensing.PYTHON_LICENSE_NAMES
Mapping of SPDX identifiers to Python license names
{'Apache-2.0': PythonLicenseName(ShortName='Apache 2.0', Classifier='Apache Software License'), 'BSD-3-Clause': PythonLicenseName(ShortName='BSD', Classifier='BSD License'), 'GPL-2.0-or-later': PythonLicenseName(ShortName='GPL-2.0-or-later', Classifier='GNU General Public License ' 'v2 or later (GPLv2+)'), 'MIT': PythonLicenseName(ShortName='MIT', Classifier='MIT License')}
- pyTooling.Licensing.Apache_2_0_License
Representation of a license.
Apache-2.0
- pyTooling.Licensing.BSD_3_Clause_License
Representation of a license.
BSD-3-Clause
- pyTooling.Licensing.GPL_2_0_or_later
Representation of a license.
GPL-2.0-or-later
- pyTooling.Licensing.MIT_License
Representation of a license.
MIT
- pyTooling.Licensing.SPDX_INDEX
Mapping of predefined licenses
{'Apache-2.0': Apache-2.0, 'BSD-3-Clause': BSD-3-Clause, 'GPL-2.0-or-later': GPL-2.0-or-later, 'MIT': MIT}
Classes
- class pyTooling.Licensing.PythonLicenseName(ShortName, Classifier)[source]
A data class to represent the license’s short name and the package classifier for a license.
Inheritance
- __str__()[source]
The string representation of this name tuple returns the short name of the license.
- Return type:
- Returns:
Short name of the license.
- __eq__(other)
Return self==value.
- __hash__ = None
- __repr__()
Return repr(self).
- class pyTooling.Licensing.License(spdxIdentifier, name, osiApproved=False, fsfApproved=False)[source]
Representation of a license.
Inheritance
- property SPDXIdentifier: str
Returns the license’ unique SPDX identifier.
- Returns:
The the unique SPDX identifier.
- property OSIApproved: bool
Returns true, if the license is approved by OSI (Open Source Initiative).
- Returns:
True
, if the license is approved by the Open Source Initiative.
- property FSFApproved: bool
Returns true, if the license is approved by FSF (Free Software Foundation).
- Returns:
True
, if the license is approved by the Free Software Foundation.
- property PythonLicenseName: str
Returns the Python license name for this license if it’s defined.
- Returns:
The Python license name.
- Raises:
ValueError – If there is no license name defined for the license.
(See and checkPYTHON_LICENSE_NAMES
)
- property PythonClassifier: str
Returns the Python package classifier for this license if it’s defined.
- Returns:
The Python package classifier.
- Raises:
ValueError – If there is no classifier defined for the license.
(See and checkPYTHON_LICENSE_NAMES
)
See also
List of Python classifiers
- __eq__(other)[source]
Returns true, if both licenses are identical (comparison based on SPDX identifiers).
- __ne__(other)[source]
Returns true, if both licenses are not identical (comparison based on SPDX identifiers).
- __repr__()[source]
Returns the internal unique representation (a.k.a SPDX identifier).
- Return type:
- Returns:
SPDX identifier of the license.
- class property HasClassAttributes: bool
Check if class has Attributes.
- Returns:
True
, if the class has Attributes.
- class property HasMethodAttributes: bool
Check if class has any method with Attributes.
- Returns:
True
, if the class has any method with Attributes.
- __hash__ = None