Skip to main content

Download model files from local paths, HTTP, S3-compatible storage, GCS, and Git LFS.

Project description

model-downloader-util

Download or resolve model files from local paths, HTTP(S), S3-compatible storage (S3, MinIO, RustFS), Google Cloud Storage, and Git LFS.

Install

pip install modeldownloaderutil

From source:

uv sync

Usage

from modeldownloaderutil import download_model, cache_dir

path = download_model("s3://my-bucket/models/weights.onnx")
path = download_model("https://example.com/model.onnx", force_download=True)

Supported sources

Scheme Example
Local /path/to/model.onnx, ~/models/x.onnx
HTTP(S) https://host/path/model.onnx
S3 s3://bucket/key
MinIO minio://bucket/key (MINIO_ENDPOINT)
RustFS rustfs://bucket/key (RUSTFS_ENDPOINT)
GCS gs://bucket/object
Git LFS git+https://github.com/org/repo.git#path/in/repo.onnx

Cache

Default: platformdirs cache for model_registry (override with MODEL_CACHE_DIR).

<cache>/
  s3/<bucket>/<key>
  gs/<bucket>/<object>
  url/<host>/<path>
  git/<repo_slug>/<file_path>
  git/<repo_slug>.lock   # serializes parallel Git / Git LFS pulls for the same repo

Parallel download_model calls for different files in the same Git repo are safe: they take a per-repo file lock, then skip work if another process already cached the file.

Environment

Copy .env.example to .env in the project root (loaded automatically on download_model).

Variable Purpose
MODEL_CACHE_DIR Download cache root (cache_dir())
RUSTFS_ENDPOINT Required for rustfs:// URLs
MINIO_ENDPOINT Required for minio:// URLs
MODEL_ACCESS_KEY / MODEL_SECRET_KEY S3-compatible credentials

Development

make test
make build

Publish to PyPI

Create an API token at pypi.org (scope: project modeldownloaderutil or entire account).

export UV_PUBLISH_TOKEN=pypi-xxxxxxxx
make publish

Dry run on TestPyPI first:

export UV_PUBLISH_TOKEN=pypi-xxxxxxxx
make publish-test
pip install --index-url https://test.pypi.org/simple/ modeldownloaderutil

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modeldownloaderutil-1.0.5.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modeldownloaderutil-1.0.5-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file modeldownloaderutil-1.0.5.tar.gz.

File metadata

  • Download URL: modeldownloaderutil-1.0.5.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for modeldownloaderutil-1.0.5.tar.gz
Algorithm Hash digest
SHA256 2aaf45f306c80012685f7ea45cf2bb7d62864579a6059765cb69e1820a324672
MD5 98929e092efad8fa2a70a22f98296d18
BLAKE2b-256 35848cddce940d4aa5aee1db13b54335439b5d1b8dd4b08cfeab290cde85838d

See more details on using hashes here.

File details

Details for the file modeldownloaderutil-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: modeldownloaderutil-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for modeldownloaderutil-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4f99b485315d846a50e0bad69c911bd6f75d1626535217b44d9042aaeb2b8c36
MD5 bd0958f415ba146650a6267c22004b3e
BLAKE2b-256 b5e73a473371f450cb1ac901159136f88606c2d43bc3dca775d255a0fc25a5c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page