11
votes

I have the following piece of code:

class Note:
    def __init__(self, note=None, duration=None, start_time=None):
        self.note = note
        self.duration = duration
        self.start_time = start_time

I wanted to generate a docstring for the class according to the NumPy docstring style, but it doesn't autocomplete. I have chosen the NumPy format in the settings under File | Settings | Tools | Python Integrated Tools

The auto complete works for def __init__(). When I start a new line after it and type ''' it automatically inserts this:

'''

Parameters
----------
note :
duration :
start_time :
'''

But when I do the same thing under class Note: it doesn't do that. I'm using PyCharm 2017.3.3

1
Run into same problem, shame the IDE does not support this feature - CodeSamurai777
Is this still the case? I'm using the CE version of PyCharm & I cannot get it's documentation comment stub to work on classes (it's only working on functions/methods) - how has a class level auto-doc feature not been build yet!? I feel like I'm missing something, for example, in this link, surely the 'ExampleError' class docs are auto-generated: sphinxcontrib-napoleon.readthedocs.io/en/latest/… - CubeBot88
@CubeBot88 Yeah I just tried again myself and it still doesn't auto insert. I agree the example you gave was probably autogenerated, but I guess that developer may have just used some other tool or IDE. I know VS Code has a plugin for it marketplace.visualstudio.com/… - pyjamas

1 Answers

5
votes

This seems to be a feature request with no current due date or version: https://youtrack.jetbrains.com/issue/PY-16760