Strict execution boundaries for deferred side-effects.
Project description
epilogue 📜
Strict execution boundaries for deferred side-effects.
Standard logic forces you to push 3rd-party API calls to the absolute bottom of your functions to prevent partial failures. epilogue lets you queue side-effects during execution, running them only if the core function finishes successfully.
By calling defer(), you register an intent. If the function crashes at any point, the queue is silently destroyed and the error is re-raised. Zero side effects occur.
Usage
import epilogue
@epilogue.atomic
def checkout(user, cart):
# 1. Register the intent. (Does NOT hit the network yet!)
epilogue.defer(stripe.charge, user.id, cart.total)
# 2. Do heavy, crash-prone database logic
db.save_order(user, cart)
# 3. Register another intent.
epilogue.defer(email.send_receipt, user.email)
return True
# CHECKPOINT:
# If db.save_order() throws an Exception, the function crashes normally.
# The Stripe charge and email are completely aborted.
# If it returns True, the deferred actions are safely executed in order.
Features
- All-Or-Nothing Safety: Prevent partial failures without writing complex Saga patterns or Kafka queues.
- Pure Functions: Keeps your core domain logic clean. If you run the code without the decorator (e.g., in unit tests), it just builds a list in memory without triggering real side-effects.
- Thread-Safe by Design: Uses isolated side-channels, so concurrent web requests or Celery workers will never mix their deferred queues.
- Zero Dependencies: Built entirely on the Python standard library.
Installation
uv add epilogue
# or
pip install epilogue
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 epilogue-0.1.1.tar.gz.
File metadata
- Download URL: epilogue-0.1.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4adb8b363a9144821bb35942f97166abe3605cbcee6c388cccccf7caaaa5354a
|
|
| MD5 |
baa37dbc5ebc14bc74be0c8994378559
|
|
| BLAKE2b-256 |
ea0819a2c13c951678d30c511971d9029887a7218e9644d19c36493c82304805
|
File details
Details for the file epilogue-0.1.1-py3-none-any.whl.
File metadata
- Download URL: epilogue-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87ef9b322f875b3de5f43370bedff239140d38358a031b3f98063487b8bbd918
|
|
| MD5 |
d01821b054dc1bd80a32d2faea1defe4
|
|
| BLAKE2b-256 |
e0133f634c31d6c3d0536aa6858f2ff3306bde4405ad3d1b01d8fed2de80982f
|