pytype
Python type inferencer
Decision gist · record as of 2026-08-14
Yes, if you need type checking on unannotated Python code or want to infer types without strict gradual typing. The active maintenance, permissive license, and lack of known vulnerabilities support adoption. Medium install friction (13 dependencies, compiled packages) and platform constraints (Linux primary, macOS supported, Windows via WSL) are the main tradeoffs; evaluate whether your target Python versions (3.10+) and platform match your needs.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a Python 3.10+ interpreter to run pytype, plus a matching Python 3.8-3.12 interpreter in $PATH for the code being analyzed.
- On macOS, requires OSX 10.7+ and Xcode v8+.
- Windows requires WSL.
License · maintenance · safety
Apache 2.0 (permissive) — Apache 2.0 permissive license allows use in commercial and proprietary projects with minimal restrictions; you must include a copy of the license and note significant changes.
last release 2024-10-11 (672 days) · last repo commit 2026-03-16 · 5,029 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,013,417 downloads/mo, #4,508 on PyPI
Alternatives
Verify before relying
pip install pytype
pytype file_or_directory
# Or configure in pyproject.toml:
# [tool.pytype]
# inputs = ['package_name']
# Then run: pytype- Performance characteristics and analysis time for large codebases
- How inference accuracy compares to gradual typing on real-world projects
- Integration maturity with common IDEs and editor plugins
What it is and what it does
Pytype is a static type analyzer that infers types across your Python codebase without requiring type annotations. Unlike gradual type checkers, it detects type errors in unannotated code by analyzing control flow and operations, catching issues like passing an integer to a function expecting a string. It can also enforce user-provided type annotations where present and generate standalone .pyi stub files with inferred type information.
The tool is designed to be lenient—it allows operations that succeed at runtime and don't contradict annotations, rather than assigning fixed types at initialization. It runs on Python 3.10-3.12 and can analyze code targeting Python 3.8-3.12. Pytype is used at scale within Google and ships with helper tools like merge-pyi for integrating inferred types back into source files, plus configuration via pyproject.toml or setup.cfg.
Use it for
- Type-check plain Python codebases that lack annotations to catch attribute errors and type mismatches early
- Generate .pyi stub files for unannotated libraries to document inferred types and enable downstream type checking
- Enforce type annotations where present while remaining permissive on unannotated code in mixed-annotation projects
- Integrate type checking into CI/CD pipelines via GitHub Actions or similar to catch type errors before deployment
- Migrate legacy Python code toward type safety by inferring types and gradually adding annotations
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need type checking on unannotated Python code or want to infer types without strict gradual typing.
The active maintenance, permissive license, and lack of known vulnerabilities support adoption. Medium install friction (13 dependencies, compiled packages) and platform constraints (Linux primary, macOS supported, Windows via WSL) are the main tradeoffs; evaluate whether your target Python versions (3.10+) and platform match your needs.
Install
pytype on PyPI
Before you install
Medium install friction due to 13 runtime dependencies including compiled packages like ninja and libcst. Actively maintained with recent commits; last release 2024-10-11. Requires Python 3.10+ to run and a matching interpreter in $PATH for the code being analyzed.
Requires a Python 3.10+ interpreter to run pytype, plus a matching Python 3.8-3.12 interpreter in $PATH for the code being analyzed. On macOS, requires OSX 10.7+ and Xcode v8+. Windows requires WSL.
License in practice
Apache 2.0 permissive license allows use in commercial and proprietary projects with minimal restrictions; you must include a copy of the license and note significant changes.
Quickstart
pip install pytype
pytype file_or_directory
# Or configure in pyproject.toml:
# [tool.pytype]
# inputs = ['package_name']
# Then run: pytype
Verify before relying
- Performance characteristics and analysis time for large codebases
- How inference accuracy compares to gradual typing on real-world projects
- Integration maturity with common IDEs and editor plugins
Package facts
| License | Apache 2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 13 packagesattrsimportlabimmutabledictjinja2libcstmsgspecnetworkxninjapycnitepydottabulatetomltyping-extensions |
| Maintenance | Actively maintained 672 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,013,417 / month, #4,508 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development |
Evidence: pytype-2024.10.11-cp310-cp310-macosx_12_0_x86_64.whl; pytype-2024.10.11-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pytype-2024.10.11-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pytype-2024.10.11-cp311-cp311-macosx_10_14_universal2.whl; pytype-2024.10.11-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pytype-2024.10.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pytype-2024.10.11-cp312-cp312-macosx_10_14_universal2.whl; pytype-2024.10.11-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pytype-2024.10.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “python code linting and type analysis”
- pytypePytype is a static type checker that infers types in Python code…
- tyA fast Python type checker and language server written in Rust,…
- pylint-djangoA Pylint plugin that improves static analysis of Django code by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also types-typed-ast · types-contextvars · types-chardet · types-dataclasses · types-Pillow · types-PyJWT · types-attrs · types-emoji · beartype · types-DateTimeRange