Skip to main content

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.
    # If Stripe fails during the epilogue, the email STILL sends, and an ExceptionGroup naturally bubbles up.

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.
  • Context-Safe by Design: Powered entirely by native contextvars. Topologically safe across concurrent threads, asyncio boundaries, and deep recursion without explicit state tracking.
  • Flawless Fault Propagation: Uses Python 3.11+ ExceptionGroup to guarantee all successful side-effects execute, even if one fails during the epilogue phase.

Installation

uv add epilogue
# or
pip install epilogue

Metadata

Release files for epilogue 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epilogue 1.0.0
File Size Uploaded Provenance Actions
epilogue-1.0.0.tar.gz 2.4 kB Without provenance Details for epilogue-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for epilogue 1.0.0
File Interpreter ABI Platform Actions
epilogue-1.0.0-py3-none-any.whl Python 3 none any Details for epilogue-1.0.0-py3-none-any.whl

Total release size: 5.7 kB

Release files / epilogue-1.0.0.tar.gz

Download URL epilogue-1.0.0.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9845fd549e15adafed2eb96ae0909ea2c0a0b2ef4091ed554f8c0e99d2bdffc5
BLAKE2b-256 checksum
How to use checksums
efcb20b07c890957143e73f1128032710913bb6a919f1bbf22ed7aa77f06afba
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / epilogue-1.0.0-py3-none-any.whl

Download URL epilogue-1.0.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a9331d8a5e58ca7995624ea5ad77618c57c856e1a1c31e27db93edd488b0928
BLAKE2b-256 checksum
How to use checksums
65c7f02e3eadd065055ffc64b5a756b5b02e0597dc0e70a2ea4ad9a3f06854ca
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for epilogue 1.0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page