Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@booxter
Copy link
Contributor

@booxter booxter commented Jan 27, 2025

This may help us avoid some spurious mypy warnings when it gets confused by pydantic magick.

https://docs.pydantic.dev/latest/integrations/mypy/

Noticed when looking at mypy violations under #2977

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the
    conventional commits.
  • Changelog updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Functional tests have been added, if necessary.
  • E2E Workflow tests have been added, if necessary.

@booxter booxter force-pushed the pydantic-plugin branch 2 times, most recently from 7868648 to 51ad136 Compare January 27, 2025 17:30
@nathan-weinberg
Copy link
Member

What is the functional expectation as a result of this change?

@booxter
Copy link
Contributor Author

booxter commented Jan 27, 2025

@nathan-weinberg sorry should have included the URL to plugin docs in PR description (it was in commit message only). Here it is: https://docs.pydantic.dev/latest/integrations/mypy/

tl;dr it may help mypy not fail on some tricky pydantic code. One example of this would be #2977 (comment) (point 2) except because there's a bug in pydantic itself and the fix for it is not, yet, released, we have to type: ignore it atm. But once we adopt a new pydantic version, we will need the plugin to not fail on that line.

It also adds some additional typing checks too, so fewer gaps in coverage.


On second thought, there are probably more options to tighten checks with the plugin, so I'll explore these first and include in this PR. I will move this to draft for now.

@booxter booxter marked this pull request as draft January 27, 2025 20:49
This may help us avoid some spurious mypy warnings when it gets confused
by pydantic magick. It may also catch some additional typing violations
in pydantic model definitions that are not recognized by stock mypy.

See details about the plugin and what it provides at:
https://docs.pydantic.dev/latest/integrations/mypy/

Note: this change also enables all strict checks for the plugin.
Fortunately, the code tree didn't have anything to adjust to adopt
these.

Signed-off-by: Ihar Hrachyshka <[email protected]>
@booxter booxter marked this pull request as ready for review January 27, 2025 22:31
@mergify mergify bot added the one-approval PR has one approval from a maintainer label Feb 6, 2025
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had activity within 60 days. It will be automatically closed if no further activity occurs within 30 days.

@github-actions github-actions bot added the stale label Apr 10, 2025
@booxter booxter removed the stale label Apr 10, 2025
@booxter
Copy link
Contributor Author

booxter commented Apr 28, 2025

On one hand, it's really a low importance change. On the other hand, I am surprised we can't find a second reviewer to just let it in. :)

@mergify mergify bot merged commit 8d4b558 into instructlab:main Apr 28, 2025
27 checks passed
@mergify mergify bot removed the one-approval PR has one approval from a maintainer label Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants