py-lets-be-rational
Pure python implementation of Peter Jaeckel's LetsBeRational.
What it is and what it does
py-lets-be-rational is a Python implementation of Peter Jaeckel's LetsBeRational algorithm for computing implied volatility from option prices. It solves the inverse problem of Black's model—given an observed option price, it calculates the volatility that would produce that price—using a highly efficient numerical method. The package provides a pure Python implementation that works out of the box, with an optional Numba dependency for JIT compilation and faster execution.
The package depends on numpy for numerical operations and maintains backward compatibility with the historical py_lets_be_rational import path. Installation is straightforward on modern Python (3.9–3.14), though users seeking Numba acceleration must handle OS-specific LLVM setup separately. It is actively maintained and carries a permissive MIT license.
Use it for:
- Computing implied volatility from observed option market prices for Greeks and risk calculations.
- Building implied volatility surfaces across strikes and maturities from option quotes.
- Calibrating option pricing models by extracting market-implied volatility parameters.
- Backtesting trading strategies that depend on fast, accurate volatility inference.
- Constructing volatility indices or term structures for portfolio analysis.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes implied volatility from option prices using Peter Jaeckel's LetsBeRational algorithm, with optional Numba acceleration for speed.
Yes. The package solves a well-defined, computationally intensive problem with a proven algorithm. It has low installation friction, active maintenance, MIT licensing, no known vulnerabilities, and broad Python version support (3.9–3.14). The pure Python fallback ensures it works immediately; optional Numba acceleration is available for users willing to handle system-level dependencies. Suitable for production use in option analytics workflows.
Install
py-lets-be-rational on PyPI
pip
pip install py-lets-be-rationaluv
uv add py-lets-be-rationalpoetry
poetry add py-lets-be-rationalInstalling py-lets-be-rational
Before you install
Low friction installation with a pure Python fallback; the package is actively maintained (last commit 2026-05-29) and supports modern Python versions 3.9–3.14. Optional Numba dependency can improve speed but requires separate system-level LLVM installation, which the documentation acknowledges as OS-dependent.
License in practice
MIT license (permissive) allows free use, modification, and distribution with minimal restrictions. The original algorithm carries a historical copyright notice from Peter Jäckel with a simple warranty disclaimer.
Quickstart
pip install py-lets-be-rational
import numpy
# Implied volatility computation via the package's algorithm
Optional Numba acceleration requires LLVM 3.9 and llvm-lite installation, which is OS-dependent; pure Python mode works without it but runs slower.
Verify before relying
- What functions or classes the package exports for computing implied volatility.
- Whether the package's pure Python implementation is sufficiently fast for production use without Numba in typical workflows.
- Current status and compatibility of the Numba optional dependency (documentation references numba==0.31.0, which is very old).
- What cody-special and piecewise-rational runtime dependencies contribute to the package.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — cody-special, numpy, piecewise-rational |
| Maintenance | actively maintained — 76 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 120,919/month — #12,004 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py_lets_be_rational-1.1.2-py3-none-any.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
py-vollibCalculates option prices, implied volatility,…
permissive · top 15,000 on PyPI
vollibvollib calculates option prices, implied…
permissive · top 15,000 on PyPI
volatility3Volatility 3 is a memory forensics framework…
unclear · top 15,000 on PyPI
cody-specialProvides high-precision implementations of…
permissive · top 15,000 on PyPI
piecewise-rationalPerforms shape-preserving piecewise rational…
permissive · top 15,000 on PyPI
pyportfoliooptPyPortfolioOpt implements portfolio…
permissive · top 15,000 on PyPI
archProvides ARCH/GARCH volatility models, unit…
unclear · top 5,000 on PyPI
glicko2Implements the Glicko-2 rating system, a…
permissive · top 15,000 on PyPI
antropyAntroPy computes entropy and fractal dimension…
permissive · top 15,000 on PyPI