Looks like it can be done:

Only test the sample code in the post.
Answer from JialeDu on Stack OverflowAutomatically Generate Python Docstrings with LLMs
Function Docstring Generator
Is there anyway to generate doc strings for Python code using Github Copilot (VS Code) - Stack Overflow
python - How to auto-generate the type of a field in a docstring in PyCharm? - Stack Overflow
Thank you for the all the great feedbacks on my last post.
Context:
What My Project Does?
Penify is a GitHub App that auto-generates and dynamically updates documentation for your repo. It supports various styles like Google, Numpy, reST, and Epydoc, ensuring your documentation stays current with every change.
Check it out: [Penify GitHub App](https://github.com/apps/penify-dev).
Here's how it works in action: [Sample PR](https://github.com/NVIDIA/trt-llm-rag-windows/pull/44/files).
Updates:
-
Generates consistent style docstrings: Google, reST, Numpy, Epydoc.
-
Reduces hallucination through improved prompts and more context.
-
Offers Full Repo documentation generation - previously it used to generate docs for only code changes.
Working on
-
ignore-private
-
ignore-semiprivate
-
ignore-init-method
-
ignore-setters-getters
Target Audience:
-
Ideal for freelance developers requiring high-quality project documentation.
-
Perfect for project managers desiring updated codebase docs for smooth onboarding of new developers.
Alternatives: Copilot & Tabnine Cons:
-
In consistent style docstring style - sometimes it generates Google,Numpy....
-
Context selection is very limited in Co-pilot
-
Need to manually do doc updates for each modified code; Penify does it automatically in the background(it detects code changes and generates docs)
Pros:
-
You can update the modified docstring before pushing it.
I know the community believes that Docstring generation shouldn't be done by LLMs - but I am seeing some good results. Hence, I am giving my effort. Please try and let me know your feedback.
Looks like it can be done:

Only test the sample code in the post.
Absolutely, those are useful strategies for using Copilot to streamline your coding process:
When working on a class or multiple functions that are interdependent:
- Start by writing one or two functions.
- After completing your initial functions, place your cursor at the
:character after the function definition, press enter, and begin typing""". Copilot will automatically generate a docstring for you. - Now, when you type
def function_name():, Copilot will auto-generate both the function's body and its accompanying docstring.
For simpler cases or standalone functions, you can directly use the second step from the previous instructions, which involves just generating a docstring for a function by typing
"""after the function definition.
Go to Settings > Editor > General > Smart Keys, then check the box that says Insert type placeholders in the documentation comment stub.

Per the documentation:
If configured, the documentation comment stubs can be generated with
typeandrtypetags.
Following the link:
...
- In the Smart Keys page, select the check box Insert 'type' and 'rtype' to the documentation comment stub.
Note that the documentation has since been updated, the configuration guidance currently reads:
Enable documentation comments
Open the Editor | General | Smart Keys page of PyCharm settings โโฅS.
In the Enter section, select or clear Insert documentation comment stub checkbox.
Then, scroll to the Insert type placeholders in the documentation comment stub option and select or clear the checkbox as required. Refer to the option description for details.
Once you have done this, put the cursor in a parameter name in the definition, activate the Smart Keys feature (Alt+Enter, by default) and select Specify type for reference in docstring. This will insert the appropriate comment line . Similarly you can put the cursor in the function/method name and select Specify return type in docstring.
I've been programming in python for a few years now and recently I started in my first job as a python backend programmer. Never liked using those big IDE but, since my whole team uses VS Code, I thought to give it a go and generate the least amount of friction on the first week. Yeah, didn't like.
BUT what I've loved was a VS Code extension named "auto doc string" which could automatically create a doc string and already place some information, like which arguments, what are the returns and, most important, type annotations were reflected in the doc string.
Sure, there must be a package in emacs that could do all that, right? I have yet to found it. The closest I got was yasnippet-radical-snippets, but it doesn't support types (yet).
Does anyone know a better tool for the job?
If youโre using numpydoc styling, this has support for type hinting: https://github.com/douglasdavis/numpydoc.el
There is sphinx doc : https://github.com/naiquevin/sphinx-doc.el It really does a good job but only for the sphinx format. I personally prefer the google format but i have yet to find something for this. But yeah, if you donโt have any problem with the sphinx format this one is great ! =D
Hey,
I've been lately writing Declarai, an open-source llm-related library.
The need for a clear API reference documentation came fast and I started looking for good auto-generate documentation tools.
Up until now, I found mkdocstrings the best choice as im using mkdocs anyhow.
Do you guys aware of any other great tools for api documentation auto-generation ?
Is there a way to generate a docstrings in python-mode?
-
You can use a yasnippet like here. But this requires to write out the whole definition of the function in one go when you start out. This is OK for very simple functions, but most of the time this doesn't really fit my workflow.
-
You can use sphinx-doc. This almost works for me: write out function, when happy it generates the docstring. BUT: doesn't work with type annotated functions
-
There seems to be a hacky solution with elisp+python script... Haven't tried it, but if it still works, I'd prefer not to muck about with a separate pyhton script...
Is there anything that I've missed? Thanks!