skillfed

scipy-stubs

The official type stubs for SciPy

scipy-stubs v1.18.0.1 3.9M downloads/30d#2,458 on PyPI93
Permissive license BSD-3-Clause Active released

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-stubs

uv

uv add scipy-stubs

poetry

poetry add scipy-stubs

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Stubs Only

Tags

scipy type stubstype checking scipyscipy type hintsstatic typing scientific pythonscipy mypy supportscipy type annotationspep 561 scipy
type-stubsstatic-typing

More Quality Assurance packages