Make mypy -V show git commit hash more often#2394
Merged
gvanrossum merged 3 commits intomasterfrom Nov 3, 2016
Merged
Conversation
JukkaL
reviewed
Nov 3, 2016
| __version__ = '0.4.6-dev' | ||
|
|
||
| mypy_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) | ||
| if git.is_git_repo(mypy_dir) and git.have_git(): |
Collaborator
There was a problem hiding this comment.
When run from a repo, these seem to add maybe 30 msec to the mypy runtime when there is a warm cache. This looks like up to 6% slowdown, which is not terrible if most users are using a pip-installed version. However, this could be much worse on cold cache. Can you check the effect on mypy runtime when run straight after restart?
Member
Author
|
We chatted offline, the extra cost is not that much even with a cold cache (I tried |
Member
Author
|
Wondering if this went too far. I am now getting warnings when running |
This was referenced Nov 14, 2016
This was referenced Dec 20, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the git commit hash was only appended to
__version__by setup.py. Now we do this dynamically in mypy/version.py. This means the commit hash is also reported when run directly from the repo (e.g.python3 -m mypy -Vfrom the repo root). It is also used by the cache in this case.I didn't notice any slowdown. Notice the contents of version.py in distributions is still overwritten by setup.py so a properly installed version should not be executing any git commands at startup.