sphinx_licenseinfo

Sphinx directives for showing license information.

Classes:

ChooseALicenseRole()

Sphinx role for referencing a license on choosealicense.com.

LicenseDirective(name, arguments, options, …)

Directive for showing a license.

LicenseInfoDirective(name, arguments, …)

Directive for showing information about a license.

Functions:

class ChooseALicenseRole[source]

Bases: ReferenceRole

Sphinx role for referencing a license on choosealicense.com.

Methods:

run()

Process the role.

run()[source]

Process the role.

Return type

Tuple[List[Node], List[system_message]]

class LicenseDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Bases: SphinxDirective

Directive for showing a license.

The license can be taken from a Python package’s metadata, or from a filename relative to the Sphinx source directory.

Methods:

problematic(message)

Reports an error while processing the directive.

run()

Process the content of the directive.

problematic(message)[source]

Reports an error while processing the directive.

Parameters

message (str)

Return type

List[Node]

run()[source]

Process the content of the directive.

Return type

List[Node]

class LicenseInfoDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Bases: SphinxDirective

Directive for showing information about a license.

The license information is obtained from choosealicense.com.

Methods:

add_rules_list(category, rules)

Add a heading for a rule category, followed by a bullet-point list of the rules in that category.

run()

Process the content of the directive.

add_rules_list(category, rules)[source]

Add a heading for a rule category, followed by a bullet-point list of the rules in that category.

Parameters
  • category (str) – The category label.

  • rules (Iterable[Rule]) – The rules.

Return type

List[Node]

run()[source]

Process the content of the directive.

Return type

List[Node]

setup(app)[source]

Setup sphinx_licenseinfo.

Parameters

app (Sphinx) – The Sphinx application.

Return type

Dict[str, Any]