PR: Overhaul, fix and improve docstring generation (Editor)#25558
Draft
CAM-Gerlach wants to merge 29 commits intospyder-ide:masterfrom
Draft
PR: Overhaul, fix and improve docstring generation (Editor)#25558CAM-Gerlach wants to merge 29 commits intospyder-ide:masterfrom
CAM-Gerlach wants to merge 29 commits intospyder-ide:masterfrom
Conversation
This was referenced Jan 13, 2026
c7981d6 to
4b77668
Compare
10 tasks
4b77668 to
b103c92
Compare
b103c92 to
9f3f926
Compare
9f3f926 to
7ac7618
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Included a screenshot or animation (if affecting the UI, see Licecap)Currently a draft as while all code changes are complete and functionally tested, the unit tests need to be updated to match the format changes, add regression tests for the bugs fixed, and add new tests for the integration of existing docstrings and other new cases.
Builds on top of the initial formatting fixes of PR #24041 (thanks @rhkarls !), all of which are incorporated here in as first commit (with the one exception, see below). On top of that, this PR makes the following changes.
Removed limitations
Bug fixes
returnandyielddetection and extraction|,., etc) not being recognized at allFormatting fixes
optionalfrom the parameter types for Sphinxdoc, where it didn't belong per the formatRefactoring and cleanup
Return None behavior
The one change from PR #24041 that was not picked up here was excluding the return section entirely if the function returns
None, as it leaves ambiguous whether a function actually returns None or the return type is merely not (yet) documented in its own section, as is unfortunately quite common in e.g. the Spyder codebase as well as some others, whereas including it makes that explicit. Presumably, the rationale for not requiring it in some of the docstring formats is the extra developer effort required to manually add it for every function, which is a non-issue here as it is being generated automatically.However, I have fixed several other formatting bugs with it, specifically omitting the spurious period that was sometimes inserted after the type (None), consistently omitting the meaningless/boilerplate "DESCRIPTION" line after "None" (which previously was inserted in some cases and not others), and other minor issues. If there is sufficient interest, an opt-in preferences option to omit None return sections (for Googledoc and Numpydoc) could be added in a followup PR.
Issue(s) Resolved
Fixes #16955
Fixes #20458
Fixes #22043
Fixes #24040
Closes #24041
Will partially address some of #10622 (docstring added in multiple undo steps), not implemented yet
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: CAM-Gerlach