pymupdf-stubs
Type stubs for PyMuPDF (fitz), automatically generated
What it is and what it does
pymupdf-stubs is a PEP 561 stub-only package that provides type annotations for PyMuPDF, the Python binding for MuPDF used to read and manipulate PDF documents. It enables static type checkers like mypy to understand PyMuPDF's API surface without adding runtime overhead. The stubs support both the pymupdf and fitz module names (fitz is a compatibility re-export).
Installing the stubs requires no changes to existing code—you install the package and run your type checker. Some highly dynamic PyMuPDF APIs may still be typed as Any or broad dictionary shapes, and the maintainer welcomes issues for missing or incorrect type annotations. The package targets current PyMuPDF releases and is actively maintained.
Use it for:
- Enable mypy or other type checkers to validate PDF processing code written with PyMuPDF.
- Catch type errors in document manipulation workflows before runtime.
- Improve IDE autocomplete and inline documentation for PyMuPDF methods and classes.
- Support fitz-based legacy code with modern type-checking tooling.
- Validate type safety in PDF extraction and transformation pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type stubs for PyMuPDF to enable static type checking of PDF document manipulation code without runtime overhead.
Yes, if you use PyMuPDF and want static type checking. The package is actively maintained, has no security vulnerabilities, carries a permissive license, and adds no runtime cost. The main caveat is that some dynamic PyMuPDF APIs may not be fully typed, so you may encounter Any types in edge cases—check the repository if you need comprehensive coverage for your specific use case.
Install
pymupdf-stubs on PyPI
pip
pip install pymupdf-stubsuv
uv add pymupdf-stubspoetry
poetry add pymupdf-stubsInstalling pymupdf-stubs
Before you install
Active maintenance with a release 4 days ago; low install friction as a stub-only package with a single runtime dependency on pymupdf.
License in practice
Apache-2.0 permissive license allows use in most projects without significant restrictions.
Quickstart
pip install pymupdf-stubs
import pymupdf
doc = pymupdf.Document()
page = doc[0]
drawings = page.get_drawings()
Requires Python 3.12 or later; pymupdf must be installed separately as the runtime dependency.
Verify before relying
- Coverage completeness: whether all PyMuPDF APIs are typed or if significant portions remain as Any/broad dictionaries.
- Compatibility lag: how quickly stubs are updated when PyMuPDF releases new versions.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pymupdf |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 121,119/month — #11,995 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pymupdf_stubs-1.28.2-py3-none-any.whl
Keywords: fitz, mupdf, mypy, pdf, pymupdf, stubs, type hints, typing
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pydub-stubsProvides type stubs for Pydub, enabling static…
permissive · top 15,000 on PyPI
types-clickProvides PEP 561 type stubs for the click…
permissive · top 5,000 on PyPI
types-tornadoProvides PEP 561 type stubs for tornado,…
permissive · top 15,000 on PyPI
types-humanfriendlyProvides PEP 561 type stubs for the…
permissive · top 15,000 on PyPI
types-FlaskProvides PEP 561 type stubs for Flask to enable…
permissive · top 5,000 on PyPI
types-WerkzeugProvides PEP 561 type stubs for Werkzeug,…
permissive · top 5,000 on PyPI
docutils-stubsProvides PEP 561 type stubs for docutils,…
permissive · top 15,000 on PyPI
scipy-stubsProvides type stubs for the entire SciPy…
permissive · top 5,000 on PyPI
types-PillowProvides type stubs for Pillow, enabling static…
permissive · top 5,000 on PyPI
types-typed-astProvides type stubs for the typed-ast package,…
permissive · top 15,000 on PyPI