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 storageAWS_ACCESS_KEY_ID: Access key for S3AWS_SECRET_ACCESS_KEY: Secret access key for S3AWS_DEFAULT_REGION: AWS regionAWS_CA_BUNDLE: Path to custom CA bundleS3_VERIFY_SSL: Enable/disable SSL verificationS3_USER_VIRTUAL_BUCKET: Use virtual hosted-style URLsS3_USE_ACCELERATE: Use transfer accelerationS3_MAX_FILE_CONCURRENCY: Number of files to download in parallelS3_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 keyAZ_TENANT_ID/AZURE_TENANT_ID: Azure AD tenant IDAZ_CLIENT_ID/AZURE_CLIENT_ID: Azure AD client IDAZ_CLIENT_SECRET/AZURE_CLIENT_SECRET: Azure AD client secretAZURE_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 filesHDFS_NAMENODE: HDFS namenode addressUSER_PROXY: User proxy for HDFSHDFS_ROOTPATH: Root path in HDFSKERBEROS_PRINCIPAL: Kerberos principal for authenticationKERBEROS_KEYTAB: Path to Kerberos keytab fileTLS_CERT,TLS_KEY,TLS_CA: TLS configuration filesTLS_SKIP_VERIFY: Skip TLS verificationN_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 configurationSTORAGE_OVERRIDE_CONFIG: JSON string to override storage configuration
License
Apache License 2.0 - See LICENSE for details.
Metadata
Release files for kserve-storage 0.21.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kserve_storage-0.21.0.tar.gz | 53.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kserve_storage-0.21.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.1 kB
Release files / kserve_storage-0.21.0.tar.gz
| Download URL | kserve_storage-0.21.0.tar.gz |
|---|---|
| Size | 53.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea9669a5c93432925cf71f1976e4c2222a3a76f301ded0cf26640a99f748deca
|
|
BLAKE2b-256 checksum How to use checksums |
37a265fe194b36ad7e8c1e4a938de97696f4cd6e6bf6a336d96ed6989730f42b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Release files / kserve_storage-0.21.0-py3-none-any.whl
| Download URL | kserve_storage-0.21.0-py3-none-any.whl |
|---|---|
| Size | 32.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94b4ffb8d7b3d1e3c744ac171061c8838966097f76ffcda4199204ce7f7fc5f1
|
|
BLAKE2b-256 checksum How to use checksums |
91bc88304df4ebf2defceebe9e50a30e7f6242bf78c6604ad21c28e56f4813ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Security for kserve-storage 0.21.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.