Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm not generating docstrings and no settings under Python Integrated Tools

I'm trying to generate the docstrings to document my python functions, but when I'm going to

PyCharm > Settings > Tools > Python Integrated Tools

I find an empty window with no options and in particular no Docstrings > Docstring format > reStructuredText which is what I need to configure the docs format as my colleagues.

enter image description here

In addition when I click on the lightbulb near the function name and click on "Insert a documentation string stub" nothing happens.

enter image description here

Is there a way to fix this? I'm using PyCharm 2021.1.1 (Professional Edition) on macOS.

like image 904
Gerardo Zinno Avatar asked May 06 '21 13:05

Gerardo Zinno


People also ask

How do I enable docstring in PyCharm?

Press Ctrl+Alt+S and go to Editor | General |Smart Keys. Select the Insert type placeholders checkbox in the Smart Keys page of the editor settings. Place the caret at the function name, and press Alt+Enter . In the list of intention actions that opens, choose Insert documentation string stub.

How do you access a docstring in Python?

Docstrings are accessible from the doc attribute (__doc__) for any of the Python objects and also with the built-in help() function. An object's docstring is defined by including a string constant as the first statement in the object's definition.

How do you make notes in PyCharm?

Press Ctrl+Alt+S to open the IDE settings and select Editor | General | Smart Keys. In the Enter section, select or clear Insert documentation comment stub checkbox. Then, expand the Smart Keys node and select Python. Use the Insert type placeholders in the documentation comment stub option as required.

How does PyCharm create documentation?

Place the caret somewhere within the function you want to document. Press Alt+Enter to show the available intention actions. PyCharm generates documentation comment stub according to docstring format, selected in the Python Integrated Tools page.


1 Answers

In the Python Integrated Tools the list in the left column that says "Nothing to show" is populated from the open Projects. In the screenshot your file/directory tree shows a .vscode folder that isn't necessary to PyCharm, this would indicate that the PyCharm project folder called .idea must also have been copied from your shared project.

The solution is to delete the .idea folder and reopen PyCharm so the IDE can recreate its project folder. The reason is that the .idea folder contains a number of absolute file paths that are different between the computers.

like image 113
bad_coder Avatar answered Oct 09 '22 23:10

bad_coder