Transactional outbox and inbox primitives for PostgreSQL, on SQLAlchemy.
Project description
pactix
pactix is a Python library for transactional outbox and inbox workflows on PostgreSQL, built on SQLAlchemy (async).
Use it when a service needs to commit business data and outgoing events in the same transaction, store incoming messages before handler execution, and retry failed work safely across multiple workers.
Features
- Deduplication by
source + message_idon the inbox side - FIFO within the same
event_type + ordering_key - Optional unordered inbox processing with a stale-event filter contract
- Retry scheduling and lease-based recovery for stuck workers
- Transport-agnostic core protocols
- Built-in helpers for common hooks, stale-event filters, and closure-based adapters
- Optional Kafka adapters behind the
kafkaextra - Optional HTTP adapters behind the
httpextra
If a publisher or handler may run more than once, that is normal. Business effects still need idempotent application logic.
Installation
pip install pactix # core (sqlalchemy + asyncpg)
pip install "pactix[kafka]" # + Kafka transport (aiokafka)
pip install "pactix[http]" # + HTTP transport (httpx + starlette)
pip install "pactix[migrations]" # + Alembic for running the migrations
Database setup
pactix does not run migrations for you. Either run the bundled Alembic migrations
(src/pactix/db/migrations, see alembic.ini) or copy the table
definitions in pactix.db.tables into your own migration
system. The library expects two tables: outbox_message and inbox_message.
Documentation
- Core workflows — append, publish, save, and process flows
- Helper adapters — closures,
ProcessAll,StaticIdempotency, filters - Kafka transport
- HTTP transport
- Operations, migrations, and workers
See examples/worker_loop.py for a runnable worker-loop sketch.
Development
make install # uv sync with all extras
make check # format + lint + mypy + test
Database-backed tests use testcontainers and require Docker.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pactix-0.1.0.tar.gz.
File metadata
- Download URL: pactix-0.1.0.tar.gz
- Upload date:
- Size: 89.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4942c8dba65e49e298482f17e94c15c61f1019de3f075697881d9f6ada1cda53
|
|
| MD5 |
3c584fec8199738bc8eba5a3a23c2302
|
|
| BLAKE2b-256 |
b16a47816747c5d404c884966c337d8a32dc5eb37adb2bd044d9ef6af5c6c8d0
|
Provenance
The following attestation bundles were made for pactix-0.1.0.tar.gz:
Publisher:
publish.yml on victornguen/pactix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pactix-0.1.0.tar.gz -
Subject digest:
4942c8dba65e49e298482f17e94c15c61f1019de3f075697881d9f6ada1cda53 - Sigstore transparency entry: 1821221252
- Sigstore integration time:
-
Permalink:
victornguen/pactix@9f7ab453e9a1803ab38baddee4692cb7210f2074 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/victornguen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f7ab453e9a1803ab38baddee4692cb7210f2074 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pactix-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pactix-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fc1582f26e35291788b4c532c35da5b229d7785653e27dcdb9cb33d5910a1ae
|
|
| MD5 |
e5d646473cefc948785b5b9553ebae30
|
|
| BLAKE2b-256 |
41bc7bddeae2382a85f83164a01a85c5c9a324d4328627788e4d58fcb2850756
|
Provenance
The following attestation bundles were made for pactix-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on victornguen/pactix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pactix-0.1.0-py3-none-any.whl -
Subject digest:
9fc1582f26e35291788b4c532c35da5b229d7785653e27dcdb9cb33d5910a1ae - Sigstore transparency entry: 1821221313
- Sigstore integration time:
-
Permalink:
victornguen/pactix@9f7ab453e9a1803ab38baddee4692cb7210f2074 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/victornguen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f7ab453e9a1803ab38baddee4692cb7210f2074 -
Trigger Event:
release
-
Statement type: