Skip to contents

Retrying

Call a function again when it fails.

Caching

Remember a function’s results.

lru_cache() cache() disk_cache()
Cache function results

Circuit breaking

Stop calling a function that keeps failing.

circuit_breaker()
Stop calling a function that keeps failing

Rate limiting

Limit how often a function can be called.

rate_limit()
Limit how often a function can be called

Validation

Check arguments and return values.

validate_args() validate_return()
Validate arguments and return values

Context managers

Write setup and teardown once.

contextmanager() teardown()
Write setup and teardown once
with_context()
Run code inside a context
as_decorator()
Use a context manager as a decorator

Re-exports

reexports := %@%
Objects exported from other packages