I keep getting this warning in PyCharm 2018.3.5: "Type hints are not installed".
If I click 'Install', a log message like this appears:
6:11 PM Packages installed successfully: Installed packages: 'djangorestframework-stubs'
But then the warning reappears in a few minues. How to fix it? If it matters, I have a remote Docker Compose interpreter configured for the project, which is otherwise working fine.
In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Color Scheme | Language Defaults, then select Inline hints.
Here's how you can add type hints to our function: Add a colon and a data type after each function parameter. Add an arrow ( -> ) and a data type after the function to specify the return data type.
Type hints help you build and maintain a cleaner architecture. The act of writing type hints forces you to think about the types in your program. While the dynamic nature of Python is one of its great assets, being conscious about relying on duck typing, overloaded methods, or multiple return types is a good thing.
With Python 3.5, type hints officially became part of the language (PEP 484). Using a linter or code-checking tool, developers can check the consistency of variables and their types across a code base, and perform static analyses of code that would previously have been difficult or impossible.
I created a ticket in PyCharm's bug tracker about this problem: https://youtrack.jetbrains.com/issue/PY-34624
What basically happens:
djangorestframework
installed and proposes to install a stub package for it as djangorestframework-stubs
is missingdjangorestframework-stubs
theredjangorestframework-stubs
is goneIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With