-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for short signatures in autosummary #13172
base: master
Are you sure you want to change the base?
Conversation
get_items() already formats the signature. Handling :nosignatures: option in the saves the signature computation cost if the signature is not wanted. Also, this prepares for more complex signature options.
This is in preparation of extending singature formating.
b87c5bc
to
cd95331
Compare
This formats functions and classes with (…) if they have arguments and () if they don't have arguments. This makes it easier to distinguish callables from attributes and properties.
cd95331
to
df273d6
Compare
5b082a7
to
bf01890
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have tests, but I'm also unfamiliar with autosummary
, I'd be starting from scratch. Other than that this looks good!
Please can you update it in light of #13264?
A
#13264 has renamed |
This introduces a new
:signatures:
option to.. autosummary::
.Possible values are:
func()
if they do not have arguments andfunc(…)
if they do have arguments.The new functionality here is the "short" option. This allows to distinguish properties and attributes from functions and classes without costing a lot of space for a long signature.
Note 1: Design: I've added the
:signatures:
option to have a single config value instead of:shortsignatures:
alongside:no-signatures:
. This is also more extensible in case other signature variants come up in the future.:no-signatures:
remains available for backward compatibility, but:signatures:
takes precedence if given.Note 2: Tests: There are currently no tests for the signature formatting. I could add some tests for
Autosummary.get_items
, but I don't understand how to set up everything in a test so that I can exercise that function. Please give a hint how to do this if tests are desired.Closes #13101.