Reference#

loglicense#

Log License.

class loglicense.DependencyFileParser#

Main module for DependencyFileParser.

Return type

None

static parse_poetry_lock(license_path, develop=False)#

Parser for poetry.lock files.

Parameters
  • license_path (pathlib.Path) – Path to license file (poetry.lock)

  • develop (bool) – Whether to include development dependencies

Returns

List of the names of python depedencies in poetry file

Return type

List[str]

static parse_pyproject_toml(license_path, develop=False)#

Parser for pyproject.toml files.

Parameters
  • license_path (pathlib.Path) – Path to license file (pyproject.toml)

  • develop (bool) – Whether to include development dependencies

Returns

List of the names of python depedencies in pyproject file

Return type

List[str]

static parse_requirements_txt(license_path, develop=False)#

Parser for requirements.txt files.

Parameters
  • license_path (pathlib.Path) – Path to license file (requirements.txt)

  • develop (bool) – Whether to include development dependencies (requirements_dev.txt)

Returns

List of the names of python depedencies in requirements file

Return type

List[str]

class loglicense.LicenseLogger(dependency_file, package_manager='pypi', info_columns=None, develop=False)#

Main module for logging licenses.

Parameters
  • dependency_file (str) – File to crawl dependencies for

  • package_manager (str) – Which type of package manager to evaluate. Defaults to pypi for python.

  • info_columns (Optional[List[str]]) – Information to include in table to log

  • develop (bool) – Whether to include development dependencies

get_license_metadata(libname)#

Fetch information from package manager site.

Parameters

libname (str) – Name of the package to fetch information regarding

Returns

The metadata of the library

Return type

Any

is_logged()#

Check if logged.

Returns

Whether logged or not

Return type

bool

log_licenses()#

Fetches license package metadata for the given dependency file.

Returns

Metadata from licenses found in dependency file.

Return type

List[List[str]]