Metadata Module

Program metadata introspection for use in usage, help text, and documentation.

author:

Doug Skrypa

class cli_command_parser.metadata.MetadataBase(inheritable: bool = True)[source]

Bases: object

inheritable
get_parent(instance: ProgramMetadata) ProgramMetadata | None[source]
get_value(instance: ProgramMetadata)[source]
name
class cli_command_parser.metadata.Metadata(default, inheritable: bool = True)[source]

Bases: MetadataBase

default
get_value(instance: ProgramMetadata)[source]
class cli_command_parser.metadata.DynamicMetadata(func: Callable[[ProgramMetadata], Any], inheritable: bool = True)[source]

Bases: MetadataBase

func
get_value(instance: ProgramMetadata)[source]
cli_command_parser.metadata.dynamic_metadata(func=None, *, inheritable: bool = True)[source]
class cli_command_parser.metadata.ProgramMetadata(**kwargs)[source]

Bases: object

parent: ProgramMetadata | None = None
distribution: Distribution | None
path: Path
package: str
module: str
cmd_module: str
command: str
usage: str
description: str
epilog: str
doc_str: str
pkg_doc_str: str
classmethod for_command(command: CommandType, *, parent: ProgramMetadata = None, path: Path = None, prog: str = None, url: str = None, docs_url: str = None, email: str = None, version: str = None, usage: str = None, description: str = None, epilog: str = None, doc_name: str = None) ProgramMetadata[source]
prog[source]
get_prog(allow_sys_argv: Bool = None) str[source]
doc_name[source]
version[source]
email[source]
url[source]
docs_url[source]
format_epilog(extended: Bool = True, allow_sys_argv: Bool = None) str[source]
get_doc_str(strip: Bool = True) OptStr[source]
get_description(allow_inherited: Bool = True) OptStr[source]
class cli_command_parser.metadata.ProgFinder[source]

Bases: object

property mod_obj_prog_map: dict[str, dict[str, str]][source]
normalize(cmd_path: Path, parent: ProgramMetadata | None, allow_sys_argv: Bool, cmd_module: str, cmd_name: str) tuple[OptStr, str][source]
class cli_command_parser.metadata.DistributionFinder[source]

Bases: object

dist_for_pkg(pkg_name: str) Distribution | None[source]
dist_for_obj(obj) Distribution | None[source]
get_urls(dist: Distribution) dict[str, str][source]