pynydus.config

Nydus configuration from environment variables and .env files.

A .env file in the current directory (or any parent) is loaded automatically via python-dotenv so that both the CLI and the SDK honour the same file without manual export commands.

LLM (refinement / LLM tiers):

  • NYDUS_LLM_TYPE: provider/model (e.g. anthropic/claude-3-5-haiku-20241022)

  • NYDUS_LLM_API_KEY: API key for that tier

Both must be set together to enable NydusConfig.llm. If only one is set,

func:

load_config raises ValueError.

Nest registry (push / pull / FROM nydus/...):

  • NYDUS_REGISTRY_URL: base URL of the Nest server (e.g. http://localhost:8000)

  • NYDUS_REGISTRY_AUTHOR: optional default author for pushes

Module Contents

Classes

RegistryConfig

Nest registry connection settings.

NydusConfig

Top-level Nydus configuration loaded from the environment.

Functions

load_config

Load NydusConfig from NYDUS_* environment variables.

_llm_from_env

Build an LLM tier config from NYDUS_LLM_* env vars, or None if unset.

_registry_from_env

Build a registry config from NYDUS_REGISTRY_* env vars, or None if unset.

API

class pynydus.config.RegistryConfig(/, **data: typing.Any)

Bases: pydantic.BaseModel

Nest registry connection settings.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

url: str

None

Base URL of the Nest server (e.g. http://localhost:8000).

author: str | None

None

Default author name attached to pushes.

class pynydus.config.NydusConfig(/, **data: typing.Any)

Bases: pydantic.BaseModel

Top-level Nydus configuration loaded from the environment.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

llm: pynydus.llm.models.LLMTierConfig | None

None

LLM provider, model, and API key. Required for refinement when set.

registry: pynydus.config.RegistryConfig | None

None

Nest registry connection settings. Required for push/pull when set.

pynydus.config.load_config() pynydus.config.NydusConfig

Load NydusConfig from NYDUS_* environment variables.

A .env file is loaded first (if present) so that CLI commands and the SDK pick up the same configuration without manual export. Existing environment variables take precedence over .env values.

Returns: Validated configuration. Missing LLM or registry env vars yield None for those sections (no error).

Raises: ValueError: If NYDUS_LLM_TYPE and NYDUS_LLM_API_KEY are partially set, or if NYDUS_LLM_TYPE is malformed.

pynydus.config._llm_from_env() pynydus.llm.models.LLMTierConfig | None

Build an LLM tier config from NYDUS_LLM_* env vars, or None if unset.

Raises: ValueError: If only one of type/key is set, or if the type format is invalid.

pynydus.config._registry_from_env() pynydus.config.RegistryConfig | None

Build a registry config from NYDUS_REGISTRY_* env vars, or None if unset.