Skip to content
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

Invalidate mypy cache if config changes #5007

Merged
merged 3 commits into from Feb 7, 2023
Merged

Invalidate mypy cache if config changes #5007

merged 3 commits into from Feb 7, 2023

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Feb 5, 2023

Implement Plugin.report_config_data to return all plugin config data. For every run, mypy will compare if the data matches the cached one if not the cache is discarded.

report_config_data is called multiple times for every file. I would have liked to use cached_property but that requires 3.8, unfortunately.

https://github.com/python/mypy/blob/v0.991/mypy/plugin.py#L539

This is my first PR here, so I wasn't quite sure which branch to target as this is an issue in both 1.10.x and main. Please let me know if I should change anything and I'll do so.

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

This is great, thanks so much.

Please change the base to main, if we think it should be backported to v1.10, we can do that easily.

If you want it backported, please also add a change description.

pydantic/mypy.py Show resolved Hide resolved
pydantic/mypy.py Show resolved Hide resolved
@cdce8p cdce8p changed the base branch from 1.10.X-fixes to main February 5, 2023 09:45
@cdce8p
Copy link
Contributor Author

cdce8p commented Feb 5, 2023

Please change the base to main, if we think it should be backported to v1.10, we can do that easily.

If you want it backported, please also add a change description.

Backporting it later as well would be great. I can open a separate PR for it after this one is merged.

The change description in HISTORY.md? Should I add it here already or only for the backport PR?

@samuelcolvin
Copy link
Member

No, see https://github.com/pydantic/pydantic/tree/main/changes

We have a bot to backport.

@samuelcolvin samuelcolvin added the cherry-pick-v1 cherry-pick back on 1.10.X-fixes label Feb 7, 2023
@samuelcolvin samuelcolvin merged commit 5290045 into pydantic:main Feb 7, 2023
@samuelcolvin
Copy link
Member

thanks so much.

github-actions bot pushed a commit that referenced this pull request Feb 7, 2023
* Invalidate mypy cache if config changes

* Add docstring

* Add change description
@cdce8p cdce8p deleted the fix-plugin branch February 7, 2023 22:15
hramezani pushed a commit that referenced this pull request Feb 9, 2023
* Invalidate mypy cache if config changes

* Add docstring

* Add change description

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-v1 cherry-pick back on 1.10.X-fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants