-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add pyright strict mode on the whole project #1254
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
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.
Pull Request Overview
This PR enables pyright strict mode across the entire project by adding comprehensive type annotations and fixing type-related issues. The changes improve type safety and developer experience while maintaining backward compatibility.
- Enhanced type safety with strict pyright configuration and proper type annotations
- Fixed import formatting by consolidating multi-line imports into single lines
- Added comprehensive type hints for function parameters, return values, and variables across test files, examples, and server implementations
Reviewed Changes
Copilot reviewed 74 out of 74 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
pyproject.toml | Enabled strict type checking with execution environments for different project areas |
tests/ | Added type annotations for variables, function parameters, and return types |
examples/ | Updated server and client examples with proper type hints and Context typing |
scripts/ | Fixed type annotations for regex match objects |
src/mcp/shared/memory.py | Consolidated imports and maintained existing functionality |
@@ -40,7 +40,7 @@ select = ["E", "F", "I"] | |||
ignore = [] | |||
|
|||
[tool.ruff] | |||
line-length = 88 | |||
line-length = 120 |
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.
Those changes were made to match the main line-length
. I did it in this PR because when I changed one of the files in the examples, it trigger the formatting.
It seems we do need to bump pydantic to 2.11.0, otherwise weird errors happen. There was a discussion about it here: #1041 (even if the PR didn't really bump pydantic in the package itself). |
Took me my morning, but I got it.
This PR doesn't have any change on the package itself (
src/mcp
).Note
See #1254 (comment), as
I had to bump pydantic to 2.11, and that may not be wanted? The package is broken for FastMCP with proper
generic usage on early versions of pydantic tho.