Python bindings for ovstorage
Actively maintained. Last release 2 months ago. A safe choice.
pip install ovstorageREADME as published on PyPI with version 0.3.0.
ovstorage
ovstorage is an async Python binding for the ovstorage portable storage
library. It gives applications one API for object I/O across storage backends
registered through ovstorage plugins.
The package is pre-1.0. The API is usable, but compatibility guarantees are still settling.
Install
pip install ovstorage
The wheel includes the Python extension package, py.typed, package plus
per-layer type stubs for Python 3.10 and newer, and the first-party plugin
libraries: S3, GCS, Azure, Nucleus, HTTP, OpenDAL, broker, the Omniverse storage
service client, and the core and cache Layer families. pip install ovstorage
is enough to use any of them.
The libraries ship in the wheel, but nothing loads implicitly. Reach them with
ovstorage.bundled_plugins_dir() and hand that to a PluginRegistry:
registry = ovstorage.PluginRegistry([ovstorage.bundled_plugins_dir()])
stack = await (
ovstorage.Stack(root="s3")
.with_registry(registry)
.backend(ovstorage.plugin.PluginBackend("s3"))
.build()
)
Quick Start
import asyncio
import tempfile
from pathlib import Path
import ovstorage
async def main() -> None:
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
request = ovstorage.ConnectionRequest("file")
request.add_config("root", ovstorage.ConfigValue.string(str(root)))
storage = await (
ovstorage.Stack(root="files")
.backend(ovstorage.file.FileBackend("files"))
.connection("files", request)
.build()
)
address = (root / "hello.txt").as_uri()
await storage.write(address, b"hello from ovstorage")
data, info = await storage.read_bytes(address, max_bytes=1024)
print(data.decode("utf-8"))
print(info.size)
asyncio.run(main())
Notes
-
The Python API is async-first. Long-running layer methods return coroutines compatible with
asyncio.create_task,gather, andwait_for. Note thatasyncio.waitrequires explicit tasks — wrap withasyncio.create_task(stack.method(...))first. -
read_bytes(address)returns .