12

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

aL_eX
  • 1,453
  • 2
  • 15
  • 30
pyjamas
  • 4,608
  • 5
  • 38
  • 70
  • 1
    Run into same problem, shame the IDE does not support this feature – CodeSamurai777 Mar 07 '19 at 12:40
  • 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: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy – CubeBot88 May 11 '20 at 19:00
  • @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 https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring – pyjamas May 11 '20 at 20:46

1 Answers1

6

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

EDIT: already Fixed

daniestevez
  • 173
  • 1
  • 10