Usage

Enable sphinx_licenseinfo by adding the following to the extensions variable in your conf.py:

extensions = [
    ...
    'sphinx_licenseinfo',
    ]

For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .

Directives

.. license::

Shows the text of a license.

Exactly one of the following options must be provided:

:py: (string)

Obtain the license text from the LICENSE file of the given Python project’s .dist-info metadata directory.

:file: (flag)

Obtain the license text from the given file, relative to the Sphinx source directory (i.e. the directory containing conf.py).

.. license-info:: license

Shows information about a license.

The license information is obtained from choosealicense.com.

license is the SPDX identifier for the license.

Roles

:choosealicense:

Creates a cross-reference to a license on choosealicense.com.

The licenses are referred to by their SPDX identifier (e.g. mit), matched case insensitively. The title of the license (e.g. MIT License) is inserted into the document as a hyperlink to the license information page on choosealicense.com.

A custom title can be added to the link by writing :choosealicense:`title <spdx_id>`.

This role also generates an appropriate index entry.