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

Add mypy plugin #340

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

mvandenburgh
Copy link

Fixes #267. Related issue in the django-stubs repo - typeddjango/django-stubs#417

I've also added a section to the docs describing how to use this.

@RJPercival
Copy link

RJPercival commented Sep 22, 2022

Unfortunately, this won't work well for any settings that have a value of None, {} or [], i.e. settings where their type can't be inferred from their runtime value. For those, you'll get errors like Invalid index type "str" for "dict"; expected type "_KT". A better approach would be to make a mypy plugin that can find the setting definitions on the Configuration subclass that you're using and take the type hints from there. I've written such a plugin and it works well, but haven't had time to open-source it yet. If anyone wants that plugin, let me know here and I'll spend some time open-sourcing it.

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.

mypy - django-configurations settings importer wasn't correctly installed
2 participants