-
-
Notifications
You must be signed in to change notification settings - Fork 454
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 show me the error you're getting when trying to import my settings #1346
Comments
Related: Maybe @ngnpope knows how to debug this? |
Check if this works: #1163 (comment) Also, I think the import cycle error is emitted by mypy. So it's out of our control changing the message. |
My interpretation of the message is that; when mypy tries to infer(basically figure out for itself) the type for the 'LOGGING' variable. It runs in to an import cycle, due to Django settings module. But what the cycle is only mypy knows. And I agree this could probably get a much more informative message |
The text of the error message I'm talking about comes from code in this project. |
Adding explicit annotations to the settings module used for type checking does seem to be helping, thank you. It feels weird to have to do this at all, since all the settings are already defined here, they're just defined as imports from other settings modules, all of which mypy correctly resolves when I use |
I just ran into this issue but only by
It happens in a Update: The suggested solution by @flaeppe referenced above solved this issue. Thanks! |
Since the issue here seems to be fixed with #1163 (comment) and there's an ongoing discussion if we can find an improvement in #2097. I'll close this for now |
Bug report
What's wrong
django-stubs
is complaining about an import cycle, but I don't get to see it and the project otherwise runs fine.Specifically, I get errors whenever anything accesses a
settings
attribute with a message likeerror: Import cycle from Django settings module prevents type inference for 'LOGGING' [misc]
.Since I do not know what the error actually is, and there is no obvious place around the place that message is sent (
transformers/settings.py
) to retrieve it, I have no idea how to start fixing this.How is that should be
I would like for there to be an option to see the full traceback of the error being alluded to here. It'd be cool if that option could be mentioned in the message about it, too.
I may be completely misunderstanding what this message means. If that's the case, I feel like it should probably be rephrased, because I'm struggling to come up with an interpretation other than "we got an
ImportError
accessing your settings". If that's not true, or if it's possible the error could be something other than an import cycle, the message should be changed. Either way, any additional detail about the nature of the problem would be very helpful.If there is another bug here, I'll try to make a smaller reproducible case once I'm able to see the actual error.
System information
python
version: 3.10django
version: 3.2.16mypy
version: 0.991django-stubs
version: i've seen this on 1.13.2 and 1.14.0django-stubs-ext
version: 0.7.0The text was updated successfully, but these errors were encountered: