Skip to content

Update JSON export tool to support binary meta cache files#20096

Merged
JukkaL merged 5 commits intomasterfrom
cache-meta-export
Feb 4, 2026
Merged

Update JSON export tool to support binary meta cache files#20096
JukkaL merged 5 commits intomasterfrom
cache-meta-export

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Oct 21, 2025

The test case needs to filter out quite a few things that are unpredictable.

@JukkaL JukkaL requested a review from ilevkivskyi October 21, 2025 10:44
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

LG, thanks!

@@ -1,4 +1,4 @@
"""Tool to convert mypy cache file to a JSON format (print to stdout).
"""Tool to convert binary mypy cache files (.ff) to JSON (.ff.json).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""Tool to convert binary mypy cache files (.ff) to JSON (.ff.json).
"""Tool to convert binary mypy cache files (.ff) to JSON (.json).

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see you actually don't strip the original extension. I think it is better to do this, i.e. use .data.json or .meta.json for output files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did it this way so that there is no confusion between the "real" JSON cache files and the ones produced by the converter -- there's no guarantee that mypy will be able to read the output, since we don't guarantee that it stays in sync with the actual JSON format.

@github-actions

This comment has been minimized.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Oct 21, 2025

Interesting, file hashes appear to be different on Windows. Maybe it's due to CRLF conversion. I will investigate -- maybe the test found a minor bug or at least inconsistency.

@ilevkivskyi
Copy link
Member

@JukkaL do you want to include this one in the release? There is still a failing test on Windows.

@ilevkivskyi
Copy link
Member

I think we should flip the default for --fixed-format-cache in the next release, so it is better to have this ready soon.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@ilevkivskyi
Copy link
Member

@JukkaL for now I simply skip the size and hash comparison on Windows, this is likely a newline-related thing. All tests pass now, so that this is ready to be merged.

@ilevkivskyi
Copy link
Member

@JukkaL if you don't have objections, I would merge this one, just to tick that checkbox.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Feb 4, 2026

Ah I lost track of this. Thanks for working around the Windows issue!

@JukkaL JukkaL closed this Feb 4, 2026
@JukkaL JukkaL reopened this Feb 4, 2026
@JukkaL JukkaL merged commit 3d7f6c8 into master Feb 4, 2026
43 of 44 checks passed
@JukkaL JukkaL deleted the cache-meta-export branch February 4, 2026 15:18
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

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.

2 participants