PDFCLOUD-5416 Use basedpyright#3
Conversation
fad2758 to
79972f5
Compare
212217c to
5286be8
Compare
5286be8 to
37b6245
Compare
- Going to replace pyright with basedpyright and use strict checking there.
- But not from pre-commit
- Not used in the base class anyway.
- This is a convention. - Ensures that all ignored return values are explicit, helping to avoid bugs.
- Imported from typing_extensions for compatibility
Pydantic before validators deal with semi-unstructured data that will get fully validated when they reach the model, so ignore Pyright's complaints about unknown types.
...in fixture-like objects
- Only consume prebuilt wheels when building this package
37b6245 to
ed5d9cb
Compare
There was a problem hiding this comment.
I successfully installed basedpyright and observed it run with pre-commit.
There were no errors, but several warnings:
basedpyright.............................................................Failed
- hook id: basedpyright
- exit code: 1
<my-path>noxfile.py
<my-path>/noxfile.py:14:5 - warning: Result of call expression is of type "Action" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
<my-path>/noxfile.py:15:5 - warning: Result of call expression is of type "Action" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
<my-path>/noxfile.py:30:5 - warning: Result of call expression is of type "Any | None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
<my-path>/noxfile.py:39:5 - warning: Result of call expression is of type "Any | None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
0 errors, 4 warnings, 0 notes
none of which I regard as red flags, but it would be nice to knock 'em out if possible, while basedpyright is in the spotlight here.
|
I added (pre-commit isn't recommended for pyright, you'll notice it doesn't run basedpyright in pre-commit in CI, it has its own job. The recommendation is to install it in your IDE, and have the IDE warn you and CI as a backup, but since it's new, I'm helping do a transition) |
Use basedpyright, it's the easiest to use type checker at the moment. It also allows us to up some strictness, and baseline known warnings to clean up later.
See: https://docs.basedpyright.com/v1.31.4/
Integrate basedpyright with your IDE: https://docs.basedpyright.com/v1.31.4/installation/ides/