-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support selectively disabling reportImportCycle #3489
Comments
works. pyright ignore/type ignore target a specific line and this error does not seem to be attached to any line number. |
Thanks! I'll try it out. But it would also be nice to be able to specify a specific line. I would imagine the import cycle detector parses and follows import statements, so it's theoretically possible to tag a line to not follow the import |
Most of the diagnostic rules in pyright operate at the source file level. The As @hmc-cs-mdrissi mentioned, you can suppress the We don't have plans to change the way the import cycle detection works, so if you intend to leave some cycles in your program but still want to leave the |
✨ _**This is an old work account. Please reference @brandonchinn178 for all future communication**_ ✨
<!-- updated by mention_personal_account_in_comments.py -->
…---
Is the import dependency graph used by something else? If not, couldnt the
logic that builds up the import dependency graph check if an import is
ignored before adding the edge to the graph?
On Fri, May 20, 2022, 6:38 PM Eric Traut ***@***.***> wrote:
Closed #3489 <#3489> as
completed.
—
Reply to this email directly, view it on GitHub
<#3489 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGUC75IC4BA5AZMTE5OQNOLVLA5BTANCNFSM5WQN4QIQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
That would involve a pretty major change to the design. As I said, we don't have plans to change how this works at this time. |
Is your feature request related to a problem? Please describe.
There have been multiple issues opened around this topic: #746, #1825, #3278. And FWIW, I agree with most of the comments, except for:
In our codebase, where we have ~5 models that are ~500 lines each, it'd really be a pain to maintain them all in a single file. Currently, the following code does work:
The problem comes when typing the return types. Currently, the best solution I can think of is
But this fails with "Cycle detected in import chain", with no way to say "This
import mymodule
line creates the cycle, but I want to explicitly allow this".Aside from putting everything into one module, it seems like the only other alternative today is to disable this diagnostic check entirely (or exclude
mymodule/__init__.py
from being checked by pyright). But in general, we do like this check, just want to disable it in select locations where we know it to be safe.Describe the solution you'd like
It would be great for
to Just Work.
Additional context
The text was updated successfully, but these errors were encountered: