-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add tool to convert binary cache files to JSON #20071
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
… output JSON Also add tests.
This comment has been minimized.
This comment has been minimized.
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.
Nice! Thanks for adding this.
|
Test failure on Python 3.9 seems to be caused by |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Work to enable #19697 (see the issue for motivation).
Copy the old
serializemethods with some modifications and use them in the export tool. This will let us remove the oldserializeanddeserializemethods once we drop support for the old JSON serialization format at some point.This should be enough to support existing use cases that inspect the JSON files. Instead of directly inspecting them, users will have to run the tool first if they use the binary cache format. Example:
The run generates the
.mypy_cache/3.13/foobar.data.ff.jsonfile, which is similar to existing to cache json files.I added some tests and manually checked that the JSON file for
builtinsmodule is identical to the one generated by mypy. However, we won't guarantee that all new symbol table or cache features will be added to the exporter, to simplify maintenance. Also I didn't test all features of the exporter in the tests -- I just ensure that the basics work. The tool is primarily there to support existing use cases and debugging workflows, and it would be better to useMypyFile.read(...)in new use cases that require cache inspection.