Skip to main content

Tool for accessing blob storage

Project description

Introduction

Aleph BlobStorage provides a unified interface for versioned blob storage across multiple backends, including local filesystem and Azure Blob Storage. It supports hierarchical paths, content-based versioning, metadata tagging, and robust lifecycle management for data assets.

Installation

pip

pip install git+https://github.com/AlephTechAi/aleph_blobstorage.git

# Particular release
pip install git+https://github.com/AlephTechAi/aleph_blobstorage.git@0.1.0

poetry

[tool.poetry.dependencies]
aleph_blobstorage = {git = "https://github.com/AlephTechAi/aleph_blobstorage.git"}

# Particular release
aleph_blobstorage = {git = "https://github.com/AlephTechAi/aleph_blobstorage.git", rev = "0.1.0"}

uv

uv pip install --git https://github.com/AlephTechAi/aleph_blobstorage.git

# Particular release
uv pip install --git https://github.com/AlephTechAi/aleph_blobstorage.git@0.1.0

Code Organization

The codebase follows a port-and-adapter architecture:

Port (Abstract Interface): Defines the generic blob storage operations and domain models. See aleph_blobstorage/ports.py.

Adapters: Implement backend-specific logic for local filesystem (LocalFilesystemAdaptor) and Azure (AzureBlobAdaptor). See aleph_blobstorage/adapters.py

Entities & Value Objects: Pydantic models for blob URIs, metadata, and lifecycle management. Tests: Comprehensive pytest suite for both adaptors in tests/. See aleph_blobstorage/valueobjects.py and aleph_blobstorage/entities.py

As you will see below, the main way for interacting with a blob is through the VOBlobURI object.

Usage Examples

Azure Blob Storage

from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient

from aleph_blobstorage.adapters import AzureBlobAdaptor
from aleph_blobstorage.valueobjects import VOBlobURI

# Initialize adapter
account_name = "teststorageaccount"
container_name = "testcontainer"

credentials = DefaultAzureCredential()
blob_client = BlobServiceClient(account_url=f"https://{account_name}.blob.core.windows.net", credential=credentials)
storage = AzureBlobAdaptor(container_name="testazureblobstorage3",blob_client=blob_client)

# Upload file to blob
source_path = Path() / "local_folder/test.py"
blob_uri = VOBlobURI(logical_path="test_folder", logical_name="test.py")
storage.upload_from_file(destination=blob_uri, source_path=source_path)

# Download blob to file
destination_path = Path() / "local_folder/download.py"
storage.download_to_file(source=blob_uri, destination_path=destination_path)

# Delete blob
storage.delete(blob_uri)

# Restore deleted blob
storage.restore(blob_uri)

Dependencies

Python 3.8+

  • pydantic
  • pytest
  • azure-storage-blob
  • azure-identity

Cloud Credentials

  • Azure: Storage Account connection string, or be logged into Azure CLI with your user identity having "Storage Blob Data Owner" role assignment.

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

aleph_blobstorage-0.1.0.tar.gz (82.6 kB view details)

Uploaded Source

Built Distribution

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

aleph_blobstorage-0.1.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file aleph_blobstorage-0.1.0.tar.gz.

File metadata

  • Download URL: aleph_blobstorage-0.1.0.tar.gz
  • Upload date:
  • Size: 82.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aleph_blobstorage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f0bf0cdbdea78b3815dd63e6c30f4d8dae352c761be2de37bb70a149cc70c31e
MD5 e27aaa53ec40dc748bf7f70d58b715ac
BLAKE2b-256 df3736f30d2b5b12b301f7881dbc381ebb745fb9ba29cb61ba9d9cd9215a8185

See more details on using hashes here.

File details

Details for the file aleph_blobstorage-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aleph_blobstorage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aleph_blobstorage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cb65e38d2fd61267f962b9bf954469c96f8d71240b47c2c6ec38cb9c562bfd9
MD5 eb4f21ea6d1d07cf3b55a4c74f97b9ef
BLAKE2b-256 311a5aa8035bb86350bce4273cc675bb22ffd9cb614a5dce21ea377c7937edbf

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