pyroots
Pure python single variable function solvers
What it is and what it does
Pyroots is a pure-Python library that finds roots of single-variable functions using classical numerical methods: bisection, Ridder's method, and Brent's method (with two variants). It exists as a lightweight alternative to scipy, requiring no compiled dependencies and fitting easily into standalone projects or bundled applications. The library provides a unified API across all solvers, letting you switch methods by changing a single import.
You define a function taking at least one argument (the variable), specify an interval containing the root, and call the solver. It returns a result object with the root value, convergence status, iteration count, function call count, and the sequence of steps taken. The main design advantage is explicit control over precision via epsilon—you specify exactly how many digits of accuracy you want, avoiding unnecessary function evaluations that scipy might perform.
Use it for:
- Embedded applications or py2exe bundles where scipy's size is prohibitive and you need lightweight root-finding.
- Expensive function evaluations (seconds or minutes per call) where scipy's over-convergence wastes computation.
- Educational projects or numerical analysis teaching where you want transparent, readable solver implementations.
- Standalone tools that need root-finding without pulling in a large scientific stack.
- Functions with keyword arguments that scipy's API doesn't handle conveniently.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Implements root-finding algorithms (bisect, ridder, Brent) for single-variable functions without requiring scipy as a dependency.
No—not for new projects. The package is abandoned (last update 2020-06-17, no maintenance since). While the code is simple and low-friction, scipy is now the standard, well-maintained alternative for root-finding. Use pyroots only if you have a specific constraint (extreme size limits, legacy py2exe bundling) that scipy cannot meet and you are willing to maintain a dormant dependency yourself.
Install
pyroots on PyPI
pip
pip install pyrootsuv
uv add pyrootspoetry
poetry add pyrootsInstalling pyroots
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last release was 2020-06-17 and no commits since then. Maintenance status is a significant concern for long-term reliability.
License in practice
BSD-3-Clause is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute pyroots freely provided you retain the license notice.
Quickstart
pip install pyroots
from pyroots import Brentq
def f(x, a):
return x ** 2 - a + 1
solver = Brentq(epsilon=1e-5)
result = solver(f, -3, 0, a=2)
print(result.x0, result.convergence)
You must provide an interval [xa, xb] that brackets the root (f(xa) and f(xb) must have opposite signs for most methods).
Verify before relying
- Whether the package works reliably with Python versions beyond 3.8 given its abandoned status.
- Real-world performance comparison with scipy's root-finding methods on expensive function evaluations.
- Whether the claimed advantage of bundling with py2exe or similar tools remains practical in modern deployment workflows.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,249 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 122,766/month — #11,935 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyroots-0.5.0-py2.py3-none-any.whl
Keywords: numeric analysis, brent, bisect, ridder, solver, univariate
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
directsearchSolves unconstrained and linearly constrained…
copyleft · top 15,000 on PyPI
qpsolversProvides a unified Python interface to solve…
copyleft · top 5,000 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
gram-newton-schulzImplements a hardware-aware Gram Newton-Schulz…
permissive · top 15,000 on PyPI
pysrPySR searches for symbolic expressions that fit…
permissive · top 15,000 on PyPI
POTPOT provides solvers for optimal transport…
permissive · top 15,000 on PyPI
pycosatProvides efficient Python bindings to PicoSAT,…
permissive · top 15,000 on PyPI
rdpImplements the Ramer-Douglas-Peucker algorithm…
permissive · top 15,000 on PyPI
quadprogSolves strictly convex quadratic programming…
copyleft · top 15,000 on PyPI
ropwrRoPWR computes optimal piecewise polynomial…
permissive · top 15,000 on PyPI