skillfed

pymupdf-stubs

Type stubs for PyMuPDF (fitz), automatically generated

pymupdf-stubs v1.28.2 121.1K downloads/30d#11,995 on PyPI1
Permissive license Apache-2.0 Active released

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

uv

uv add pymupdf-stubs

poetry

poetry add pymupdf-stubs

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: UtilitiesTyping :: Stubs Only

Tags

pymupdf type stubsfitz type hintspdf type checkingpymupdf mypy supporttype hints for pdf librariespep 561 stubs pymupdfstatic typing pdf documents
type-stubspdf-processingstatic-typing

More Python Modules packages