Skip to content

Conversation

vblagoje
Copy link
Member

Related Issues

Proposed Changes:

  • run hatch run test:types and fix type errors
    (this means testing with all dependencies installed, differently from hatch run lint:typing that did not install dependencies)
  • use hatch run test:types in the test workflow
  • remove hatch run lint:typing
  • introduce stricter configuration in pyproject.toml (and fix small errors)
  • add py.typed to allows usage of types in downstream projects
    • as shown in feat: Chroma - fix typing + ship types by adding py.typed files #1910, these files should be put in submodules of the namespace packages
    • the namespace package is haystack_integrations
    • in this case, I put py.typed in
      • integrations/mcp/src/haystack_integrations/tools/mcp/py.typed
      • as a rule of thumb, py.typed files should be placed at the same level as the inner folder that corresponds to the integration name.

How did you test it?

CI

Notes for the reviewer

This PR can be seen as a complete example of the work we need to do for each integration to fix #1771.

Checklist

@vblagoje vblagoje marked this pull request as ready for review September 10, 2025 15:02
@vblagoje vblagoje requested a review from a team as a code owner September 10, 2025 15:02
@vblagoje vblagoje requested review from davidsbatista and removed request for a team September 10, 2025 15:02
Copy link
Contributor

@davidsbatista davidsbatista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 92 to 93
"mcp.*",
"mcp",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid adding mcp to ignore_missing_imports?
Otherwise, we'd end up not verifying MCP types at all

@github-actions github-actions bot added the type:documentation Improvements or additions to documentation label Sep 16, 2025
@vblagoje
Copy link
Member Author

@anakin87 thanks for spotting this, see 0a873c8
Are we gtg now?

Comment on lines 89 to 96
[[tool.mypy.overrides]]
# MCP package types
module = [
"httpx",
"exceptiongroup",
"anyio.*",
]
ignore_missing_imports = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried removing this block altogether?
If possible, it would be the best thing to do. But sometimes, libraries do not provide valid types, so it's not always doable.

Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@vblagoje vblagoje merged commit d8d5d2e into main Sep 16, 2025
11 checks passed
@vblagoje vblagoje deleted the mcp_typed branch September 16, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:mcp topic:CI type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate better typing configuration for core integrations
3 participants