# eric7.PipInterface.piplicenses

pip-licenses

MIT License

Copyright (c) 2018 raimon

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Global Attributes

DEFAULT_OUTPUT_FIELDS
FIELDS_TO_METADATA_KEYS
FIELD_NAMES
LICENSE_UNKNOWN
MAP_DEST_TO_ENUM
METADATA_KEYS
PATTERN_DELIMITER
SUMMARY_FIELD_NAMES
SUMMARY_OUTPUT_FIELDS
SYSTEM_PACKAGES
__author__
__license__
__pkgname__
__summary__
__url__
__version__
importlib_metadata

### Classes

CompatibleArgumentParser |
CustomHelpFormatter |
CustomNamespace |
FromArg |
NoValueEnum |
OrderArg |
SelectAction |

### Functions

case_insensitive_set_diff | Same as set.difference() but case-insensitive
case_insensitive_set_intersect | Same as set.intersection() but case-insensitive
choices_from_enum |
create_licenses_list |
create_output_string |
create_parser |
create_summary_list |
enum_key_to_value |
extract_homepage | Extracts the homepage attribute from the package metadata.
filter_string |
find_license_from_classifier |
get_output_fields |
get_packages |
get_pkg_included_file | Attempt to find the package's included file on disk and return the tuple (included_file_path, included_file_contents).
get_pkg_info |
get_python_sys_path |
main |
normalize_pkg_name | Return normalized name according to PEP specification
select_license_by_source |
value_to_enum_key |

## CompatibleArgumentParser

### Derived from

argparse.ArgumentParser

### Class Attributes

None

### Class Methods

None

### Methods

_verify_args |
parse_args |

### Static Methods

None

#### CompatibleArgumentParser._verify_args

_verify_args(args: CustomNamespace)

#### CompatibleArgumentParser.parse_args

parse_args(args: None | Sequence[str] = None, namespace: None | CustomNamespace = None, )
Up

## CustomHelpFormatter

### Derived from

argparse.HelpFormatter

### Class Attributes

None

### Class Methods

None

### Methods

CustomHelpFormatter |
_expand_help |
_format_action |
_split_lines |

### Static Methods

None

#### CustomHelpFormatter (Constructor)

CustomHelpFormatter(prog: str, indent_increment: int = 2, max_help_position: int = 24, width: Optional[int] = None, )

#### CustomHelpFormatter._expand_help

_expand_help(action: argparse.Action)

#### CustomHelpFormatter._format_action

_format_action(action: argparse.Action)

#### CustomHelpFormatter._split_lines

_split_lines(text: str, width: int)
Up

## CustomNamespace

### Derived from

argparse.Namespace

### Class Attributes

allow_only
fail_on
filter_code_page
filter_strings
from_
ignore_packages
no_license_path
order
output_file
packages
summary
with_authors
with_description
with_license_file
with_notice_file
with_system
with_urls

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## FromArg

### Derived from

NoValueEnum

### Class Attributes

ALL
CLASSIFIER
META
MIXED

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## NoValueEnum

### Derived from

Enum

### Class Attributes

None

### Class Methods

None

### Methods

__repr__ |

### Static Methods

None

#### NoValueEnum.__repr__

__repr__()
Up

## OrderArg

### Derived from

NoValueEnum

### Class Attributes

AUTHOR
COUNT
LICENSE
MAINTAINER
NAME
URL

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## SelectAction

### Derived from

argparse.Action

### Class Attributes

None

### Class Methods

None

### Methods

__call__ |

### Static Methods

None

#### SelectAction.__call__

__call__(parser: argparse.ArgumentParser, namespace: argparse.Namespace, values: str, option_string: Optional[str] = None, )
Up

## case_insensitive_set_diff

case_insensitive_set_diff(set_a, set_b)

Same as set.difference() but case-insensitive

Up

## case_insensitive_set_intersect

case_insensitive_set_intersect(set_a, set_b)

Same as set.intersection() but case-insensitive

Up

## choices_from_enum

choices_from_enum(enum_cls: Type[NoValueEnum])
Up

## create_licenses_list

create_licenses_list(args: "CustomNamespace", output_fields=DEFAULT_OUTPUT_FIELDS)
Up

## create_output_string

create_output_string(args: "CustomNamespace")
Up

## create_parser

create_parser()
Up

## create_summary_list

create_summary_list(args: "CustomNamespace")
Up

## enum_key_to_value

enum_key_to_value(enum_key: Enum)
Up

## extract_homepage

extract_homepage(metadata: Message)

Extracts the homepage attribute from the package metadata.

Not all python packages have defined a home-page attribute. As a fallback, the `Project-URL` metadata can be used. The python core metadata supports multiple (free text) values for the `Project-URL` field that are comma separated.

Args: metadata: The package metadata to extract the homepage from.

Returns: The home page if applicable, None otherwise.

Up

## filter_string

filter_string(item: str)
Up

## find_license_from_classifier

find_license_from_classifier(classifiers: list[str])
Up

## get_output_fields

get_output_fields(args: CustomNamespace)
Up

## get_packages

get_packages(args: CustomNamespace, )
Up

## get_pkg_included_file

get_pkg_included_file(pkg, file_names_rgx: str)

Attempt to find the package's included file on disk and return the tuple (included_file_path, included_file_contents).

Up

## get_pkg_info

get_pkg_info(pkg)
Up

## get_python_sys_path

get_python_sys_path(executable: str)
Up

## main

main()
Up

## normalize_pkg_name

normalize_pkg_name(pkg_name: str)

Return normalized name according to PEP specification

See here: https://peps.python.org/pep-0503/#normalized-names

Args: pkg_name: Package name it is extracted from the package metadata or specified in the CLI

Returns: normalized packege name

Up

## select_license_by_source

select_license_by_source(from_source: FromArg, license_classifier: list[str], license_meta: str)
Up

## value_to_enum_key

value_to_enum_key(value: str)
Up