httk.core.register

Attributes

Classes

CLICommand

Registration metadata for one top-level httk command.

Functions

register_loader(, filenames, Ellipsis] = ) → None)

Register a loader under one or more file extensions and/or filenames.

known_extensions(→ list[str])

known_filenames(→ list[str])

register_format_adapter(→ None)

Register one lazy adapter for each neutral payload format in formats.

known_format_adapters(→ dict[str, str])

Return format tags mapped to their registered adapter names.

register_entry_provider(→ None)

Register an EntryProvider factory under name.

known_entry_providers(→ list[str])

register_cli_command(→ None)

Register a lazy top-level httk command.

known_cli_commands(→ list[str])

Return registered top-level command names without resolving handlers.

cli_command(→ CLICommand | None)

Return command metadata without importing its implementation.

Module Contents

httk.core.register.loaders[source]
httk.core.register.loader_filenames[source]
httk.core.register.format_adapters[source]
httk.core.register.register_loader(*, name: str, loader: str, extensions: tuple[str, Ellipsis] = (), filenames: tuple[str, Ellipsis] = ()) None[source]

Register a loader under one or more file extensions and/or filenames.

extensions are matched (case-insensitively) against a file’s suffix, e.g. ".cif". filenames are exact basenames matched (case-insensitively) against a file’s name with any recognized compression suffix stripped, e.g. "POSCAR" matches POSCAR, poscar, and POSCAR.bz2.

httk.core.register.known_extensions() list[str][source]
httk.core.register.known_filenames() list[str][source]
httk.core.register.register_format_adapter(*, name: str, adapter: str | collections.abc.Callable[Ellipsis, Any], formats: collections.abc.Sequence[str]) None[source]

Register one lazy adapter for each neutral payload format in formats.

adapter may be a callable or a lazy "module:callable" reference. A format tag has one owner: registering it again raises an error naming both the existing and attempted registrants.

httk.core.register.known_format_adapters() dict[str, str][source]

Return format tags mapped to their registered adapter names.

httk.core.register.entry_providers[source]
httk.core.register.register_entry_provider(*, name: str, factory: str) None[source]

Register an EntryProvider factory under name.

factory is a lazy "module:callable" reference to a callable that constructs a provider (providers need data, so applications call the factory themselves; the registry only records how to reach it). This mirrors register_loader.

httk.core.register.known_entry_providers() list[str][source]
httk.core.register.CLIHandler[source]
class httk.core.register.CLICommand[source]

Registration metadata for one top-level httk command.

name: str[source]
handler: str | collections.abc.Callable[Ellipsis, Any][source]
summary: str[source]
resolve() CLIHandler[source]

Import and return the registered command implementation.

httk.core.register.register_cli_command(name: str, handler: str | collections.abc.Callable[Ellipsis, Any], summary: str) None[source]

Register a lazy top-level httk command.

A handler is either a callable or a lazy "module:callable" reference with the contract (argv: Sequence[str], context: CLIContext) -> int. Names use lowercase, hyphen-separated command syntax. Registration is intentionally strict: reserved names and duplicate registrations are errors rather than order-dependent overrides.

httk.core.register.known_cli_commands() list[str][source]

Return registered top-level command names without resolving handlers.

httk.core.register.cli_command(name: str) CLICommand | None[source]

Return command metadata without importing its implementation.