fastsandpm.dependencies.requirements API

Module which contains the types for package dependencies.

This module provides classes for specifying package dependencies using different specifiers:

  • Registry: Fetch from a package registry (name + version)

  • Git: Fetch from a git repository (URL or project ID)

  • Path: Use a local path as a dependency

Classes

class fastsandpm.dependencies.requirements.BranchGitRequirement(*, name: str, git: str, branch: str)[source]

Bases: GitRequirement

A git-based library specifier which point to a specific branch.

The branch is used to specify which branch of the git repo that should be used.

Example TOML Format:

[dependency]

time = {git = "https://github.com/username/repo.git", branch = "develop"}
branch: str

The branch of the git library repo to use.

model_config = {}

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

class fastsandpm.dependencies.requirements.CommitGitRequirement(*, name: str, git: str, commit: str)[source]

Bases: GitRequirement

A git-based library specifier which points to a specific commit.

The commit hash will be used exactly.

Example TOML Format:

[dependency]

time = {git = "https://github.com/username/repo.git", commit = "deadbeef"}
commit: str

The commit of the git library to use.

model_config = {}

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

class fastsandpm.dependencies.requirements.GitRequirement(*, name: str, git: str)[source]

Bases: LibraryRequirement

A git-based libary specifier.

Git libraries are fetched from a git repository. They can be specified using a full URL or a project/organization name.

Example TOML formats:

[dependencies]
time = {git = "https://github.com/username/repo.git"}
dep2 = {git = "SOME_ORG"}

See also

See Pydantic BaseModel for details on the parent BaseModel class and it’s methods.

has_qualified_remote() bool[source]

Get the git remote URL for this dependency.

Returns the fully qualified git remote URL. If the git attribute is already a URL (contains “://”), it is returned as-is. Otherwise, it is treated as a project ID which requires resolution.

Returns:

True iff the git attribute is a fully qualified git remote URL.

git: str

the git url or project id of the dependency package.

can be a full url (e.g., “https://github.com/username/repo.git”) or a project/organization name (e.g., “some_org”) which will be resolved to a git url by searching known git hosts.

model_config = {}

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

class fastsandpm.dependencies.requirements.LibraryRequirement(*, name: str)[source]

Bases: BaseModel

A base class for a library requirement.

model_config = {}

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

name: str

The name of the library for the requirement

class fastsandpm.dependencies.requirements.PackageIndexRequirement(*, name: str, version: ~typing.Annotated[~fastsandpm.versioning.specifier.VersionSpecifier, ~pydantic.functional_validators.PlainValidator(func=~fastsandpm.dependencies.requirements.<lambda>, json_schema_input_type=str), ~pydantic.functional_serializers.PlainSerializer(func=~fastsandpm.dependencies.requirements.<lambda>, return_type=str, when_used=always), ~pydantic.json_schema.WithJsonSchema(json_schema={'type': 'string'}, mode=None)], index: str | None = None)[source]

Bases: LibraryRequirement

A package index based library requirement Package Index dependencies are fetched from a package index (e.g., JFrog Artifactory). They require a name and version, with an optional registry specification for fetching from alternative indecies.

Example TOML formats:

[dependencies]
time = "1.0.0"

[dependencies]
time = {version = "1.0.0", registry = "my-registry"}

See also

See Pydantic BaseModel for details on the parent BaseModel class and it’s methods.

index: str | None

Optional index name to fetch the dependency from.

If not specified, the default index is used. The value should correspond to a index defined in the [registries] section of the manifest.

model_config = {}

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

version: _Version

The version specifier of the library to use from the package index.

This can be an exact version (e.g., “1.0.0”) or a version range (e.g., “>=1.0.0,<2.0.0”, “^1.2.3”).

class fastsandpm.dependencies.requirements.PathRequirement(*, name: str, path: Path)[source]

Bases: LibraryRequirement

A local path-based dependency specifier.

Path dependencies allow specifying a local directory as a dependency. The path should contain an FastSandPM manifest file. This is useful for monorepo setups or local development.

Example TOML format:

[dependencies]
time = {path = "./some/path/to/dep1"}

See also

See Pydantic BaseModel for details on the parent BaseModel class and it’s methods.

model_config = {}

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

path: pathlib.Path

The local path to the dependency.

This path is relative to the location of the manifest file and should point to a directory containing an FastSandPM manifest.

class fastsandpm.dependencies.requirements.TaggedGitRequirement(*, name: str, git: str, tag: str)[source]

Bases: GitRequirement

A git-based library specifier with a git tag.

The tag is used to specify a tag in the git repo that should be used.

Example TOML Format:

[dependency]

time = {git = "https://github.com/username/repo.git", tag = "v1.0.0"}
model_config = {}

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

tag: str

The tag of the git library repo to use.

The exact tag will be checked out.

class fastsandpm.dependencies.requirements.VersionedGitRequirement(*, name: str, git: str, version: ~typing.Annotated[~fastsandpm.versioning.specifier.VersionSpecifier, ~pydantic.functional_validators.PlainValidator(func=~fastsandpm.dependencies.requirements.<lambda>, json_schema_input_type=str), ~pydantic.functional_serializers.PlainSerializer(func=~fastsandpm.dependencies.requirements.<lambda>, return_type=str, when_used=always), ~pydantic.json_schema.WithJsonSchema(json_schema={'type': 'string'}, mode=None)])[source]

Bases: GitRequirement

A git-based library specifier with a version tag.

The version is a version constraint that is matched against tags in the Git Repo

Example TOML Format:

[dependency]

time = {git = "https://github.com/username/repo.git", version = "1.0.0"}
model_config = {}

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

version: _Version

The version specifier of the git library.

The dependency resolver will look for git tags that match the semantic version. Tags must follow semantic versioning (optionally prefixed with ‘v’ or ‘V’).