A developer just dropped Backon, a Python library that handles retry and backoff logic with zero external dependencies, and it climbed to 165 points on Hacker News fast. According to Hacker News, Backon is pitched as a modern evolution of the older backoff library, built on pure Python and the standard library alone. What stands out is the ambition. This isn’t a small wrapper. It packs circuit breakers, async support, and metrics hooks into a package that adds nothing to your dependency tree.
Here’s what Backon actually brings to the table.
- Zero dependencies. It’s pure Python, stdlib only. No supply-chain baggage, no version conflicts, no extra weight in your requirements file. For a utility this foundational, that’s a real selling point.
- Four ways to call it. You get a decorator API (@on_exception, @on_predicate), a functional API (retry()), a context manager (Retrying), and callable objects (RetryingCaller / AsyncRetryingCaller). Same tool, four styles, pick what fits your code.
- Async native. The same API works on async def functions without a separate module. It also supports the Trio async framework, not just asyncio.
- A pile of wait strategies. Exponential, constant, Fibonacci, decay, randomized, incremental, and more. You can chain them together and compose stops with operator overloading (| and &), which is a nice touch for anyone tuning retry behavior carefully.
- Circuit breaker built in. It runs the classic CLOSED / OPEN / HALF_OPEN states with automatic recovery. That’s usually a separate library or a hand-rolled mess. Having it native matters when you’re protecting a flaky downstream service.
- Hedging. It can fire concurrent retry requests and take the first success. That’s a latency trick you normally only see in bigger frameworks.
- Metrics without the strings attached. Prometheus and OpenTelemetry support are optional, with zero hard dependencies. You wire them up only if you want them.
- A real testing story. There’s a dedicated testing module with disable_retries(), limit_retries(), remove_backoff(), and assert_retried(). You can inject a custom sleep function so your tests don’t actually wait around. A global backon.disable() toggle kills retries across the board when you’re running a suite.
How it compares
Most Python teams reach for one of two things today: the original backoff library or Tenacity. Hacker News frames Backon directly as a successor to backoff, and the feature list reads like someone took the good parts and added the stuff people always end up bolting on later. The circuit breaker, hedging, and first-class async are the differentiators. Full type hints validated with mypy in strict mode round it out, so it plays well in typed codebases.
Who can use it
Backon requires Python 3.10 or newer. It ships with modern packaging (PEP 621, PDM, and py.typed), so type checkers see it correctly out of the box. There’s no pricing here. This is an open-source library, free to pull in. The API surface is broad, with rich callbacks like on_success, on_giveup, before_sleep, and before/after hooks for anyone who needs fine control over what happens between attempts.
A quick reality check
The Python 3.10 floor means older projects can’t adopt it without an upgrade. And the sheer size of the feature set cuts both ways. A retry library that also does circuit breaking, hedging, and metrics is powerful, but it’s also more surface area to learn than a five-line decorator. For simple scripts, that might be overkill. For production services talking to unreliable APIs, it looks like a strong fit.
Why it matters
Retry logic is one of those things everyone reimplements badly. A zero-dependency library that covers the hard cases, circuit breakers and async included, could become a default choice for teams tired of gluing three packages together. Worth watching whether it earns the adoption the Hacker News reception suggests. Full details and code examples are available at the original source.