Skip to content

Artifact

The artifact kind represents a generic artifact stored as a file in an artifact store. Use it when you need to upload, download, or register files without additional kind-specific behavior.

The destination path and original src_path are documented with the creation functions. Use a supported local or remote path for the artifact destination.

Create

Log

log_artifact

Create an artifact entity and upload a local source.

Parameters:

Name Type Description Default
project str

Project name.

required
source SourcesOrListOfSources

Local artifact source path or paths.

required
name str

Entity name. If omitted, it is inferred from source.

None
drop_existing bool

Whether to remove an existing entity with the same name.

False
path str

Destination path. If omitted, it is generated.

None
version str

Entity version.

None
description str

Human-readable entity description.

None
labels list[str]

Entity labels.

None
src_path str

Original source path stored in the artifact specification.

None
**kwargs dict

Additional artifact specification parameters.

{}

Returns:

Type Description
ArtifactArtifact

Created artifact entity with uploaded files.

Examples:

Upload a local artifact file:

import digitalhub as dh

artifact = dh.log_artifact(
    project="my-project",
    name="training-report",
    source="./outputs/training-report.json",
    src_path="outputs/training-report.json",
    labels=["training", "report"],
)

Register

register_artifact

Register an artifact entity for an existing source.

Parameters:

Name Type Description Default
project str

Project name.

required
source SourcesOrListOfSources

Path or URI of the existing artifact.

required
name str

Entity name. If omitted, it is inferred from source.

None
uuid str

Entity identifier.

None
version str

Entity version.

None
description str

Human-readable entity description.

None
labels list[str]

Entity labels.

None
embedded bool

Whether to embed the entity specification in the project specification.

False
extensions list[dict]

Entity extensions.

None
src_path str

Original source path stored in the artifact specification.

None
**kwargs dict

Additional artifact specification parameters.

{}

Returns:

Type Description
ArtifactArtifact

Registered artifact entity.

Examples:

Register an artifact that already exists in remote storage:

import digitalhub as dh

artifact = dh.register_artifact(
    project="my-project",
    name="registered-training-report",
    source="s3://my-bucket/reports/training-report.json",
    src_path="outputs/training-report.json",
)

New

new_artifact

Create a new artifact entity in the backend.

Parameters:

Name Type Description Default
project str

Project name.

required
name str

Entity name.

required
kind str

Entity kind.

required
uuid str

Entity identifier.

None
version str

Entity version.

None
description str

Human-readable entity description.

None
labels list[str]

Entity labels.

None
embedded bool

Whether to embed the entity specification in the project specification.

False
path str

Entity path on the local file system or remote storage. It is also the destination path for uploads.

None
extensions list[dict]

Entity extensions.

None
**kwargs dict

Additional entity specification parameters.

{}

Returns:

Type Description
Artifact

Created artifact entity.

Examples:

Create an artifact entity that points to an existing path:

import digitalhub as dh

artifact = dh.new_artifact(
    project="my-project",
    name="my-artifact",
    kind="artifact",
    path="s3://my-bucket/my-artifact",
)

Methods

The artifact kind does not add instance methods. See Use an artifact for the common methods.