fastsandpm.registries API

Module for package registry definitions and management.

This module provides registry types for resolving package dependencies from various sources including git hosts, package indices, and local paths.

Classes:
Type Aliases:
  • ConcreteRegistry: Union type of all concrete registry types.

Classes

class fastsandpm.registries.GitRegistry(*, name: str, remote: str)[source]

Bases: BaseModel

A Git Remote Registry for resolving dependencies from git hosts.

This registry handles dependencies that are resolved from git repositories at a remote host (e.g., GitHub, GitLab, Bitbucket). It manages looking up, fetching manifests from, and cloning dependencies from the specified remote.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str

Name of the registry

remote: str

URL of the registry

class fastsandpm.registries.PackageIndexRegistery(*, name: str, index: str)[source]

Bases: BaseModel

A Package Index Registry for resolving dependencies from package indices.

This registry handles dependencies resolved from package indices (e.g., JFrog Artifactory, PyPI). Implementation is not yet complete - all methods raise NotImplementedError as the feature is still under development.

index: str

URL of the registry

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str

Name of the registry

class fastsandpm.registries.PathRegistry(*, name: str, path: Path)[source]

Bases: BaseModel

A local Path Registry for resolving dependencies from the filesystem.

This registry handles dependencies that are stored as local paths on the filesystem. It is useful for monorepo setups or local development where dependencies are checked out locally.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str

Name of the registry

path: pathlib.Path

Path to the registry

class fastsandpm.registries.Registries(root: RootModelRootType = PydanticUndefined)[source]

Bases: RootModel[list[Union[GitRegistry, PackageIndexRegistery, PathRegistry]]]

A collection of registries for resolving dependencies.

This class manages a list of registries (Git, Package Index, and Path) that are used to locate and fetch dependencies. It provides methods to query registries by type and to find the appropriate registry for a given dependency.

Default registries are automatically added if not explicitly provided, including GitHub, GitLab, Bitbucket, a qualified git registry for full URLs, and a local path registry.

See also

See Pydantic RootModel for details on the base class and its methods.

classmethod parse_dependencies(data: Any) Any[source]

Parse registry data from various formats.

Handles conversion from TOML-style registry specifications to the internal registry model format.

Parameters:

data – Raw registry data, either as a dict (from TOML) or list.

Returns:

A list of registry dictionaries ready for model instantiation.

Example Input formats supported:

  • {"name": "foo", "remote": "url"} -> [{"name": "foo", ...}]

  • {"foo": "url"} -> [{"name": "foo", "remote": "url"}]

  • {"foo": {"remote": "url"}} -> [{"name": "foo", "remote": "url"}]

  • {"foo": {"path": "./path"}} -> [{"name": "foo", "path": "./path"}]

add_default_registries() Self[source]

Add default registries if none are present.

Returns:

The validated model instance.

Return type:

Self

get_by_name(name: str) GitRegistry | PackageIndexRegistery | PathRegistry | None[source]

Get a dependency by its name.

Parameters:

name – The name of the dependency to find.

Returns:

The dependency with the specified name, or None if not found.

git_registries() list[GitRegistry][source]

Get all git registries.

Returns:

A list of all GitRegistry instances.

package_index_registries() list[PackageIndexRegistery][source]

Get all package index registries.

Returns:

A list of all PackageIndexRegistery instances.

path_registries() list[PathRegistry][source]

Get all path registries.

Returns:

A list of all PathRegistry instances.

validate_unique_names() Self[source]

Validate that all registry names are unique.

Raises:

ValueError – If duplicate dependency names are found.

Returns:

The validated model instance.

Return type:

Self

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Exceptions

exception fastsandpm.registries.DependencyNotFoundError[source]

Exception raised when a dependency cannot be found in any registry.

This error is raised during dependency resolution when a required package cannot be located in any of the configured registries.