{"id":4302,"library":"types-flask-cors","title":"Typing Stubs for Flask-Cors","description":"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.","status":"active","version":"6.0.0.20260408","language":"python","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","flask","cors","type-checking","typeshed"],"install":[{"cmd":"pip install types-flask-cors","lang":"bash","label":"Install types-flask-cors"}],"dependencies":[{"reason":"This package provides type stubs for the runtime library Flask-Cors, which must be installed separately to provide actual functionality.","package":"Flask-Cors","optional":false}],"imports":[{"wrong":"from flask_cors-stubs import CORS","symbol":"CORS","correct":"from flask_cors_stubs import CORS"}],"quickstart":{"code":"from flask import Flask, jsonify\nfrom flask_cors import CORS\n\napp = Flask(__name__)\n# Enable CORS for all routes and origins\nCORS(app)\n\n@app.route(\"/\")\ndef hello_world():\n    return jsonify({\"message\": \"Hello, cross-origin world!\"})\n\n@app.route(\"/api/data\")\ndef get_data():\n    return jsonify({\"data\": \"This is cross-origin data.\"})\n\nif __name__ == \"__main__\":\n    # Run the app, access at http://127.0.0.1:5000/\n    app.run(debug=True, port=5000)","lang":"python","description":"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."},"warnings":[{"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`.","message":"This 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Stub 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"While `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.","severity":"breaking","affected_versions":"All versions"},{"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.","message":"If 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.","severity":"deprecated","affected_versions":"Future versions of `Flask-Cors` (if it includes `py.typed`)"}],"env_vars":null,"search_vec":"'6.0':51 'accur':45 'annot':42,46 'applic':21 'automat':55 'central':38 'check':18,69 'cor':6,13,50,66 'cross':25 'cross-origin':24 'daili':62 'enabl':15 'flask':5,12,20,49,65 'flask-cor':4,11,48 'implement':23 'librari':14 'need':60 'often':61 'origin':26 'packag':30,53 'part':32 'project':36 'provid':44 'pypi':58 'releas':56 'repositori':39 'resourc':27 'share':28 'static':16 'stub':2,8,64 'type':1,7,17,41,63,68 'type-check':67 'typesh':35,52,70","created_at":"2026-04-12T03:49:34.262301+00:00","updated_at":"2026-04-16T23:36:27.795017+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'flask_cors_stubs'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"6.0.3.20260712","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/typeshed-internal/stub_uploader","docs":null,"changelog":"https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/Flask-Cors.md","pypi":"https://pypi.org/project/types-flask-cors/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-29","next_check":"2026-07-10","install_tag":null}}