types-tensorflow
Typing stubs for tensorflow
What it is and what it does
types-tensorflow is a type stub package that provides type annotations for TensorFlow 2.18.0. It allows static type checkers like mypy, pyright, and ty to understand and validate TensorFlow code without requiring TensorFlow itself to be installed during type checking. The stubs are partially generated from TensorFlow's protobuf definitions using mypy-protobuf and tested against multiple type checkers.
The package is part of the typeshed project and marked as partial, meaning some annotations may be incomplete. It depends on numpy, types-protobuf, and requests—lightweight dependencies that support the type information layer. Use it when you want IDE autocompletion and static type validation for TensorFlow code in your editor or CI pipeline.
Use it for:
- Enable mypy or pyright to type-check TensorFlow code in CI/CD without installing the full TensorFlow package.
- Get IDE autocompletion and hover documentation for TensorFlow APIs in editors that support type stubs.
- Validate TensorFlow function signatures and argument types during development without runtime overhead.
- Support type-aware refactoring tools that rely on accurate type information for TensorFlow modules.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type hints for TensorFlow 2.18.0, enabling static type checkers to validate code that uses TensorFlow without requiring the full TensorFlow package to be installed.
Yes, if you use a static type checker with TensorFlow code. Install it as a dev dependency to enable type validation and IDE support. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a safe choice. Be aware it is a partial stub package—some annotations may be missing, and it targets TensorFlow 2.18.0 specifically.
Install
types-tensorflow on PyPI
pip
pip install types-tensorflowuv
uv add types-tensorflowpoetry
poetry add types-tensorflowInstalling types-tensorflow
Before you install
Low install friction with stable maintenance. Released 15 days ago with active repository status. Depends on numpy, types-protobuf, and requests—all common, well-maintained packages.
License in practice
Apache-2.0 permissive license allows use in most projects without restriction, including commercial and proprietary software.
Quickstart
pip install types-tensorflow
import tensorflow as tf
# Type checkers now understand tensorflow's API
Requires Python 3.10 or later. Intended for use with a type checker (mypy, pyright, or ty); does not provide runtime functionality.
Verify before relying
- Coverage completeness: the package is marked as partial; extent of missing annotations for TensorFlow 2.18.0 is not specified.
- Compatibility with TensorFlow versions beyond 2.18.0 or with older versions is not documented in the excerpt.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — numpy, types-protobuf, requests |
| Maintenance | actively maintained — 15 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 407,574/month — #6,886 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: types_tensorflow-2.18.0.20260730-py3-none-any.whl
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
types-PygmentsProvides type hints for the Pygments syntax…
permissive · top 5,000 on PyPI
types-dockerProvides type hints for the docker package,…
permissive · top 5,000 on PyPI
types-protobufProvides type stubs for the protobuf package,…
permissive · top 1,000 on PyPI
types-yt-dlpProvides type hints for yt-dlp, enabling static…
permissive · top 15,000 on PyPI
types-pyinstallerProvides type stubs for pyinstaller, enabling…
permissive · top 15,000 on PyPI
types-django-filterProvides type hints for django-filter, enabling…
permissive · top 15,000 on PyPI
types-grpcioProvides type stubs for the grpcio package,…
permissive · top 5,000 on PyPI
types-networkxProvides type stubs for networkx to enable…
permissive · top 5,000 on PyPI
types-pynputProvides type hints for the pynput library,…
permissive · top 15,000 on PyPI
types-hvacProvides type hints for the hvac package,…
permissive · top 15,000 on PyPI