Registry / type-stubs / types-flask-cors

types-flask-cors

JSON →
library6.0.3.20260712pypypi✓ verified 27d ago

Typing stubs for the Flask-Cors library, enabling static type checking for Flask applications that implement Cross-Origin Resource Sharing. This package is part of the typeshed project, a central repository for type annotations, and provides accurate annotations for `Flask-Cors==6.0.*`. Typeshed packages are automatically released to PyPI as needed, often daily.

pip install types-flask-cors
INSTALL
IMPORT
SIG · TYPES-FLASK-CORS
T
types-flask-cors
type-stubspythonv6.0.3.20260712
Install
2.2s avg
Import
—
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v6.0.3.20260712 · 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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.2s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage

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

CORS
✓ from flask_cors_stubs import CORS
✗ from flask_cors-stubs import CORS

To use `types-flask-cors`, you first need to set up a basic Flask application with `Flask-Cors` enabled. The `types-flask-cors` package does not require any direct code changes; simply installing it allows your type checker (e.g., MyPy, Pyright) to provide static analysis for your `Flask-Cors` usage.

from flask import Flask, jsonify from flask_cors import CORS app = Flask(__name__) # Enable CORS for all routes and origins CORS(app) @app.route("/") def hello_world(): return jsonify({"message": "Hello, cross-origin world!"}) @app.route("/api/data") def get_data(): return jsonify({"data": "This is cross-origin data."}) if __name__ == "__main__": # Run the app, access at http://127.0.0.1:5000/ app.run(debug=True, port=5000)
Debug
Known issues
gotchaThis is a stub-only package (`.pyi` files) for static type checking. It does not contain any runtime code and should not be imported from directly. Its sole purpose is to provide type hints for the `Flask-Cors` library to tools like MyPy or Pyright.
fix
Install `types-flask-cors` via `pip` and ensure `Flask-Cors` is also installed. Import `CORS` and `cross_origin` from the `flask_cors` runtime library, not `types_flask_cors`.
affects: All versions
gotchaStub packages from `typeshed`, like `types-flask-cors`, aim to be compatible with a specific major/minor version range of the runtime library. For example, `types-flask-cors==6.0.0.X` is designed for `Flask-Cors==6.0.*`. Mismatched versions can lead to incorrect or incomplete type checking results.
fix
Always ensure the `types-flask-cors` version aligns with the `Flask-Cors` version being used in your project. Refer to the `types-flask-cors` PyPI page for the specific `Flask-Cors` version it targets in its description.
affects: All versions
breakingWhile `typeshed` strives for stability, updates to stub packages can introduce changes that cause your code to fail type checking, even if the underlying `Flask-Cors` runtime library has not changed. This is inherent to the nature of refining type definitions and improving type accuracy.
fix
Pin `types-flask-cors` to a specific version (e.g., `types-flask-cors==6.0.0.20260408`) or a compatible range in your `requirements.txt` to mitigate unexpected type-checking failures after updates. Regularly review type checker output after updating stub packages.
affects: All versions
deprecatedIf the `Flask-Cors` library itself begins shipping with inline type annotations or its own `py.typed` file in a future version, this `types-flask-cors` stub package will become redundant and may eventually be deprecated or removed from `typeshed`. Installing both could lead to conflicts or degraded type-checking performance.
fix
Check the `Flask-Cors` documentation or PyPI page for information on native type support. If `Flask-Cors` includes a `py.typed` file, uninstall `types-flask-cors` to avoid potential issues.
affects: Future versions of `Flask-Cors` (if it includes `py.typed`)
Upgrade
Version history
6.0.3.20260712latest on PyPI · released Jul 12, 2026
Audit
Dependencies
Flask-CorsrequiredThis package provides type stubs for the runtime library Flask-Cors, which must be installed separately to provide actual functionality.
Agent activity
33 hits · last 30 days
node
30
Amazon
1
OpenAI (training)
1
Resources
types-flask-cors — pip install types-flask-cors · libregistry