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

Mypy cache doesn't update if type stubs refer to first-party code #5489

Closed
toolness opened this issue Aug 16, 2018 · 3 comments
Closed

Mypy cache doesn't update if type stubs refer to first-party code #5489

toolness opened this issue Aug 16, 2018 · 3 comments
Labels
bug mypy got something wrong priority-1-normal

Comments

@toolness
Copy link

toolness commented Aug 16, 2018

Hi, I have a very unusual use case. It's ok if this issue doesn't end up being resolved but I figured I'd report it just in case.

Basically, I have a Django project, let's say it's a package called myproject, and it has a settings module at myproject.settings. The idiomatic Django way to expose these settings is via a from djang.conf import settings import, but these settings are largely just an alias to my own settings module. So as a quick win for strong typing, I thought I'd make a stub for django.conf.settings that looked like this:

# mypy-stubs/django/conf/settings.pyi
from myproject.settings import *

So the stub is pointing back at my first-party code, which is probably unexpected. This used to work fine all the time before mypy introduced incremental mode, but now that it defaults to incremental mode, I've noticed that I have to delete my .mypy_cache directory whenever I change typings in myproject.settings--otherwise mypy thinks that the typings for django.conf.settings are the stale version.

Anyhow, like I said, this is a very weird use case and probably not worth your time, but I figured I'd report it just in case.

@JelleZijlstra
Copy link
Member

I think #5465 may have fixed this.

@ilevkivskyi
Copy link
Member

Hm, I am not sure, but it indeed may be the case. @toolness could you please try the current master to see if you can still reproduce the problem?

@ilevkivskyi ilevkivskyi added bug mypy got something wrong priority-1-normal labels Aug 16, 2018
@toolness
Copy link
Author

Hey, sorry for the super late response here--this bug has definitely been fixed as of 0.641 (or possibly earlier than that). I upgraded and editing my first-party settings.py code is now instantaneously reflected into my settings.pyi stub, so thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-1-normal
Projects
None yet
Development

No branches or pull requests

3 participants