Skip to content
ebotiabPublic

About

Async Python utilities for Azure Blob Storage, queues and tables.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

azhacks

Async Python helpers for Azure Blob Storage, Queue Storage and Table Storage. The package groups common storage operations behind small manager classes that can be used as async context managers.

What is implemented

Manager Operations
ContainerManager Upload and download blobs, transfer folders, and upload files that are missing from a container.
QueueManager Send a list of messages concurrently to an existing queue.
TableManager Upsert entities, query a table, and delete an entity by its partition and row keys.
StorageResourceManager Shared account credentials and Azure Storage endpoint construction.

Here, a container means an Azure Blob Storage container. The package works with existing storage resources and uses account-name/account-key credentials.

Installation

Requires Python 3.12 or newer.

Install the source from this repository:

git clone https://github.com/ebotiab/azhacks.git
cd azhacks
python -m pip install .

Example: read a blob

Set AZURE_STORAGE_ACCOUNT, AZURE_STORAGE_KEY and AZURE_STORAGE_CONTAINER in your environment. The container and the example blob must already exist; this example only reads data.

import asyncio
import os
from pathlib import Path

from azhacks.container_manager import ContainerManager


async def main() -> None:
    async with ContainerManager(
        container=os.environ["AZURE_STORAGE_CONTAINER"],
        account=os.environ["AZURE_STORAGE_ACCOUNT"],
        api_key=os.environ["AZURE_STORAGE_KEY"],
    ) as storage:
        content = await storage.download_bytes(Path("reports/example.txt"))
        print(content.decode("utf-8"))


if __name__ == "__main__":
    asyncio.run(main())

Use environment variables or your application's secret store for credentials; do not commit account keys.

Source map

src/azhacks/
├── container_manager.py         # Blob operations
├── queue_manager.py             # Concurrent message sending
├── table_manager.py             # Entity operations and queries
└── storage_resource_manager.py  # Shared storage base class

Development and current scope

uv sync
uv run pytest

This is a small utility library. The current test suite contains only a placeholder test; it does not validate Azure operations. Service-level behavior needs integration tests before relying on the package for a new production use case.

The release workflow runs on version tags. See pyproject.toml for dependencies and .github/workflows/release.yml for the release process.

License

See LICENSE.

About

Async Python utilities for Azure Blob Storage, queues and tables.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages