Skip to content

Reset cache on mypy change #1952

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

Merged
merged 4 commits into from
Jul 29, 2016

Conversation

Michael0x2a
Copy link
Collaborator

@Michael0x2a Michael0x2a commented Jul 28, 2016

This pull request modifies build.py to add an extra "version_id" attribute to the cache metadata. If the version id specified in mypy/version.py differs from the id stored in the cached data, mypy will automatically invalidate that cached data.

This pull request will also modify setup.py to automatically edit the installed mypy/version.py file during installation to include the git hash if applicable.

If setup.py is not being run from a git repo, or if a git executable can't be found in the system, mypy will default to using the original version id.

The net effect should be that...

  • Developers who directly run mypy from a git repo will still need to manually delete their cache when the cache format changes.
  • Users who install mypy from PyPi will not have their version.py files edited during installation to include the git commit hash. However, their cache will still be invalidated whenever they update since we manually change the __version__ variable per each release.
  • Users who pip-install mypy directly from the git repo will have their version.py files edited during installation to include the git commit hash. That means their cache will be automatically invalidated even if the __version__ variable is the same as before.

Fixes #1354.

This commit modifies build.py to add an extra "version_id" attribute to
the cache metadata. If the version id specified in mypy/version.py
differs from the id stored in the cached data, mypy will automatically
invalidate that cached data.
This commit modifies setup.py to automatically edit the installed
mypy/version.py file during installation to include the git hash if
applicable.

If setup.py is not being run from a git repo, or if a git executable
can't be found in the system, mypy will default to using the original
version id.
@@ -717,14 +722,17 @@ def find_cache_meta(id: str, path: str, manager: BuildManager) -> Optional[Cache
meta.get('child_modules', []),
meta.get('options'),
meta.get('dep_prios', []),
meta.get('version_id')
Copy link
Member

Choose a reason for hiding this comment

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

Trailing comma.

@gvanrossum
Copy link
Member

That's all I've got. And the "." works fine, so no worries about that. So really, just two trailing commas. :-)

@gvanrossum gvanrossum merged commit 4c1d5de into python:master Jul 29, 2016
@Michael0x2a Michael0x2a deleted the reset-cache-on-mypy-change branch September 1, 2016 21:05
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