-
-
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
ENH: enable multiline signatures when too long. #11011
Conversation
Hope this will work for C too (and not just for Py). Thanks in advance. |
Thanks for showing your interest :) I've implemented the functionality similarly for C and C++. If a maintainer finds the time, would be good to hear from one of them whether this seems like the way to go, or if there's something I'm not aware of that makes this implementation flawed. |
@TLouf Thanks for this PR! I'm excited to see this moving forward! ^>^ In case you missed it, this pull request is currently failing continous integration checks since |
From a very brief look:
|
Yes. It's the same discussion as why we should have a line length/content width limit and most of the text/prose arguments for websites made in https://mediawiki.org/wiki/Reading/Web/Desktop_Improvements/Features/Limiting_content_width and we've had a similar discussion in the issue about limiting content width in the default Sphinx themes (sorry for not finding the issue number; it's 1am and a quick search didn't surface it). |
Fixed, I introduced a new
This would be significantly more complex to implement I think, especially because what you describe is a completely different style: namely one with a block indented at the level of the signature's opening parenthesis. What I had in mind is a Otherwise, I'm a bit stuck on the LaTeX implementation now, especially for C and C++. I was thinking of putting the arguments in a |
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.
Brief review. Please add tests and documentation for the proposed feature.
A
45d595e
to
caff655
Compare
[I'm starting to work towards preparing the 6.2.0 release this weekend -- setting expectations that this PR mightn't be in 6.2] A |
Thanks for this ping @AA-Turner! As far as LaTeX is concerned it is all good for me to merge into 6.2.0, I hope my numerous comments did not create impression to contrary. Testing is fine as @TLouf has solved the issue I was not able to address properly a few weeks (or days?) ago, I will now add an additional check of mark-up, and push an update to latex.rst to mention the |
I hesitated: - whether to reuse as here a test source which was prepared for Python domain and used there already, - in place of this, rather add a check of the sphinxtests.tex contents as output from the test_build_latex_doc for pdflatex engine.
@AA-Turner Just pushed tests for text output, they're very similar to the ones for HTML output so it was straightforward. From my point of view this PR is ready for a final review. If you can find the time to squeeze this one into 6.2.0, it would be a really nice addition I think :) |
# Conflicts: # CHANGES
Thanks for updates and merge @AA-Turner! I am a bit lost again in our release policy. This was merged to master and shows in CHANGES as being part of upcoming Related to my query: in doc/latex.rst I documented on line 1482 the change to appear in |
Thank you for pointing this out, I hadn't noticed that typo (7.0.1 vs 7.1.0)! You are of course right that the unreleased section of CHANGES should read I didn't create a
sphinx/doc/usage/configuration.rst Lines 682 to 699 in 53b9b28
A |
@AA-Turner ah it was a typo! I would not have imagined that 😄, I thought to have monopoly on such things... Sorry I had missed you bumped to And finally, thanks for showing me the |
Appending If you use the refined github browser extension, there's a button added automatically to view as 'code' or 'preview', e.g.: A |
Subject: enable multiline signatures when they are too long.
Feature or Bugfix
Purpose
Improve the readability of API references by allowing to set a number of characters a (for instance) Python function's signature cannot exceed. When it would, display each parameter on its own indented line, as should be done in code following style guides like PEP 8.
Detail
python_maximum_signature_line_length
, an integer representing the maximum number of characters that cannot be exceeded by a signature. When negative (the default), there is no maximum, no line break will be introduced no matter how long the signature.:singlelinesig:
directive still allows to disable this behavior on a per-object basis.See for the example, with
python_maximum_signature_line_length = 88
set inconf.py
, the rst below:would build to the following HTML:
Relates
#1514 pandas-dev/pandas#49945