Skip to main content

forgelib

Python bindings for Forge via pyo3. A natively async ForgeClient over the async Rust core: every method returns an awaitable driven on a shared Tokio runtime, so an asyncio app awaits the binding directly: no thread-pool wrapper, the event loop is never blocked. The full primitive surface is exposed (kv, queue, config, ratelimit, blob, auth, schedule, pubsub), plus backend_report.

Forge errors surface as a typed exception hierarchy (forgelib.NotFoundError, forgelib.InvalidError, forgelib.LimitError, … all subclasses of forgelib.ForgeError), and every raised instance carries a retryable attribute.

Built against the stable ABI (abi3-py39), so one wheel runs on CPython ≥ 3.9. The 1.x release publishes wheels for Linux x64, Linux arm64, macOS arm64, and Windows x64, plus a source distribution. Intel macOS installs from source.

Build

docker compose up -d db          # a Postgres for local use

cd bindings/python
python -m venv .venv && . .venv/bin/activate
pip install maturin
maturin develop                  # compiles + installs `forgelib` into the venv

(On a CPython newer than this pyo3 release knows about, prefix the build with PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1.)

Use

Configuration lives in a forge.toml at the project root; init() reads it and instantiates the runtime. A minimal one:

[postgres]
url = "${DATABASE_URL:-postgres://postgres:forge@localhost:5432/forge_dev}"

[blob]
signing_secret = "${BLOB_SIGNING_SECRET:-dev-secret}"  # enables presigned blob URLs
import forgelib

forge = await forgelib.ForgeClient.init()  # reads ./forge.toml

greeting = forge.kv("greeting")
await greeting.set("hi")
print(await greeting.get())

# Realtime: topic handles decode JSON events for you.
async for event in forge.topic("chat:1").subscribe():
    handle(event)

Native typed handles

The main forgelib package binds names to JSON value types directly on the client, so most app code does not need raw queue strings plus json.dumps:

import forgelib

emails = forge.queue("emails")
await emails.enqueue({"to": "a@b.c", "template": "welcome"}, max_attempts=3)
job = await emails.dequeue(wait_seconds=1.0)
if job:
    handle(job.payload)            # already decoded
    await emails.ack(job.receipt)

profile = forge.kv("user:1:profile")
await profile.set({"name": "Ada"})

The raw methods (kv_set, queue_enqueue, ...) remain available for exact cross-language parity and string/byte contracts. The packaged stubs include both the raw client and the typed handles.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forgelib-1.0.1.tar.gz (222.9 kB view details)

Uploaded Source

Built Distributions

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

forgelib-1.0.1-cp39-abi3-win_amd64.whl (5.7 MB view details)

Uploaded CPython 3.9+Windows x86-64

forgelib-1.0.1-cp39-abi3-manylinux_2_28_aarch64.whl (5.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

forgelib-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

forgelib-1.0.1-cp39-abi3-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file forgelib-1.0.1.tar.gz.

File metadata

  • Download URL: forgelib-1.0.1.tar.gz
  • Upload date:
  • Size: 222.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forgelib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ee8d1ad4cc4f163a478e43e402f4c19ecddebec279e85059f2e214fc89e20ddd
MD5 66735560afd99814004f1e9a0e2465fb
BLAKE2b-256 960c5ea3f54021244f78a8e0e1ccf9bc99f3ecead6a9b37f6525223091431927

See more details on using hashes here.

File details

Details for the file forgelib-1.0.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: forgelib-1.0.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forgelib-1.0.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 298cd9d125d5d5aa61319d2befef87a330d5c104941a6e2b06e0615664bd6763
MD5 3ca45bec5aac159908ab7cd9c30094fb
BLAKE2b-256 0498fecaaa4918f96c237d49196c9759073e2ed8a2a8e17e5f4e6df305ff62c6

See more details on using hashes here.

File details

Details for the file forgelib-1.0.1-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for forgelib-1.0.1-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0321ba9bc550e22a7257d4cebb47269373976e37171e0cb33a5bb9021d5540ac
MD5 66e5dbe5ca070fda7b768e1905db9c3f
BLAKE2b-256 d8610982ba08a3354a23633ae684691b6df4da816ad73e8476308c88ddca072d

See more details on using hashes here.

File details

Details for the file forgelib-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for forgelib-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7312b9d813ab8bfb71a36d213148ab018ecc40b70220084d66ce728622e1079f
MD5 3c729d0c635390144f20630a1d1e5d52
BLAKE2b-256 9bf0e74f5cea82372e37eb66ede0f6a758dc1fcd2325b3cc819534f4762145e0

See more details on using hashes here.

File details

Details for the file forgelib-1.0.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for forgelib-1.0.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e5b00a4eff2654e952cf4b7bb2e93360ba05678cff9f51c71a39b2c308c47f8f
MD5 4535ca89ea03d34d4d02c9d2c3a40c7e
BLAKE2b-256 58c629b355c4e2fa1d28899292b0741fca6a4d29f54bae2620e4a2a7e0151e1d

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

5 files

This release

1.0.1 This release

5 files

1.0.0

5 files

0.0.1

5 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