Skip to main content

aftercare

Teardown orchestration for Python. Register cleanup steps, then run them in reverse order on exit — logging each one's success or failure without short-circuiting the rest.

Install

pip install aftercare

Usage

from aftercare import Aftercare

order = []
with Aftercare() as ac:
    ac.add(lambda: order.append("close_db"), name="close_db")
    ac.add(lambda: order.append("flush_cache"), name="flush_cache")
    # main work...

assert order == ["flush_cache", "close_db"]
assert all(r.ok for r in ac.results)

Roadmap

This is an early 0.1.0 release with active development planned:

  • Async cleanup support
  • Timeout and cancel policies
  • Structured result export for ops tooling

Author

Coldbricks — coldbricks@gmail.com

Download files

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

Source Distribution

aftercare-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

aftercare-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aftercare-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for aftercare-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d3d1ba0e0e3a62c7caf7fc99deeba0bb991afa13aa58be39f8edb8444ab81b7
MD5 6d32c7ff7fa4cad9925729926f0efca8
BLAKE2b-256 7f512e628ef6f2174bfbe81a470d9ec4fde9b935cb1ce7224504553cffbefbeb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aftercare-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for aftercare-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e6d6c17a004ead4542fedc0c9f09c138cb406e17976b4d45a9a0e14f3051604
MD5 90aa72d5bd1826b712bf90bc3a9c17ad
BLAKE2b-256 6c512379cd26f6f6f17cf1ae70805ac997f83a4e97d1b0ed807551169dd4d597

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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