We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a very simple script here:
from time import time, sleep from typing import Iterator from flask import Flask, Response def main() -> None: app = Flask("Testing server") last_started = int(time()) @app.route("/reload", methods=["GET"]) def reload() -> Response: def stream() -> Iterator[str]: # When this is reloaded, it will actually break the connection. while True: yield f"data: {last_started}\n\n" sleep(1) # pragma: nocover return Response(stream(), mimetype="text/event-stream") app.run(host="127.0.0.1", port=3001, use_reloader=True) if __name__ == "__main__": main()
mypy --strict is happy with it.
mypy --strict
However, pyright is not.
pyright
$ pyright server.py Searching for source files Found 1 source file server.py server.py:4:26 - error: "Response" is not exported from module "flask.app" Import from "flask.wrappers" instead (reportPrivateImportUsage) 1 error, 0 warnings, 0 informations Completed in 1.155sec
I was surprised, at first, thinking this was a pyright bug. But perhaps it's not?
microsoft/pyright#2639
The text was updated successfully, but these errors were encountered:
Update to the latest version of Flask. If that doesn't fix it, it's a bug with pyright.
Sorry, something went wrong.
I'm using flask 2.1.1, which is currently the latest version.
You can see the pyright explanation here: https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface
I wonder if it follows PEP-561 more strictly than mypy.
No branches or pull requests
I have a very simple script here:
mypy --strict
is happy with it.However,
pyright
is not.I was surprised, at first, thinking this was a pyright bug. But perhaps it's not?
microsoft/pyright#2639
The text was updated successfully, but these errors were encountered: