3

I have a python module used in production. This module is very old, that's why it doesn't have type annotations or docstrings. I can't modify this module. Using stub files (.pyi) I can write type annotations without any changes in the working files. Unfortunatelly, when I add docstrings into stub files (.pyi), PyCharm will not use them.

hello.py

def hello_func(item):
    return [item]

hello.pyi

from typing import List, TypeVar

_T = TypeVar('_T')


    def hello_func(item):  # type: (_T) -> List[_T]
        """
        Wrap Item into list
        
        :param item: an object to wrap
        :return: A list with an ``item`` inside
        """
        ...

PyCharm doesn't show a docstring hint :(

enter image description here

Gabriel G.
  • 464
  • 4
  • 14
shmakovpn
  • 751
  • 9
  • 10
  • 1
    *PyCharm will not use them* please consider adding `pycharm` tag then or adding such information in title – Daweo Jul 13 '21 at 07:59
  • 2
    Sorry, what exactly are you asking? Yes, Pycharm doesn't use the pyi docstring. It's not supposed to. – MisterMiyagi Jul 13 '21 at 08:10

0 Answers0