Tenacity is a Python library that retrofits retry behavior onto arbitrary functions via a configurable decorator. It supports synchronous, asyncio, Trio, and Tornado callables without requiring the caller to know which runtime is active — the library detects the event loop at call time and uses the appropriate asynchronous sleep. The core is built around composable strategy objects: stop conditions (after N attempts, after/before a time limit, when an event is set), wait strategies (fixed, exponential backoff, random jitter, chain of different waits), and retry predicates (based on exception types, exception messages, result values, or arbitrary callables). Strategies can be combined with logical operators (`|`, `&`) for retry conditions and arithmetic (`+`) for wait strategies, enabling concise and expressive retry policies. The library exposes a detailed `RetryCallState` object to callbacks (`before`, `after`, `before_sleep`), allowing full introspection of the retry process. Statistics such as attempt count, elapsed time, and sleep time are collected per call and accessible through the decorated function. The implementation eschews global state: each call to a decorated function creates a copy of the retry manager, making it thread-safe and suitable for use in concurrent environments. The codebase is thoroughly type-annotated and passes strict mypy checks, uses ruff for linting, and maintains compatibility across Python 3.10 through 3.15.
Nestify is a monorepo that provides a framework for building NestJS applications with a sample order management system demonstrating its use. The repository separates reusable framework capabilities (in packages/) from application-specific code (in apps/api/). The framework provides building blocks for DDD-style NestJS APIs including database integrations (Kysely, ClickHouse), messaging (BullMQ, NATS), caching (Redis/Redisson), observability, resilience patterns, and DDD primitives. The sample application implements an order management system with REST endpoints, PostgreSQL database, Redis integration, and Clean Architecture layers using CQRS pattern. The framework emphasizes separation of concerns, with explicit rules against placing business logic in framework packages.