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 capability inspection, readiness probes, per-instance metrics, and W3C queue trace propagation.
Scheduler methods expose UTC schedule inspection, pause/resume, due lag/count, last successful tick, enqueue failures, and explicit bounded misfire policies. The scheduler enqueues ordinary deterministic queue jobs and does not own workflow state.
The top-level encode_cloud_event/decode_cloud_event and import_env_config/export_env_config helpers are state-free. They add no transport, framework, or environment mutation to the native client; see the repository's integration recipes for HTTP frameworks, deployment, and MCP patterns.
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.
Deterministic tests
await ForgeClient.init_memory_for_testing(toml, start_ms, seed) creates the normal memory profile with manual time and repeatable test-only entropy. Call forge.advance_test_clock(seconds) to drive expiry, delayed work, scheduling, and rate-limit refill without sleeping. The seeded tokens are predictable and must never leave tests.
Application-owned names can use the v1 helper: forgelib.scope_kv_key("billing", tenant_id, user_id, invoice_id). parse_scoped_name reverses the length-prefixed encoding. This is a naming aid only; authorize every component before calling Forge.
OpenFeature, bulk reads, and snapshots
Install forgelib[openfeature] and use forgelib.openfeature.ForgeProvider with the official OpenFeature async client. The provider preserves stable variants and reasons, installs no global hooks, and exposes the official OpenTelemetry tracing hook for application-scoped registration. Startup code can use config_get_many and flag_details_many for ordered 256-item reads. config_snapshot captures only requested keys and pre-evaluated flags for 1–86,400 seconds; access it through config_snapshot_get and config_snapshot_flag_details, and protect application_protected snapshots before they leave the trusted server boundary.
Metadata
Release files for forgelib 1.1.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 | Provenance | |
|---|---|---|---|---|
| forgelib-1.1.0.tar.gz | 347.9 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| forgelib-1.1.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| forgelib-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| forgelib-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| forgelib-1.1.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 38.3 MB
Release files / forgelib-1.1.0.tar.gz
| Download URL | forgelib-1.1.0.tar.gz |
|---|---|
| Size | 347.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50fc49ac5fb0cda503bb1d41648dcd98bea2e35a22838c1487a53f8f567497dc
|
|
BLAKE2b-256 checksum How to use checksums |
bde12868dabdf3bfedaa20df8f05677409bd69b5017d80294bc07bcec6683233
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / forgelib-1.1.0-cp39-abi3-win_amd64.whl
| Download URL | forgelib-1.1.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c69a660995871b8003bd574696bcdcda440750fc34396b247a82cccc8770ec1d
|
|
BLAKE2b-256 checksum How to use checksums |
cd8975a4fb28c56026368dad63a14ef1dcd00af118b0b689f8222d84629dc8f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / forgelib-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | forgelib-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 9.3 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c1681705094e542d850e07651d8a8ad8eeeebe66bca80155165c752bdca7e67d
|
|
BLAKE2b-256 checksum How to use checksums |
e8538724ca4a39473e9e04fee659cedad739ce7033d6de0aeee64b015d79b10b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / forgelib-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | forgelib-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 9.7 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
839ead60feb70445a6f60db5f2b024fcd0c6f749e0e98c54608d52f4561a7901
|
|
BLAKE2b-256 checksum How to use checksums |
7fb5e925d4979d73fdeec9685cafba80ac866d07e776d10fa3939681b7ecc68b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / forgelib-1.1.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | forgelib-1.1.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.4 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0483c7312a91ea7853f113ceb50ab9253412ff5eae80d586628bd19631b8a495
|
|
BLAKE2b-256 checksum How to use checksums |
7ae4e0db2990f97c8c78c378452e62d8bc889ea6a2bfb2c8cd108ef7ccf74017
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logSecurity for forgelib 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for forgelib-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.