-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix dj_database_url required key #7979
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
Conversation
This comment has been minimized.
This comment has been minimized.
Interesting. From my reading of the source code, NAME is guaranteed to be present in the dictionary in both code paths:
But ENGINE is only guaranteed to be present in the dictionary in one of the two code paths:
Where am I misreading the code? :) |
You're not. That's indeed the case, I had misinterpented the problem, but there's still one: Assigning, for example, My problem is that I have something like this on the settings of my Django project:
Since mypy got its type from That's the problem. I think the solution, would be to have everything as optional, as that's what django expects. Alternatively, I can just set DATABASES to empty dict after the |
I've made the change to make everything optional. Also, for reference, I'm beginning, to think, that's the best solution, to make sure it behaves nicely. Especially, since there are more keys missing from what What do you think? |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thanks for the fix!
If I wanted to test these stubs against my project, how would I go about doing so?
If you want to test changes to these stubs prior to filing a PR, you can make the changes in your local clone of typeshed, and then point mypy towards these stubs by using the MYPYPATH
environment variable and setting it to the stubs
directory in your local clone of typeshed. If your project's open-source, you could also make a request to have it added to the mypy_primer project :)
Hey. It's me again.
I've happily installed
types-dj-database-url
, but it seems I've made a small mistake with the PR from earlier. For reference: #7972 .Required key is ENGINE and not NAME. This fixes that issue.
A question, I have, you might be able to answer me: I have a project that uses dj-database-url. If I wanted to test these stubs against my project, how would I go about doing so?
Thanks.