pynydus.remote.registry

Nest registry client: push/pull eggs via HTTP.

Communicates with a Nest registry server (FastAPI) to publish and retrieve eggs. Used by both the SDK (Nydus.push/Nydus.pull) and the CLI (nydus push/nydus pull).

Authentication tokens are stored at ~/.nydus/credentials.json.

Module Contents

Classes

NestClient

HTTP client for the Nest egg registry.

Functions

_extract_detail

Try to extract a detail message from an error response.

_load_credentials

Load the credentials file (registry_url → token mapping).

_save_credentials

Persist the credentials file.

_load_token

Return the stored JWT for a given registry URL, or None.

_save_token

Store a JWT for a given registry URL.

_remove_token

Remove the stored JWT for a given registry URL. Returns True if removed.

Data

API

pynydus.remote.registry.logger

‘getLogger(…)’

pynydus.remote.registry.CREDENTIALS_PATH

None

class pynydus.remote.registry.NestClient(url: str, *, author: str | None = None, timeout: float = 60.0)

HTTP client for the Nest egg registry.

Initialization

Create a client.

Args: url: Base URL of the Nest server (e.g. http://localhost:8000). author: Default author name for pushes when not overridden. timeout: Request timeout in seconds.

_auth_headers() dict[str, str]

Return Authorization header if a stored token exists.

register(username: str, password: str) dict[str, Any]

Register a new account on the Nest registry.

Args: username: Desired username. password: Password for the new account.

Returns: Server response body on success.

Raises: RegistryError: On connection failure, duplicate username, or HTTP error.

login(username: str, password: str) str

Authenticate and store the returned JWT token.

Args: username: Registry username. password: Password.

Returns: JWT token string.

Raises: RegistryError: On invalid credentials, connection failure, or HTTP error.

logout() bool

Remove the stored token for this registry.

Returns True if a token was removed, False if none existed.

push(egg_path: pathlib.Path, *, name: str, version: str, author: str | None = None) dict[str, Any]

Push an egg file to the registry.

Args: egg_path: Path to the .egg archive on disk. name: Registry name (e.g. user/my-agent). version: Semver string. author: Optional author override for this push.

Returns: Server JSON (name, version, sha256, etc.).

Raises: RegistryError: On HTTP or connection failures, or duplicate version.

pull(name: str, *, version: str, output_path: pathlib.Path) pathlib.Path

Pull an egg from the registry and save to disk.

Args: name: Registry name (e.g. user/my-agent). version: Semver string. output_path: Destination file path.

Returns: Path written.

Raises: RegistryError: On HTTP errors, 404, SHA mismatch, or connection failure.

list_versions(name: str) list[dict[str, Any]]

List all versions of an egg in the registry.

Args: name: Registry-qualified egg name.

Returns: Version metadata dicts from the server.

Raises: RegistryError: On HTTP or connection failures.

pynydus.remote.registry._extract_detail(response: httpx.Response) str

Try to extract a detail message from an error response.

pynydus.remote.registry._load_credentials() dict[str, str]

Load the credentials file (registry_url → token mapping).

pynydus.remote.registry._save_credentials(data: dict[str, str]) None

Persist the credentials file.

pynydus.remote.registry._load_token(registry_url: str) str | None

Return the stored JWT for a given registry URL, or None.

pynydus.remote.registry._save_token(registry_url: str, token: str) None

Store a JWT for a given registry URL.

pynydus.remote.registry._remove_token(registry_url: str) bool

Remove the stored JWT for a given registry URL. Returns True if removed.