-
Notifications
You must be signed in to change notification settings - Fork 176
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
satisfy pyright
untyped decorators in mcp.server.fastmcp.server
#181
satisfy pyright
untyped decorators in mcp.server.fastmcp.server
#181
Conversation
@@ -162,3 +162,6 @@ cython_debug/ | |||
# and can be added to the global gitignore or merged into this file. For a more nuclear | |||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | |||
#.idea/ | |||
|
|||
# vscode | |||
.vscode/ |
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.
omit artifacts from vscode-based editors
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.
Terribel. Feel free to keep it. I dont use vscode myself but i am sure plenty people do.
pyright
complaining about untyped decorators in mcp.server.fastmcp.server.py
pyright
untyped decorators in mcp.server.fastmcp.server.py
pyright
untyped decorators in mcp.server.fastmcp.server.py
pyright
untyped decorators in mcp.server.fastmcp.server
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.
Thank you. This is great! Throwing this back into you queue for two pieces:
- Shall we rename
_Function
to something that is exported? - How can we check in CI/pre-commit that we won't break this?
src/mcp/server/fastmcp/server.py
Outdated
@@ -48,6 +49,8 @@ | |||
|
|||
logger = get_logger(__name__) | |||
|
|||
_Function: TypeAlias = Callable[..., Any] |
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.
Any reason to use the _
. I wonder if a caller wants to somehow wrap add_tool
and type it, they might want to reuse the type?
05bad54
to
a7a69e9
Compare
@dsp-ant - I've updated the PR to move/rename as for the question of catching typing regressions in CI, are you suggesting something in addition to the Not sure what'd be preferable to you, but happy to take a shot at it (here or follow up PR) if one of them sounds attractive! |
a7a69e9
to
ca06001
Compare
Is there abenefit over mypy? I guess the current checks should be sufficient right? |
Thank you! Much appreciated! The more type safety the better! |
I think so! perhaps someday a pyright config file in a the root of the repo could more specifically config that existing thanks for the review! |
Motivation and Context
using a
.vscode/settings.json
like thisthe following example throws squiggles on
main
How Has This Been Tested?
observing a marked lack of squiggles on this branch
Breaking Changes
no
Types of changes
Checklist
Additional context
i purposefully wasn't so prescriptive with
_Function
, happy to be more specific if neededif you're wondering how I got here: PrefectHQ/marvin#1042