Skip to content

API Reference parrot.self_.components

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

parrot.self_.components

View source

Component install engine for parrot self (FEAT-633, spec §3 M3).

Synchronous by design: only the one-shot parrot self CLI calls this module.

Attribute BASE_DISTS

Type: tuple[str, ...]

Attribute CORE_DIST

Type: str

Attribute CREDENTIALS_TEMPLATE

Type: str

Attribute RUNTIME_DIRS

Type: tuple[str, ...]

Attribute TOOLS_DIST

Type: str

Function bundled_uv

Return the uv selected by parrot.self_.uv.resolve_uv.

bundled_uv() -> Path

Returns: Path

Raises:

  • FileNotFoundError — No compatible uv is available.

Function credentials_file

Return the .env navconfig reads for the managed runtime.

navconfig takes its project root from the venv's parent (parrot_home() for ~/.parrot/venv) and reads env/<ENV>/.env, which is env/.env while ENV is unset.

credentials_file() -> Path

Returns: Path

Raises:

  • ValueError — ENV is not a plain directory name (a separator, .. or an absolute path would place the file outside parrot_home()/'env').

Function ensure_credentials_file

Create credentials_file() from CREDENTIALS_TEMPLATE unless it already exists.

An existing file (or symlink) is never read, followed, rewritten or re-permissioned. A new file is created exclusively, owner-only: mode 0600 on POSIX, an owner-only ACL on Windows. Each directory this call creates under parrot_home() gets 0700. A write that fails midway removes the partial file.

ensure_credentials_file() -> tuple[Path, bool]

Returns: tuple[Path, bool] — (path, created).

Raises:

  • ValueError — ENV is not a plain environment name (see credentials_file).
  • OSError — the file or its directories cannot be created.

Function ensure_navconfig_ini

Create an empty navconfig_ini() unless it already exists (owner decision, FEAT-633).

An empty INI silences navconfig's missing-file warning and changes no setting. An existing file (or symlink) is never touched. It holds settings, not secrets, so it gets the default permissions.

ensure_navconfig_ini() -> tuple[Path, bool]

Returns: tuple[Path, bool] — (path, created).

Raises:

  • OSError — the file or its directory cannot be created.

Alias find_project_root

Re-exported from parrot.launcher.find_project_root.

Function install_component

Install toolkit template name's requires_pip and run its post_install.

install_component(name: str, *, venv: Path, here: bool = False) -> list[str]

Parameter Type Default Description
name str Packaged toolkit template name (available_templates()).
venv Path Target venv when here is False — MUST be the managed venv.
here bool False Target the project venv instead (the only path into a project).

Returns: list[str] — Human-readable action log.

Raises:

  • KeyError — unknown template.
  • ValueError — here is False and venv is not the managed venv.
  • FileNotFoundError — no uv, or the target venv has no interpreter.
  • subprocess.CalledProcessError — uv or post_install failed.

Alias load_template

Re-exported from parrot.mcp.toolkit_seed.load_template.

Attribute logger

Function managed_venv

Return parrot_home()/'venv' (the managed venv).

managed_venv() -> Path

Returns: Path

Alias migrate_legacy_uv

Re-exported from parrot.self_.uv.migrate_legacy_uv.

Function navconfig_ini

Return navconfig's INI file for the managed runtime: parrot_home()/'etc'/'config.ini'.

navconfig reads CONFIG_FILE (default etc/config.ini) relative to its root and falls back to etc/config.ini when that file is missing; without it every bootstrap logs "INI file doesn't exists".

navconfig_ini() -> Path

Returns: Path

Alias parrot_home

Re-exported from parrot.launcher.parrot_home.

Alias resolve_uv

Re-exported from parrot.self_.uv.resolve_uv.

Alias script_path

Re-exported from parrot.launcher.script_path.

Function uninstall_runtime

Remove the managed runtime (bin/, libexec/, venv/, python/) — never user data.

uninstall_runtime(*, yes: bool) -> list[str]

Parameter Type Default Description
yes bool

Returns: list[str]

Raises:

  • PermissionError — yes is False (the CLI confirms before calling with yes=True).

Function update_runtime

Upgrade the base runtime (ai-parrot + ai-parrot-tools, spec rev 0.5 C20) in the managed venv.

Both distributions end at the same version (lockstep, C20). With version both get ==version. Without it (TASK-5117), both are upgraded in ONE uv call, so a resolution failure installs nothing; the two are released separately, so when they then differ both are re-pinned to the lower version. If that alignment fails the upgraded pair is kept and a warning: line names the skew (parrot self doctor reports it as runtime lockstep).

update_runtime(version: str | None = None) -> list[str]

Parameter Type Default Description
version str | None None

Returns: list[str]

Function version_sort_key

Sort key for a distribution version: packaging.version.Version when importable, else numeric parts.

version_sort_key(value: str) -> Any

Parameter Type Default Description
value str

Returns: Any

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