Skip to main content

Python bindings for Forge — hardened infra primitives on Postgres

Project description

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.

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.

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

forgelib-0.0.1.tar.gz (351.4 kB view details)

Uploaded Source

Built Distributions

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

forgelib-0.0.1-cp39-abi3-win_amd64.whl (5.8 MB view details)

Uploaded CPython 3.9+Windows x86-64

forgelib-0.0.1-cp39-abi3-manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

forgelib-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

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

forgelib-0.0.1-cp39-abi3-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for forgelib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5ca00f06bbc033743d19848c7001bceca4592fa2e20a8c4d7d0a3716f13d5ef6
MD5 7c60d9606f849b633be0c1ed2135cd9a
BLAKE2b-256 66d63498e8d03501f487d15eac388626f0f437eb504e071a78c0e585e40dc203

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgelib-0.0.1.tar.gz:

Publisher: release.yml on isala404/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

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

File hashes

Hashes for forgelib-0.0.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 94b89b2d85be03d52c30313356ff8a5141de914208e63b523b9c08a2a4519279
MD5 dea177686c808707a4ff2a6dd979e176
BLAKE2b-256 63af076f6d7242b50fe258d82c8d75487905d03680e328430cadfc759d30a194

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgelib-0.0.1-cp39-abi3-win_amd64.whl:

Publisher: release.yml on isala404/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for forgelib-0.0.1-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7007078d5dcd3637192bc43eed35801c9d868c2649f4d26c2ae769051b6177c7
MD5 57dd455a47146ca84859978647e44e33
BLAKE2b-256 132e042fda7c918dc6189dab0d7b0734ed35040c9047ad8195db92d6909b6517

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgelib-0.0.1-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on isala404/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for forgelib-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04e005bc7458593679acbe3483e4a80f523a56b057e5dfba757f26991c5aa75f
MD5 03989e9bbee5ddc08bcd4e8dbf4c5e34
BLAKE2b-256 a1336d528cfb22e96d78693dbf3f91f9f8873df398d091683f61105a18c6aeee

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgelib-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on isala404/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for forgelib-0.0.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35a48ede78b41df00c0d168f28e44261256be6f39f3907b8d6614ca4f9d5e232
MD5 0e3f0c1d4fb214f7e6d830a785a3ab9c
BLAKE2b-256 0bd9dd8582606ddd38ba01fa8c0b9e3fe0631f743b3d341aefe47ed753e4ff58

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgelib-0.0.1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on isala404/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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