-
Notifications
You must be signed in to change notification settings - Fork 1
[1/5] Typing cleanup #13
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
Conversation
31c31f3 to
58d2a77
Compare
|
|
||
| [tool.poe.tasks] | ||
| lint = [ | ||
| {cmd = "uv run basedpyright src"}, |
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.
The benefit of basedpyright is that it enforces precisely the set of diagnostics in pyproject.toml, when run as a CLI and when run via LSP. This allows SDK developers to choose to use an IDE setup that will match CI. (Cursor users don't have to do anything, they have no choice but to use a type checker based on basedpyright)
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.
At this commit we are checking src/ only; that is extended to tests in a subsequent PR.
6a5080c to
daee4f6
Compare
|
|
||
| @dataclass_transform() | ||
| class _BaseTestCase: | ||
| pass |
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'm using dataclass_transform in tests to allow me to create classes of the form
class MyTestCaseClass:
some_attr: FooMyTestCaseClass is never instantiated in my tests; it's syntactic/ergonomic convenience for a module to hold some nexus service definition.
My expectation was that @dataclass_transform could be used directly on the class, but it appears to only take effect when applied to a parent class.
pyproject.toml
Outdated
| "poethepoet>=0.35.0", | ||
| "pydoctor>=25.4.0", | ||
| "pyright>=1.1.402", | ||
| "pyright==1.1.403", |
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.
Why fixate pyright here? Our users may have long since updated past this while we stay on this specific version so we won't catch new things. I don't necessarily mind it though if we keep on top of it.
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.
This was unintentional (resulted from me doing a thoughtless uv command: uv add --group dev pyright==$version.
Tbh I've mainly been doing this because pyright prints a noisy nagging notice to the terminal on uv sync.
I've changed it to pyright>=1.1
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.
It looks like we're going to get a lot of noise on PRs for stuff we have around for older Python. Maybe we should disable reportDeprecated for now?
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.
Agreed. I've done that now. It's a shame because I'd like the deprecation warnings in the IDE but I agree the PR noise it intolerable so this seems like the only option until we find another way around it.
daee4f6 to
635a365
Compare
AI: This commit should have tag name typing-cleanup and should be force-pushed to a branch of that name as necessary.
635a365 to
6e68f3f
Compare
This is PR 1/5 in a stack.
Clean up typing with the aim of having zero type errors reported by pyright in IDE, enforced in CI.