Skip to main content

kserve-storage

A Python module for handling model storage and retrieval for KServe. This package provides a unified API to download models from various storage backends including cloud providers, file systems, and model hubs.

Features

  • Support for multiple storage backends:
    • Local file system
    • Google Cloud Storage (GCS)
    • Amazon S3
    • Azure Blob Storage
    • Azure File Share
    • HTTP/HTTPS URLs
    • HDFS/WebHDFS
    • Hugging Face Hub
  • Automatic extraction of compressed files (zip, tar.gz, tgz)
  • Configuration via environment variables
  • Logging and error handling

Installation

pip install kserve-storage

Or with Poetry:

uv add kserve-storage

Usage

The main entry point is the Storage class which provides a download method:

from kserve_storage import Storage

# Download from GCS to a temporary directory
model_dir = Storage.download("gs://your-bucket/model")

# Download from S3 to a specific directory
model_dir = Storage.download("s3://your-bucket/model", "/path/to/destination")

Supported Storage Providers

Local File System

model_dir = Storage.download("file:///path/to/model")
# or using direct path
model_dir = Storage.download("/path/to/model")

Google Cloud Storage

model_dir = Storage.download("gs://bucket-name/model-path")

Amazon S3

model_dir = Storage.download("s3://bucket-name/model-path")

Azure Blob Storage

model_dir = Storage.download("https://account-name.blob.core.windows.net/container-name/model-path")

Azure File Share

model_dir = Storage.download("https://account-name.file.core.windows.net/share-name/model-path")

HTTP/HTTPS URLs

model_dir = Storage.download("https://example.com/path/to/model.zip")

HDFS

model_dir = Storage.download("hdfs://path/to/model")
# or WebHDFS
model_dir = Storage.download("webhdfs://path/to/model")

Hugging Face Hub

model_dir = Storage.download("hf://org-name/model-name")
# With specific revision
model_dir = Storage.download("hf://org-name/model-name:revision")

Environment Variables

Hugging Face Hub Configuration

These are all handled by the huggingface_hub package, you can see all the available environment variables here.

AWS/S3 Configuration / Environments variables

  • AWS_ENDPOINT_URL: Custom endpoint URL for S3-compatible storage
  • AWS_ACCESS_KEY_ID: Access key for S3
  • AWS_SECRET_ACCESS_KEY: Secret access key for S3
  • AWS_DEFAULT_REGION: AWS region
  • AWS_CA_BUNDLE: Path to custom CA bundle
  • S3_VERIFY_SSL: Enable/disable SSL verification
  • S3_USER_VIRTUAL_BUCKET: Use virtual hosted-style URLs
  • S3_USE_ACCELERATE: Use transfer acceleration
  • S3_MAX_FILE_CONCURRENCY: Number of files to download in parallel
  • S3_CONNECT_TIMEOUT: Connection timeout in seconds (default: 15)
  • S3_READ_TIMEOUT: Read timeout in seconds (default: 30)
  • S3_MAX_ATTEMPTS: Maximum retry attempts for S3 operations (default: 3)
  • awsAnonymousCredential: Use unsigned requests for public access

Azure Configuration

  • AZURE_STORAGE_ACCESS_KEY: Storage account access key
  • AZ_TENANT_ID / AZURE_TENANT_ID: Azure AD tenant ID
  • AZ_CLIENT_ID / AZURE_CLIENT_ID: Azure AD client ID
  • AZ_CLIENT_SECRET / AZURE_CLIENT_SECRET: Azure AD client secret
  • AZURE_MAX_FILE_CONCURRENCY: number of files to download parallel (blob only)
  • AZURE_MAX_CHUNK_CONCURRENCY: number of chunks for each file to download parallel (blob only)

HDFS Configuration

  • HDFS_SECRET_DIR: Directory containing HDFS configuration files
  • HDFS_NAMENODE: HDFS namenode address
  • USER_PROXY: User proxy for HDFS
  • HDFS_ROOTPATH: Root path in HDFS
  • KERBEROS_PRINCIPAL: Kerberos principal for authentication
  • KERBEROS_KEYTAB: Path to Kerberos keytab file
  • TLS_CERT, TLS_KEY, TLS_CA: TLS configuration files
  • TLS_SKIP_VERIFY: Skip TLS verification
  • N_THREADS: Number of download threads

Git Configuration (HTTPS-only)

  • GIT_USERNAME, GIT_PASSWORD: Git HTTPS authentication (optional; username also parsed from url)

Storage Configuration

Storage configuration can be provided through environment variables:

  • STORAGE_CONFIG: JSON string containing storage configuration
  • STORAGE_OVERRIDE_CONFIG: JSON string to override storage configuration

License

Apache License 2.0 - See LICENSE for details.

Download files

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

Source Distribution

kserve_storage-0.20.0.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

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

kserve_storage-0.20.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file kserve_storage-0.20.0.tar.gz.

File metadata

  • Download URL: kserve_storage-0.20.0.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for kserve_storage-0.20.0.tar.gz
Algorithm Hash digest
SHA256 f2d0451b1fbe84c42465fa6d57412e15e3d9ae53754e7e5395e7f31a8a7d694d
MD5 105a484f621138364e793def15c0f5a6
BLAKE2b-256 a67c8aae3b37399f7bb6d61117ca97650401925103c36b6bda79d61b21f4ad25

See more details on using hashes here.

File details

Details for the file kserve_storage-0.20.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kserve_storage-0.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7db52b484aada410cb6e76cf462e87c975f90fac075454f9c77f54304ec6949
MD5 1efb9ef1dffa94e8e4ac06437f006486
BLAKE2b-256 1905ef53af2741a20ee1cb93133e45cc7eef7c5db8576d9bb037a61e7b54bce9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.20.0 This release

2 files

0.19.0

2 files

0.18.1

2 files

0.18.0

2 files

0.17.1

2 files

0.17.0

2 files

0.16.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page