-
-
Notifications
You must be signed in to change notification settings - Fork 291
Docs: A raft of cleanup & style changes #607
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
Conversation
Eliminate any docstrings on `__init__` methods, either adding the contents to the class docstring (`pyparsing.core.Regex`), or making it the previously-nonexistent class docstring instead (`pyparsing.core.DelimitedList`). This allows `__init__` methods to be excluded from the API docs, as they're redundant with the class-level documentation (which includes the `__init__` signature).
And remove the toctree caption (ugly)
- Hide module names in TOC, docs - Line-wrap long signatures for better readability - More compact types in signature docs - Push constructor docs up to class level, remove __init__ docs - Document some special members - Exclude some internal members - Show signatures of undocumented members
- deprecated objects get a red border down the left side of their entire documentation, and a bold "Deprecated since" message underlined in red - added and changed items get a "New in" / "Changed in" message with a blue or orange border (respectively) to its left.
- Don't mention "module" since pyparsing is multiple modules in a package - Remove the weird dash after the "Getting started" heading
This is totally awesome, and I love it!!! Thanks a ton! I'll give this a more thorough look this evening, but your before/afters are very impressive. +1000 |
This one deserves special mention: I had a HELL of a time with Turns out, it wasn't any config. I was originally building the docs with the latest Sphinx 8.2.3, and in that version, it's as I said. The custom messages for those methods get lost, even in the So, just a heads up that Sphinx 8.2.3 will screw up the docs for these aliased methods. Not sure what changed or why, or if 8.2.3 can be configured to the old behavior, but it's definitely caused by that version. |
Aw, hell. WTF, Github? I just tried clicking on those images to expand them, and I'm getting 404s instead of the full-size images. That blows. (EDIT: The one on my previous comment works, but none of the ones in the long comment. I have no idea why. I'll try to fix it when I get a chance... or you can just build the docs and see for yourself, I guess. 😀 ) |
dl.py:where(.class,.exception,.method,.function):has(> dd > div.deprecated) | ||
{ | ||
margin-inline-start: -0.6rem; | ||
border-inline-start: 0.4rem solid #f00; | ||
padding: 0 0.6rem 0 0.2rem; | ||
} |
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.
This, BTW, is very modern CSS, but https://caniuse.com/?search=%3Awhere and https://caniuse.com/?search=%3Ahas say that it should be supported in recent releases of all major browsers, all of the ones anyone has any business being on the internet with, anyway.
Plus, the nice thing about CSS is that it degrades so gracefully. I keep a copy of PaleMoon around, the Firefox 62 or 57 or whatever fork that definitely does NOT support :where
and :has
, and this is how it renders these docs:
So, that's just about ideal.
Have reviewed your changes a bit, though CSS is a vast mystery to me tbh. I'm accepting these changes in toto, you've put in a lot of effort here, and I think the results are fantastic! |
Wow, thanks very much! We probably should iterate a bit on my selections of Like, for example, I included But I really don't think there's any value in But I'm planning to open a follow-up issue about documentation anyway (in fact, I came here to do that right now), so that conversation can happen over there. |
This PR represents a set of tweaks to the project documentation, mostly focused around usability and presentation of information. A lot of it is obviously subjective, and while I personally thing each change is an improvement, I'm not married to any of it and am more than willing to take feedback / remove anything that's not wanted. It's all in very granular commits specifically so that it can easily be adjusted.
What's here
(Formatted as a checklist, so we can mark off anything to be removed/changed)
.. deprecated::
markup.. versionchanged::
and.. versionadded::
markup for most of the items in the "what's new in 3.1.0 / 3.2.0" documents (some items don't easily translate into API documentation):has()
selector to push the.. deprecated::
styling up to the containing class/function/method/etc. level, so that anything marked deprecated has a red border line running all the way down its left side for maximum visibility. You'll see in screenshots.(After some deliberation, I decided not to do the same with added/changed notes, because those won't be "recent" forever and as they age they deserve less prominence. Deprecated features warrant greater prominence, if anything, as time passes until they're eventually removed.)
docs/modules.rst
document, and madedocs/pyparsing.rst
the top-level index for its own documentation (by putting a hidden.. toctree::
at the bottom containing onlyself
).__init__
s to the class itself, and removed the__init__
signatures from the docs entirely, since the construction signatures are shown on the class itself and the__init__
s become totally redundant, with the documentation moved... sectnum::
s from the documentation pages, because Sphinx says not to use them, and with good reason -- they're totally broken. Every document gets numbered "1" in the TOC. There are apparently ways to make the sections properly numbered, butsectnum
isn't it. (I personally don't think it's necessary.)Sphinx configuration changes
max_matches
argument forParserElement.scan_string()
is now listed as_MAX_INT
instead of9223372036854775807
.)autodoc configuration changes
.. automodule::
inpyparsing.rst
like so:Before
After
Which, obviously, greatly affects the contents of the documentation. But I felt there were a number of undocumented members that were worth showing signatures for, and many special members that weren't, so explictly selecting the ones we actually want seemed more productive.
It is a lot of configuration, though, and isn't maintenance-free. (For example, after I added a
.. versionchanged::
to the__str__
method forParseBaseException
, I had to go back and add__str__
to the:special-members:
list to get it to show up in the docs.)So, even more than everything else, explicitly up for debate / open to revision.
I'll follow up with comment(s) showing some side-by-side screenshots, this opening message has gotten long enough.