Metadata-Version: 2.3
Name: epilogue
Version: 0.1.1
Summary: Strict execution boundaries for deferred side-effects.
Keywords: strict-execution,boundary,side-effect,deferred,concurrency
Author: Wannes Vantorre
Author-email: Wannes Vantorre <vantorrewannes@gmail.com>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.14
Project-URL: Homepage, https://codeberg.org/ProductionCode/epilogue
Project-URL: Repository, https://codeberg.org/ProductionCode/epilogue
Project-URL: Issues, https://codeberg.org/ProductionCode/epilogue/issues
Description-Content-Type: text/markdown

# 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

```python
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

```bash
uv add epilogue
# or
pip install epilogue
```
