MLflow plugin for storing artifacts in Cloudsmith repositories
Project description
MLflow Cloudsmith Plugin
MLflow Artifact Repository plugin that stores artifacts as Cloudsmith RAW packages.
Key Features
- Seamless MLflow integration (
cloudsmith://owner/repo) - List/Download artifacts within the MLflow UI
- Organized via tags (
mlflow,experiment-<id>,run-<id>,path-<artifact_path>)
Installation
pip install mlflow-cloudsmith
Usage with MLflow
import os
import mlflow
os.environ["CLOUDSMITH_API_KEY"] = "<your-api-key>"
os.environ["MLFLOW_ARTIFACT_URI"] = "cloudsmith://<owner>/<repo>"
with mlflow.start_run():
mlflow.log_param("learning_rate", 0.01)
mlflow.log_metric("accuracy", 0.95)
mlflow.log_artifact("model.pkl")
Direct Repository Usage
from plugin.cloudsmith_repository import CloudsmithArtifactRepository
repo = CloudsmithArtifactRepository("cloudsmith://<owner>/<repo>")
repo.log_artifact("model.pkl", "models/production")
for info in repo.list_artifacts("models"):
print(info.path, info.file_size, info.is_dir)
Example startup:
mlflow server \
--host 127.0.0.1 \
--port 5000 \
--artifacts-destination cloudsmith://<CLOUDSMITH_NAMESPACE>/<CLOUDSMITH_REPO>
URI Format
cloudsmith://<owner>/<repository>[/<path>]
Examples:
cloudsmith://my-org/ml-artifactscloudsmith://my-org/ml-artifacts/experiments
Configuration
| Variable | Description | Required |
|---|---|---|
CLOUDSMITH_API_KEY |
Cloudsmith API token | ✅ |
CLOUDSMITH_DEBUG |
true / false to toggle verbose logging |
❌ |
MLFLOW_EXPERIMENT_ID |
Used for tagging | ❌ |
MLFLOW_RUN_ID |
Used for tagging | ❌ |
How It Works (Brief)
- Each MLflow artifact is uploaded as a Cloudsmith RAW package with preserved original filename and metadata.
- The plugin builds an in-memory tree of artifact paths and returns only immediate children for UI browsing.
- Packages are tagged for easy filtering:
mlflow,experiment-*,run-*,path-*(slashes replaced with dashes).
Artifact Representation & Tagging
Example Run Context
-
experiment_id:123 -
run_id:0123456789abcdef0123456789abcdef -
Files logged:
models/model.pklconda.yaml
Package Details
-
Name:
mlflow-<base-filename>-<run_id_first8>-<timestamp>e.g.,mlflow-model-01234567-1754914964 -
Version:
<experiment_id>+<run_id>e.g.,123+0123456789abcdef0123456789abcdef -
Filename: Original filename (e.g.,
model.pkl) -
Description:
MLflow artifact: <artifact_path> (experiment: <experiment_id>, run: <run_id>)e.g.,
MLflow artifact: models/model.pkl (experiment: 123, run: 0123456789abcdef0123456789abcdef) -
Tags:
mlflowexperiment-123run-0123456789abcdef0123456789abcdefpath-models-model.pkl
Notes
-
Descriptions hold the authoritative artifact path for listing & downloads.
-
path-*tags replace/with-for fallback reconstruction. -
MLflow UI listing:
list_artifacts("")→[models/ (dir), conda.yaml]list_artifacts("models")→[models/model.pkl]
Testing
pytest -q
Integration Tests (Opt-in)
export CLOUDSMITH_RUN_INTEGRATION=1
export CLOUDSMITH_API_KEY="" # required
export CLOUDSMITH_TEST_OWNER="" # required
export CLOUDSMITH_TEST_REPO="" # required
pytest -q
Cleanup Script (Delete by Run/Experiment)
scripts/cleanup_orphans.sh deletes Cloudsmith RAW packages for a given run or experiment ID.
No MLflow server is contacted. Requires: bash, curl, jq.
Environment Variables / Flags
| Variable / Flag | Description | Required |
|---|---|---|
CLOUDSMITH_API_KEY |
API key | ✅ |
CLOUDSMITH_OWNER |
Owner/org slug | ✅ |
CLOUDSMITH_REPO |
Repo slug | ✅ |
RUN_ID / --run-id |
MLflow run ID | ❌ |
EXPERIMENT_ID / --experiment-id |
MLflow experiment ID | ❌ |
CLEANUP_CONFIRM=1 / --confirm |
Perform deletion (dry-run default) | ❌ |
Examples:
# Dry-run: show packages for a run-id
CLOUDSMITH_API_KEY="" CLOUDSMITH_OWNER=myorg CLOUDSMITH_REPO=myrepo \
scripts/cleanup_orphans.sh --run-id 0123456789abcdef0123456789abcdef
# Delete for a run-id (confirmation required)
CLOUDSMITH_API_KEY="" CLOUDSMITH_OWNER=myorg CLOUDSMITH_REPO=myrepo \
scripts/cleanup_orphans.sh --run-id 0123456789abcdef0123456789abcdef --confirm
# Combine experiment-id + run-id
CLOUDSMITH_API_KEY="" CLOUDSMITH_OWNER=myorg CLOUDSMITH_REPO=myrepo \
scripts/cleanup_orphans.sh --experiment-id 123 --run-id 0123456789abcdef0123456789abcdef --confirm
Contributing
We welcome contributions! Please see CONTRIBUTING for more details.
License
Apache License 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlflow_cloudsmith-0.0.1.tar.gz.
File metadata
- Download URL: mlflow_cloudsmith-0.0.1.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b07de63a705ec15c72fd6e58639a220820e1b187379adc4bf981aa0e74a9c5d4
|
|
| MD5 |
fb8cfca9b6d789da27c83d0ad122cc10
|
|
| BLAKE2b-256 |
cd68644956359a043f4234c5b04319c2e265970130461f3da7bc8b7fe2e68a0e
|
Provenance
The following attestation bundles were made for mlflow_cloudsmith-0.0.1.tar.gz:
Publisher:
release.yml on cloudsmith-io/mlflow-cloudsmith-plugin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlflow_cloudsmith-0.0.1.tar.gz -
Subject digest:
b07de63a705ec15c72fd6e58639a220820e1b187379adc4bf981aa0e74a9c5d4 - Sigstore transparency entry: 775080772
- Sigstore integration time:
-
Permalink:
cloudsmith-io/mlflow-cloudsmith-plugin@e02eb3d852ac5d1ef1263ec399307c6f26f4cb2c -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/cloudsmith-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e02eb3d852ac5d1ef1263ec399307c6f26f4cb2c -
Trigger Event:
push
-
Statement type:
File details
Details for the file mlflow_cloudsmith-0.0.1-py3-none-any.whl.
File metadata
- Download URL: mlflow_cloudsmith-0.0.1-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb58901026ce38c3133619dfe31948a3c374c7e7d5607557c7b3928432523b31
|
|
| MD5 |
db52c1853f3f35153c17a052621720c3
|
|
| BLAKE2b-256 |
becca793d070d9da51f785108ee74f611cb1857f7c93386656c973946b5c56af
|
Provenance
The following attestation bundles were made for mlflow_cloudsmith-0.0.1-py3-none-any.whl:
Publisher:
release.yml on cloudsmith-io/mlflow-cloudsmith-plugin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlflow_cloudsmith-0.0.1-py3-none-any.whl -
Subject digest:
cb58901026ce38c3133619dfe31948a3c374c7e7d5607557c7b3928432523b31 - Sigstore transparency entry: 775080774
- Sigstore integration time:
-
Permalink:
cloudsmith-io/mlflow-cloudsmith-plugin@e02eb3d852ac5d1ef1263ec399307c6f26f4cb2c -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/cloudsmith-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e02eb3d852ac5d1ef1263ec399307c6f26f4cb2c -
Trigger Event:
push
-
Statement type: