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

please write .mypy_cache/.gitignore by default #5863

Closed
douglasbagnall opened this issue Nov 1, 2018 · 4 comments
Closed

please write .mypy_cache/.gitignore by default #5863

douglasbagnall opened this issue Nov 1, 2018 · 4 comments

Comments

@douglasbagnall
Copy link

If when mypy writes a cache, it also did something like:

   with open(os.path.join(cache_dir, '.gitignore', 'w')) as f:
         f.write('*')

i.e. echo '*' > .mypy_cache/.gitignore

then nobody would ever be annoyed by the sudden appearance of thousands of untracked files.

Note this differs from issue #3336 which added the ignore files to particular projects. This would work for every project, and not interfere with anybody's existing top-level .gitignores.

I have not found the right place in the code to make the patch.

@refi64
Copy link
Contributor

refi64 commented Nov 1, 2018

IMO this shouldn't be the default. People will do weird stuff involving intentionally committing the cache to a repo for saving or reproducibility. It's definitely a bit odd, but this would make it work pretty far against the principle of least surprise.

Realistically, people will probably have other Python tooling-related stuff in their gitignore anyway.

@ethanhs
Copy link
Collaborator

ethanhs commented Nov 1, 2018

On top of the principle of least surprise, I'd rather not do this for each vcs that exists, and doing this just for git seems... weird.

@takeda
Copy link

takeda commented Jul 19, 2021

@refi64 @ethanhs looks like it was added anyway, sigh: #8193

This is an issue, if there is a tooling that parses .gitignore but doesn't traverse subdirectories. In those cases the .mypy_cache might still end up being processed, because of this change I forgot to add it to root folder's .gitignore.

It won't kill me, but this was totally unnecessary, and it is a gotcha if one is not aware of it.

@ethanhs
Copy link
Collaborator

ethanhs commented Jul 20, 2021

This is an issue, if there is a tooling that parses .gitignore but doesn't traverse subdirectories.

That sounds like a bug in the tool you are using, not mypy. Furthermore, I do think most people probably are using mypy in a git vcs system where they don't want to check the cache into version control. Covering the 80% case seems like a good idea to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants