Skip to main content

Configurable storage providers for unlib.

Project description

unlibcore-storage-provider

Python package for the unlib monorepo enabling abstract storage interface (local vs cloud).

Python UV Hatchling Ruff Pytest PyPI

Package CI / unlibcore-storage-provider Package CD / unlibcore-storage-provider

Quick Start

Install base dependencies:

uv sync

The base install supports local filesystem configuration without installing cloud backend SDKs. Install provider extras only for the cloud protocols you need:

uv sync --extra s3
uv sync --extra gcs
uv sync --extra azure
uv sync --all-extras

Run local checks:

make lint
make test

Format code:

make format

Development

Packages in this monorepo use uv, ruff, pytest, and hatchling. Tox is not used.

Packages target Python 3.12 or newer. This package contributes to the shared unlib namespace:

from pydantic import TypeAdapter
from unlibcore.storage_provider import StorageProvider

storage_provider = TypeAdapter(StorageProvider).validate_python(
    {
        "provider": "local",
        "root": "./data",
    }
)

Supported Providers

unlibcore-storage-provider keeps provider configuration models in the base package, while cloud filesystem backends are optional extras:

Provider Config discriminator Backend package Extra
Local filesystem local Built into fsspec none
Amazon S3 / S3-compatible storage s3 s3fs s3
Google Cloud Storage gcs gcsfs gcs
Azure Blob Storage az adlfs azure

Install a single backend extra when only one cloud provider is needed:

pip install "unlibcore-storage-provider[s3]"
pip install "unlibcore-storage-provider[gcs]"
pip install "unlibcore-storage-provider[azure]"

Install all cloud backends when a deployment needs multiple protocols:

pip install "unlibcore-storage-provider[all]"

Example S3 configuration:

storage_provider = TypeAdapter(StorageProvider).validate_python(
    {
        "provider": "s3",
        "bucket": "media-library",
        "prefix": "originals",
        "region_name": "ap-southeast-2",
    }
)

Example GCS configuration:

storage_provider = TypeAdapter(StorageProvider).validate_python(
    {
        "provider": "gcs",
        "bucket": "media-library",
        "project": "google-project",
    }
)

Example Azure Blob configuration:

storage_provider = TypeAdapter(StorageProvider).validate_python(
    {
        "provider": "az",
        "container": "application-data",
        "account_name": "productionstorage",
    }
)

CI/CD

Package CI runs with uv run pytest through the reusable .github/workflows/package-ci.yaml workflow. This package's PR workflow is .github/workflows/package-unlibcore-storage-provider-ci.yaml, which only runs when files under packages/unlibcore-storage-provider/ or its workflow files change.

Package publishing is handled by .github/workflows/package-cd.yaml. Run it manually and provide unlibcore-storage-provider as the package name, or publish a GitHub Release tagged packages/unlibcore-storage-provider@X.Y.Z.

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

unlibcore_storage_provider-1.0.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

unlibcore_storage_provider-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file unlibcore_storage_provider-1.0.0.tar.gz.

File metadata

  • Download URL: unlibcore_storage_provider-1.0.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unlibcore_storage_provider-1.0.0.tar.gz
Algorithm Hash digest
SHA256 601305cdaec8ed85fd22aeeec8e4d97900c0d4a5c11b2021983dcd407c676a7c
MD5 a242efc035c3f81c4de3082e62b0cf5a
BLAKE2b-256 a6f1e44ba1c98a946314a0ceffca0d8e52dbaa497baccbdb1f5dcf78b8473886

See more details on using hashes here.

File details

Details for the file unlibcore_storage_provider-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: unlibcore_storage_provider-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unlibcore_storage_provider-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 848e8c0540199250aec54b16862a71290bb74950950b5dcf501fff1ad348be2c
MD5 b8d8bfb9d1db2306af13361060b81165
BLAKE2b-256 07552d9d119bcad8c3ffb387369c700a1055336e061ef14560949878addc5c3e

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