skillfed

types-tensorflow

Typing stubs for tensorflow

types-tensorflow v2.18.0.20260730 407.6K downloads/30d#6,886 on PyPI37
Permissive license Apache-2.0 Active released

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

uv

uv add types-tensorflow

poetry

poetry add types-tensorflow

Installing 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

Programming Language :: Python :: 3Typing :: Stubs Only

Tags

tensorflow type stubstensorflow type hintstype checking tensorflowtensorflow mypy supporttensorflow static typingtensorflow type annotationstensorflow pyright stubs
type-stubsstatic-typing

More Quality Assurance packages