Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epilogue-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epilogue-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file epilogue-0.1.0.tar.gz.

File metadata

  • Download URL: epilogue-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 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

Hashes for epilogue-0.1.0.tar.gz
Algorithm Hash digest
SHA256 20f54916b221d2020461ba0ce92b57d008987c1fff79b857c77b797b77fcc94c
MD5 6b53539ea49f45c064127e63f77756be
BLAKE2b-256 e40678ba0c6e8692bd125fd025ad8b47c0de3ec8479b9f7d7a63e204136f8d43

See more details on using hashes here.

File details

Details for the file epilogue-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: epilogue-0.1.0-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

Hashes for epilogue-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbcb4e5c90112979b45b43c86922cd772697ddca4f069d8548033d55b957a7e9
MD5 051600731786d98aa21ac2bbcc5387c3
BLAKE2b-256 aa6e7c32aa26dda57845733be6ff26273767716502c741813aa1b426b4e5faa1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page