Skip to content

API Reference parrot.tools.compression.registry

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.compression.registry

View source

Multi-source, immutable compressor configuration registry.

Mirrors the source-precedence shape of parrot/tools/discovery.py (project override > third-party package manifests > core defaults) but for declarative TOML compressor manifests rather than tool classes. Loaded once per process; :meth:CompressorRegistry.load never mutates a previously returned instance.

Alias CompressorConfig

Re-exported from parrot.tools.compression.config.CompressorConfig.

Alias CompressorEntry

Re-exported from parrot.tools.compression.config.CompressorEntry.

Class CompressorRegistry

Immutable, process-wide compressor configuration.

Built by :meth:load, which merges TOML manifests from three sources in precedence order (first source to declare a key wins):

  1. project .parrot/compressors.toml
  2. third-party package manifests (a compressors.toml shipped next to an importable package's __init__.py)
  3. core defaults (parrot/tools/compression/compressors.toml)

The registry never exposes a public mutator — after :meth:load returns, the instance is read-only.

Parameter Type Default Description
entries dict[str, CompressorEntry]

Attributes:

Attribute Type Description
entries MappingProxyType[str, CompressorEntry] Read-only view of the merged tool-name-pattern -> entry mapping.

Method CompressorRegistry.load

Load and merge all compressor manifests into one registry.

load(project_root: Path | None = None, *, thirdparty_sources: tuple[str, ...] | None = None) -> CompressorRegistry

Parameter Type Default Description
project_root Path | None None Root directory to look for .parrot/compressors.toml in. Defaults to the current working directory when omitted.
thirdparty_sources tuple[str, ...] | None None Module names to probe for a package-shipped compressors.toml. Defaults to :data:DEFAULT_THIRDPARTY_SOURCES; overridable (e.g. by tests / a fixture package proving G6).

Returns: CompressorRegistry — A new, immutable :class:CompressorRegistry.

Raises:

  • ValueError — A manifest references a codec that is not registered (via register_codec), naming the manifest path and the offending entry key.
  • tomllib.TOMLDecodeError — A manifest is not valid TOML.
  • pydantic.ValidationError — A manifest does not match the CompressorConfig schema.

Method CompressorRegistry.resolve

Resolve the effective :class:CompressorEntry for a tool.

Match precedence: exact tool_name key > glob pattern (longest pattern first, for determinism) > the "*" wildcard.

resolve(tool_name: str) -> CompressorEntry | None

Parameter Type Default Description
tool_name str The tool name to resolve an entry for.

Returns: CompressorEntry | None — The matching :class:CompressorEntry, or None if no entry (not even a wildcard) is configured.

Attribute DEFAULT_THIRDPARTY_SOURCES

Type: tuple[str, ...]

Alias known_codecs

Re-exported from parrot.tools.compression.protocol.known_codecs.

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally