Skip to main content

changeme

Project description

azure-blob-tui

Terminal TUI for browsing Azure Blob Storage, plus Python helpers to read/write blobs directly from your training code (no local files required).

First-time setup

Run the TUI once to configure account/container/prefix and (optionally) store SAS in an encrypted local file. On later runs, if SAS is stored, you only need the passphrase (no need to re-enter SAS).

azure-blob-tui --configure

During first run you will be prompted for:

  • account name / container name / default prefix
  • whether to store SAS in an encrypted local file
  • (if yes) the SAS token and a passphrase to encrypt it

Later runs:

  • If SAS is stored, you will only be prompted for the passphrase.
  • If you set AZURE_BLOB_TUI_PASSPHRASE, no prompt is needed.

Use the TUI

azure-blob-tui

Reconfigure

azure-blob-tui --configure

Python API (no local files)

All helpers use the same config (account/container/default prefix) and SAS token stored by azure-blob-tui --configure. If AZURE_BLOB_TUI_PASSPHRASE is set, no prompt is needed.

Default prefix behavior:

  • Default prefix is not applied automatically.
  • Pass use_default_prefix=True to opt in per call.

blob_open (file-like stream)

import torch
from azure_blob import blob_open

# Save directly to Blob
with blob_open("checkpoints/step-100/model.pt", "wb") as f:
    torch.save(model.state_dict(), f)

# Load directly from Blob
with blob_open("checkpoints/step-100/model.pt", "rb") as f:
    state = torch.load(f, weights_only=False)

Save JSON/YAML/text to Blob

import io
import json
from azure_blob import blob_open

with blob_open("artifacts/config.json", "wb") as raw:
    with io.TextIOWrapper(raw, encoding="utf-8") as f:
        json.dump({"lr": 1e-4}, f)

blob_url (signed URL helper)

from azure_blob import blob_url

url = blob_url("images/cat.png")

Storage helpers

from azure_blob import (
    download_dir,
    download_file,
    list_blobs,
    upload_dir,
    upload_file,
)

upload_file("local.txt", "artifacts/local.txt")
download_file("artifacts/local.txt", "local_copy.txt")

for name in list_blobs(prefix="artifacts/"):
    print(name)

BlobContext (high-level workflow helper)

BlobContext wraps a configured ContainerClient and adds convenience helpers for prefix resolution, listing, and in-memory read/write.

import os
from azure_blob import BlobContext

os.environ["AZURE_BLOB_TUI_PASSPHRASE"] = "your-passphrase"

ctx = BlobContext.from_config()

for prefix in ctx.iter_prefixes(prefix="overview/among/"):
    print(prefix)

data = ctx.read_bytes("overview/among/123/topdown.png")
ctx.write_bytes(
    "overview/among/123/processed.png",
    data,
    content_type="image/png",
)

Choosing the right helper

  • BlobContext: best for workflows that need listing, grouping, and in-memory read/write without touching disk.
  • blob_open: best for file-like streaming APIs (e.g., torch.save/load, TextIOWrapper, or very large files).
  • read_bytes/write_bytes: best for small-to-medium blobs where a full in-memory buffer is fine (images, JSON, etc.).
  • list_blobs/iter_prefixes: best for enumeration and directory-like traversal.
  • download_*/upload_*: local file paths (avoid these if you want no local storage).

Notes

  • SAS tokens are not stored in the config file, but in an encrypted local file.
  • blob_open works for any file type (torch checkpoints, JSON, YAML, text, etc.).

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

azure_blob_tui-0.1.2.tar.gz (125.4 kB view details)

Uploaded Source

Built Distribution

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

azure_blob_tui-0.1.2-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file azure_blob_tui-0.1.2.tar.gz.

File metadata

  • Download URL: azure_blob_tui-0.1.2.tar.gz
  • Upload date:
  • Size: 125.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","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 azure_blob_tui-0.1.2.tar.gz
Algorithm Hash digest
SHA256 11b1b5f8099d64644602c595fb049b23372b1daa1157295a6f35ec61db1610f0
MD5 43d52a6236ab0e9ed5329c296ef3894e
BLAKE2b-256 55a48dbeaef0946f0535e4395c2934f7ec870e394c7197fde8f86acbc716b571

See more details on using hashes here.

File details

Details for the file azure_blob_tui-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: azure_blob_tui-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","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 azure_blob_tui-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d1b62a246964e8e08bcb334c8a12f17c722714385f9cc26292c8483d21ce0f8
MD5 713b5ab5e23833dd7a305836439981d1
BLAKE2b-256 415e6963e06fcc82aa7f0e31d586226c3d948110ac45632278e489fdbd352db3

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