Registry / type-stubs / types-flask

types-flask

JSON →
library1.1.6pypypi✓ verified 25d ago

types-flask is a PEP 561 type stub package providing static type information for the Flask web framework. It allows type-checking tools like MyPy, PyCharm, and Pyright to analyze code that uses Flask, catching potential type-related errors before runtime. The current version is 1.1.6. It is part of the `typeshed` project, which generally releases updates as needed to align with changes in the runtime libraries it provides stubs for, although its primary function for Flask versions 2.0 and newer has been superseded by Flask's native type annotations.

pip install types-flask
INSTALL
IMPORT
SIG · TYPES-FLASK
T
types-flask
type-stubspythonv1.1.6
Install
1.8s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Flask
from flask_stubs import Flask
from flask-stubs import Flask

This minimal Flask application demonstrates basic routing. If you are using Flask version prior to 2.0, `types-flask` would provide type checking for this code. For Flask 2.0 and newer, Flask includes its own type annotations, rendering `types-flask` unnecessary.

from flask import Flask app = Flask(__name__) @app.route('/') def hello_world() -> str: return 'Hello, World!' # To run (if Flask < 2.0 and types-flask is needed): # FLASK_APP=app.py FLASK_ENV=development mypy app.py # FLASK_APP=app.py flask run
Debug
Known issues
breakingFor Flask versions 2.0 and above, the `flask` package itself includes type annotations. Installing `types-flask` alongside Flask 2.0+ can lead to conflicts or redundant type information.
fix
Uninstall `types-flask` if you are using Flask 2.0 or a newer version: `pip uninstall types-flask`.
affects: Flask >= 2.0
gotcha`types-flask` is a stub package and does not add any new runtime functionality or modules. All imports should still target the original `flask` library.
fix
Continue to import symbols directly from `flask` (e.g., `from flask import Flask`), as `types-flask` only provides static type definitions for these existing symbols.
affects: All versions
gotchaThe versioning of `types-flask` is tied to the `typeshed` project and may not directly correspond to specific `flask` package versions. Ensure compatibility by checking `typeshed`'s `Flask` stub history if encountering type-checking issues with specific `flask` versions prior to 2.0.
fix
Consult the `typeshed` repository's `stubs/Flask` directory for details on which `flask` versions are supported by specific `types-flask` releases.
affects: < Flask 2.0
Upgrade
Version history
1.1.6latest on PyPI · released Nov 26, 2021
Audit
Dependencies
flaskrequiredProvides type stubs for the Flask web framework.
Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
types-flask — pip install types-flask · libregistry