Skip to content

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

Closed
@toolness

Description

@toolness

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions