scipy-stubs
The official type stubs for SciPy
What it is and what it does
scipy-stubs is the official type stub package for SciPy, maintained separately from SciPy itself to allow faster iteration and independent release cycles. It annotates the entire public SciPy API with precise type information, including array shapes and dtypes where applicable, and provides generic types for sparse arrays, distributions, splines, and linear operators. The stubs work transparently on install with no runtime impact—they affect only static type checking and IDE autocompletion.
The package is tested against multiple type checkers (mypy, pyright, basedpyright, pyrefly, ty, and zuban) and is used by major projects. It requires Python 3.12 or later and depends on optype for array-like and shape-typing support. Installation is optional and opt-in; users who don't enable type checking won't see any behavioral change.
Use it for:
- Enable IDE autocompletion and error detection for SciPy code without modifying existing source
- Run mypy or pyright on scientific Python projects to catch type errors in SciPy function calls
- Track array shapes and dtypes through SciPy operations for numerical correctness verification
- Use generic types for precise type hints on SciPy solver and distribution objects
- Integrate type checking into CI/CD pipelines for scientific Python libraries that depend on SciPy
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type stubs for the entire SciPy library, enabling static type checkers to understand SciPy's API with shape and dtype awareness.
Yes. If you use SciPy and any static type checker (mypy, pyright, or similar), installing scipy-stubs is a straightforward win: low install friction, no runtime cost, active maintenance, permissive license, and broad tool support. Skip it only if you don't use type checking at all.
Install
scipy-stubs on PyPI
pip
pip install scipy-stubsuv
uv add scipy-stubspoetry
poetry add scipy-stubsInstalling scipy-stubs
Before you install
Low friction: a pure-Python wheel with a single runtime dependency (optype). Active maintenance with releases every few weeks; last commit 2026-08-14.
License in practice
BSD-3-Clause permissive license; no restrictions on use or redistribution in proprietary or open-source projects.
Quickstart
pip install scipy-stubs
import scipy.integrate
from scipy.integrate import BDF
Requires Python 3.12 or later
Verify before relying
- Whether scipy-stubs works correctly with scipy versions newer than the stubs' own release, given the lack of an upper-bound enforcement
- Runtime performance impact of the optype dependency during type checking or IDE operations
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — optype |
| Maintenance | actively maintained — 33 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,892,699/month — #2,458 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: scipy_stubs-1.18.0.1-py3-none-any.whl
Keywords: scipy, typing, stubs, type-stubs, type-hints, type-checking, static-typing, shape-typing, pep561
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
joblib-stubsProvides type stubs for joblib, enabling static…
permissive · top 15,000 on PyPI
numpy-typing-compatProvides version-specific type annotations for…
permissive · top 5,000 on PyPI
types-futuresProvides type stubs for the futures package,…
permissive · top 15,000 on PyPI
types-SQLAlchemyProvides PEP 561 type stubs for SQLAlchemy,…
permissive · top 15,000 on PyPI
types-PillowProvides type stubs for Pillow, enabling static…
permissive · top 5,000 on PyPI
types-reportlabProvides type hints for the reportlab PDF…
permissive · top 15,000 on PyPI
types-dataclassesProvides type stubs for Python's dataclasses…
permissive · top 15,000 on PyPI
types-geopandasProvides type annotations for the geopandas…
permissive · top 15,000 on PyPI
sqlalchemy-stubsProvides type stubs and a mypy plugin to enable…
permissive · top 5,000 on PyPI
types-pikaProvides type stubs for the Pika RabbitMQ…
permissive · top 15,000 on PyPI