-
Notifications
You must be signed in to change notification settings - Fork 49
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
PyCharm IDE cannot find references to unit classes #142
Comments
I wonder if we dynamically created an If PyCharm is doing this purely using text analysis then I don't think there's much we can do. We're definitely not going to go to explicitly listing everything since that would be a maintainance nightmare. |
This is also a problem in Visual Studio Code, IIRC. |
@JBorrow what do you do? Just ignore it? Do you ever use code completion with unit instances? @ngoldbaum I installed The result is my base Python file now no longer complains " |
Another idea that might work is to generate |
Back to the Inside __all__ = ["degC"]
degC: Unit I am unsure which is better. Does anyone have any thoughts?
|
Is it possible to dynamically define type annotations? If so, does PyCharm recognize those? It's also not clear to me from your examples that PyCharm would know how to deal with a dynamically defined |
2.7.1
3.6.9
macOS Mojave v10.14.3
2019.2.6 CE
Description
Since unit instances are added to
unyt
's namespace at runtime, PyCharm (Python IDE) cannot introspect the attributes of a given unit. PyCharm declares "Cannot find reference
".I would like to be able to use PyCharm's introspection to aid in developer speed (code completion) and decrease the chances of attribute errors.
Possible solution: this question suggests making a stub file. I am not sure if this is feasible.
What I Did
See this question on Stack Overflow.
The text was updated successfully, but these errors were encountered: