Skip to main content

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= and create_only= make writes conditional — on GCS (ifGenerationMatch), on disk (atomic across threads and processes), and in memory.
  • Zero-copy reads. Blob exports the downloaded buffer through the buffer protocol; pass a Blob back to put and 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 (InvalidKeyError otherwise).
  • 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=True for fake-gcs-server.
  • Thread-safe. Every call releases the GIL; use a thread pool or asyncio.to_thread for 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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uu-objstore-r 0.2.2
File Size Uploaded
uu_objstore_r-0.2.2.tar.gz 220.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for uu-objstore-r 0.2.2
File
uu_objstore_r-0.2.2-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
uu_objstore_r-0.2.2-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details
uu_objstore_r-0.2.2-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details
uu_objstore_r-0.2.2-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details
uu_objstore_r-0.2.2-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.2.tar.gz

Download URL uu_objstore_r-0.2.2.tar.gz
Size 220.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5483d1da3462cd129eb3626052a4a4a3fa1ca1ca224d29650519ed13b244b54d
BLAKE2b-256 checksum
How to use checksums
b9f269ea6bd30f1367a6ecb1d14f1af9f3d3bb317363b6cde61d244bd12b9158
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.2-cp312-abi3-win_amd64.whl

Download URL uu_objstore_r-0.2.2-cp312-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4210598f1066b13523b965535a89aa83f402f8fffcbe526c84f541dfc6e364c9
BLAKE2b-256 checksum
How to use checksums
1b4577c32b0494eb23d6155a6d01d6194fca0fb6f6d30948f4c293881e1454cf
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.2-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL uu_objstore_r-0.2.2-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
eada1be2e86315666d5641d278657d9ba627c2e858b83cbb1409010a842f8bd4
BLAKE2b-256 checksum
How to use checksums
8252562083784f3f824bf3a454aede5f1b3fd09b6d389267be746d5841278d43
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.2-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL uu_objstore_r-0.2.2-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
f19de14da789c8befa0be2841841853a8285625a3511c97cc35932839e2ac4c2
BLAKE2b-256 checksum
How to use checksums
4f2f5e51dac6ddb0698eb7b999fe8647c8b19876642fb3e4f82fa2220048f211
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.2-cp312-abi3-macosx_11_0_arm64.whl

Download URL uu_objstore_r-0.2.2-cp312-abi3-macosx_11_0_arm64.whl
Size 1.9 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bd109efa4099791dbbf5d8a657c335218bb7f3a42dbb68eb884c084efc6faac0
BLAKE2b-256 checksum
How to use checksums
114dd9a7e4e140171aa2de269da8664f2c19810f2c80127818b93790ae9569fe
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.2-cp312-abi3-macosx_10_12_x86_64.whl

Download URL uu_objstore_r-0.2.2-cp312-abi3-macosx_10_12_x86_64.whl
Size 2.0 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ebfff1401db157469a21ecd57c5a84e5c1ddb058ce34198243fbdf8fc5d300b7
BLAKE2b-256 checksum
How to use checksums
f816bbffdc117ae3dde34bab2b71e4065c165d3a03e726a45cd9cd50e03bf3ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.2.4

6 release files

0.2.3

6 release files

This release

0.2.2 This release

6 release files

0.2.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page