-
Notifications
You must be signed in to change notification settings - Fork 10
Switch type-checking from pyright to ty
#242
New issue
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,10 +47,12 @@ dev = [ | |
| "gunicorn==25.3.0", | ||
| "hypercorn==0.18.0", | ||
| "poethepoet==0.45.0", | ||
| "pyright[nodejs]==1.1.409", | ||
| "pyvoy==0.3.0", | ||
| "ruff==0.15.12", | ||
| "tombi==0.10.2", | ||
| "ty==0.0.34", | ||
| "types-grpcio==1.0.0.20260408", | ||
| "types-protobuf==7.34.1.20260503", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks - didn't realize there was this hatch for getting protobuf working with it |
||
| "typing_extensions==4.15.0", | ||
| "uvicorn==0.46.0", | ||
| "zstandard==0.25.0", | ||
|
|
@@ -79,30 +81,6 @@ docs = ["mkdocstrings-python==2.0.3", "zensical==0.0.39"] | |
| requires = ["uv_build>=0.11.0,<0.12.0"] | ||
| build-backend = "uv_build" | ||
|
|
||
| [tool.pyright] | ||
| exclude = [ | ||
| # Defaults. | ||
| "**/node_modules", | ||
| "**/__pycache__", | ||
| "**/.*", | ||
| ".venv", | ||
|
|
||
| # Recent versions of typeshed fail on 5.x gencode. | ||
| # https://github.com/python/typeshed/pull/15677 | ||
| "**/*_pb.py", | ||
|
|
||
| # Recent versions of typeshed have improved typing of functions that then expose | ||
| # type errors for accessing | ||
| "**/*_pb2.py", | ||
|
|
||
| # GRPC python files don't typecheck on their own. | ||
| # See https://github.com/grpc/grpc/issues/39555 | ||
| "**/*_pb2_grpc.py", | ||
|
|
||
| # TODO: Work out the import issues to allow it to work. | ||
| "conformance/**", | ||
| ] | ||
|
|
||
| [tool.pytest] | ||
| # Turn all warnings into errors | ||
| filterwarnings = ["error"] | ||
|
|
@@ -250,6 +228,19 @@ typing-extensions = false | |
| required-imports = ["from __future__ import annotations"] | ||
| split-on-trailing-comma = false | ||
|
|
||
| [tool.ty.src] | ||
| exclude = [ | ||
| # gRPC generated code references `grpc.experimental`, which is not exposed by the | ||
| # `grpc` package's public API. See https://github.com/grpc/grpc/issues/39555. | ||
| "**/*_pb2_grpc.py", | ||
| ] | ||
|
|
||
| [tool.ty.environment] | ||
| # Conformance test files import generated code as `from gen.connectrpc...` and | ||
| # sibling modules like `_util`/`_cov_embed`. Pytest and the launched server/client | ||
| # subprocesses put `conformance/test/` on sys.path; teach ty to do the same. | ||
| extra-paths = ["conformance/test"] | ||
|
|
||
| [tool.uv] | ||
| constraint-dependencies = [ | ||
| "coverage==7.13.2", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ | |
| from pyqwest import Headers as HTTPHeaders | ||
|
|
||
| from . import _client_shared | ||
| from ._asyncio_timeout import timeout as asyncio_timeout | ||
| from ._codec import proto_binary_codec | ||
| from ._compression import IdentityCompression, _gzip, resolve_compressions | ||
| from ._interceptor_async import ( | ||
|
|
@@ -31,9 +30,7 @@ | |
| from .protocol import ProtocolType | ||
|
|
||
| try: | ||
| from asyncio import ( | ||
| timeout as asyncio_timeout, # pyright: ignore[reportAttributeAccessIssue] | ||
| ) | ||
| from asyncio import timeout as asyncio_timeout # ty: ignore[unresolved-import] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. switched in f3b7d18! |
||
| except ImportError: | ||
| from ._asyncio_timeout import timeout as asyncio_timeout | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this doesn't hurt though adding
conformanceto the search paths would also make sense, I guess any pytest root should be added to it in principle.Reminds me of the days when conformance was a separate pyproject, with renovate working properly we may consider eventually going back to that to reduce pythonpath worries