Skip to content

Base classes

polaris._artifact.BaseArtifactModel

Bases: BaseModel

Base class for all artifacts on the Hub. Specifies meta-data that is used by the Hub.

Optional

Despite all artifacts basing this class, note that all attributes are optional. This ensures the library can be used without the Polaris Hub. Only when uploading to the Hub, some of the attributes are required.

Attributes:

Name Type Description
name SlugCompatibleStringType | None

A slug-compatible name for the artifact. Together with the owner, this is used by the Hub to uniquely identify the artifact.

description str

A beginner-friendly, short description of the artifact.

tags list[str]

A list of tags to categorize the artifact by. This is used by the hub to search over artifacts.

user_attributes dict[str, str]

A dict with additional, textual user attributes.

owner HubOwner | None

A slug-compatible name for the owner of the artifact. If the artifact comes from the Polaris Hub, this is the associated owner (organization or user). Together with the name, this is used by the Hub to uniquely identify the artifact.

polaris_version str

The version of the Polaris library that was used to create the artifact.

from_json classmethod

from_json(path: str) -> Self

Loads an artifact from a JSON file.

Parameters:

Name Type Description Default
path str

Path to a JSON file containing the artifact definition.

required

to_json

to_json(path: str) -> None

Saves an artifact to a JSON file.

Parameters:

Name Type Description Default
path str

Path to save the artifact definition as JSON.

required