objstore-r
pip install uu-objstore-r → import objstore_r (Python ≥ 3.12, one abi3
wheel per platform).
One small object-store API over Google Cloud Storage, a local directory and memory, with the primitive that makes object storage usable as a database: generation preconditions (compare-and-swap).
import objstore_r
store = objstore_r.Store.gcs("my-bucket") # Application Default Credentials
# store = objstore_r.Store.local("/var/data") # same API on disk
# store = objstore_r.Store.memory() # same API in memory (tests)
gen = store.put("state/HEAD", b"v1", create_only=True)
blob = store.get("state/HEAD") # Blob, zero-copy
view = memoryview(blob) # no copy of the downloaded bytes
store.put("state/HEAD", b"v2", if_generation=blob.generation) # CAS
try:
store.put("state/HEAD", b"v3", if_generation=gen) # stale
except objstore_r.PreconditionFailedError:
...
- Compare-and-swap everywhere. Every write returns the object's new
generation;
if_generation=andcreate_only=make writes conditional — on GCS (ifGenerationMatch), on disk (atomic across threads and processes), and in memory. - Zero-copy reads.
Blobexports the downloaded buffer through the buffer protocol; pass aBlobback toputand it is not copied either. - Ranged and concurrent reads.
get_range(key, start, end);get_many(keys)fetches concurrently. - Safe keys.
/-separated segments of[A-Za-z0-9._-], validated before any I/O: no traversal, no hidden files, portable to every OS (InvalidKeyErrorotherwise). - Production GCS client. Resumable uploads above 8 MiB, ranged downloads, retries with jittered backoff on 408/429/5xx (never on conflicts), lost-response detection on conditional writes, response size limits, no redirects, TLS required except for a loopback emulator. Tokens are cached and never appear in errors or reprs.
- Credentials. Application Default Credentials by default (gcloud user
credentials or the metadata server on Cloud Run / GCE / GKE; service-account
key files are deliberately unsupported),
token=for a fixed bearer token,anonymous=Truefor fake-gcs-server. - Thread-safe. Every call releases the GIL; use a thread pool or
asyncio.to_threadfor concurrency.
Errors
All derive from ObjstoreError: NotFoundError (ranged read of a missing
object; get/head return None instead), ConflictError,
PreconditionFailedError, InvalidKeyError, UnavailableError,
AuthError, TooLargeError, ProtocolError.
Testing your code
Store.memory().inject_failure(after=n, lost_response=True) makes the n-th
next operation fail — before applying, or after applying with the reply lost
— to exercise retry paths.
Licence
AGPL-3.0-or-later, or a commercial licence — see the repository.
Metadata
Release files for uu-objstore-r 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uu_objstore_r-0.2.0.tar.gz | 218.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| uu_objstore_r-0.2.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| uu_objstore_r-0.2.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| uu_objstore_r-0.2.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| uu_objstore_r-0.2.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| uu_objstore_r-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 10.0 MB
Release files / uu_objstore_r-0.2.0.tar.gz
| Download URL | uu_objstore_r-0.2.0.tar.gz |
|---|---|
| Size | 218.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51aca20f24fd974520a905c26c43430e05e6669ce56de47cc78f130319f99224
|
|
BLAKE2b-256 checksum How to use checksums |
88c163746a652ca283a7c39e1f0de846d12eb5d71bb8a76743116e622a75987d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_objstore_r-0.2.0-cp312-abi3-win_amd64.whl
| Download URL | uu_objstore_r-0.2.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2c26591b0b25bc05d2ed3565567258b339d4ea6c06b1f682674f4fed272a3a01
|
|
BLAKE2b-256 checksum How to use checksums |
bd9dd15c559d733b4f17b007caf54ef70f66987c74f837c06daac7f26a15a055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_objstore_r-0.2.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | uu_objstore_r-0.2.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
68f8deaa134cf2a671a98cc7a1c54f3b3de752680e39126cfaf944577785a92e
|
|
BLAKE2b-256 checksum How to use checksums |
a657fcae47cb5771d9cad25a72c383091c66fcfef03fcd4bd3c559fd0901fa3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_objstore_r-0.2.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | uu_objstore_r-0.2.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b9e009dec199fad7fcdb965bd1d697137e5f1f83817930d4aafd80cc54526a56
|
|
BLAKE2b-256 checksum How to use checksums |
c1580f703272fa6d4af566621c7548a21350e5d623f2fe46d89f62685ace5005
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_objstore_r-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | uu_objstore_r-0.2.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c834f09bb4905880aae76b8343fa08b3efcf66b2203a79ddf36a1f0670f0dc65
|
|
BLAKE2b-256 checksum How to use checksums |
f07ee22e0048c0924402ef8eb9606a67fd4238d38c7046c8cb987ca8ebd3dc59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_objstore_r-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | uu_objstore_r-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
bd89a9ed430f2f0d522ccb2d4888450341be3f05c9950e3c105dcde3d772e9dc
|
|
BLAKE2b-256 checksum How to use checksums |
23f5fe691c54f166ecdd47470231273fa1b59cb7ceb456b929290b20a97c57d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|