Skip to content
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

documentation overhaul #816

Merged
merged 84 commits into from Jun 21, 2022
Merged

documentation overhaul #816

merged 84 commits into from Jun 21, 2022

Conversation

2bndy5
Copy link
Contributor

@2bndy5 2bndy5 commented Feb 25, 2022

Initially, this PR was meant to just fix all warnings/error in the docs builds, so we can catch bugs like #803 before release. In the process of resolving the warnings/errors, I had to resolve #811 by forcing both RTD and the docs CI workflow to use doxygen v1.9.3 (latest stable as of this writing).

I recommend inspecting the docs build artifacts from this PR's CI run(s).

Changes

  • upload the doxygen XML output as well as the built breathe docs as artifacts for the docs CI workflow

  • fix some errors present in the C++ test sources (at least those that weren't done on purpose). I also went through and suppressed any warnings emitted by doxygen for all the examples (tinyXML project is an absolute mess).

  • update mathjax_path in conf.py. It was broken since mathjax changed it distribution URL (I think for mathjax@v2)

  • fix some errors present in the rst sources (mostly the testing grounds).

    Most of these errors related to improper use of namespaced members without documenting the necessary namespace (see bottom of domains.rst as example).

    Others were simply duplicated IDs declared despite the use of .. cpp:namespace:: (probably not applicable to C only memebers). Thus, I had to inject some :no-link: options to a few directives' documentation.

  • enforce code block highlighting on all literal code snippets

  • finally, change the make html command to use sphinx-build -v -W -E which will make the CI fail if the docs encounter any new warnings or errors from future contributions.

    I had to remove the -n (sphinx's "nit-picky" mode) since all errors and warnings from that option are unavoidable (& usually ignored by RTD). With -n and -W options enabled, the docs' build will not/never pass.

@michaeljones
Copy link
Collaborator

michaeljones commented Feb 26, 2022

This is clearly a huge amount of work. Thank you for doing it.

It is a lot to put in a single PR. Could there be room to break this out a bit? I could try to do that for you if you like and leave you as the author of the commits? I can understand why some of it is grouped together but it seems like certain parts could be separate? The mypy changes? The theme change? The copy button? I realise those are small parts though.

I would also consider it desirable to have more information in the commit messages. It is always good to have the thought process and reasoning recorded along with change. I appreciate you have included that in the PR message but I generally consider git commit messages to be longer lasting than pull requests. I would also recommend using git commit --amend and git rebase --interactive where possible to merge "fix up" commits into their parents.

I'm sorry for those slightly negative points on what is clearly a much overdue and massively needed chunk of work. I have long gotten used to the reams of warnings/errors generated by the documentation but it is good to work through them and silence them where possible.

We might have some under specified dependencies though. When I run:

pip install -r requirements/develop.txt
make html

in the root of the project. It fails with:

ImportError: cannot import name 'html_comment' from 'pyparsing' 

Do you have any thoughts on why that might be?

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

Well, I could break out the theme changes easy enough. I've never had to retroactively change commit messages before, so that's a learning experience I look forward to.

As to the error message, I've not seen that before, and don't know where to start other than figure out what lib is using pyparsing (my guess it is related to pygments internals). The complete error message should say where the full traceback is (as a log file in a tmp folder).

I would first cut the makefile (which may be hiding some relevant error info) out of the equation by running

cd documentation
sphinx-build -v -W -E source build/html

@michaeljones
Copy link
Collaborator

michaeljones commented Feb 26, 2022

It gets a bit further now!

It seems to fail with:

sphinx.errors.SphinxWarning: /home/michael/root/projects/breathe/breathe/documentation/source/concept.rst:19:doxygenconcept: Cannot find concept "Hashable" in doxygen xml output for project "cpp_concept" from directory: ../../examples/specific/cpp_concept/xml/

That might be due to my version of doxygen though which is 1.8.17. Looks like that is about 2 years old at this point. That does bring me to my other query: this seems to move up to using the latest doxygen version, is that necessary and do we worry about platforms or users not having the latest at all? What is the oldest version that it might work with on this PR?

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

see #811 . We would only require users install doxygen 1.9.2+ if documenting c++20 concepts.

Beware 1.9.2

I've had problems in the past concerning mismatched XML tags when running breathe with doxygen v1.9.2

See #782 for hints about installing doxygen from source forge binary distributed archives. Personally, I've grown to weary of using apt in CI workflows because it yields outdated versions of software.

@michaeljones
Copy link
Collaborator

Ah, ok. So concept support has been in for a while and requires 1.9.2+? So we're already kind of forced onto that for our docs as we include concept examples in the final docs?

Seems like a good call to test against older versions if we can somehow handle that. Thanks for your multi-doxygen version suggestion.

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

Ah, ok. So concept support has been in for a while and requires 1.9.2+? So we're already kind of forced onto that for our docs as we include concept examples in the final docs?

Yes and yes.


In the future it might be better to build the docs for each test (as a separate CI workflow using a matrix) in the examples folder rather than displaying the working results in the docs. This would also help avoid duplicate IDs declared in reference docs and test pages.

@michaeljones
Copy link
Collaborator

Sensible suggestion, yeah.

My set up is now failing with:

sphinx.errors.SphinxWarning: /home/michael/root/projects/breathe/breathe/documentation/source/dot_graphs.rst:2:[Errno 2] No such file or directory: 'dotfile.dot'

I realise graphviz support was also merged recently. I do have dot on my path. And these dot files seem to have been generated:

examples/specific/dot_graphs/xml/dotfile.dot
examples/specific/dotfile.dot

Do you know what might have gone wrong? Sorry that I'm just leaning on you for this stuff. Ideally I would know what is happening.

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

Its likely a path problem. Doxygen's XML output names dotfiles (the arg passed to \dotfile cmd) with absolute paths. I don't get this problem when running sphinx-build from the documentation folder but I do get that problem if I execute sphinx-build from a different folder (like repo root or documentation/source). @michaeljones are you still using the makefile or have you switched to using sphinx-build in the docummentation folder?

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

After I get this PR broken up, I'll look into what can be done to battle-harden the dotfile paths (python's os.path is quite capable).

@michaeljones
Copy link
Collaborator

I get some form of that error whether I run it with make html in the root, make html in the documentation folder, sphinx-build source build/html in the documentation folder or sphinx-build . ../build/html in the documentation/source folder. I'm not quite sure what is going on. I've not dug into that code at all. I can do at some point.

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

Well, I rolled back the theme changes and pygments typing changes (will submit those as separate PRs shortly), but I can't see an easy way to break out any more changes as they're all tightly related.

I found that gitkraken UI allows easily renaming old commits (& their descriptions), so I'll try to do some of that later today.

I tried to reproduce the dotfile problem, but I couldn't. It'd be great to have the full traceback for the error you're reporting.

What I did to try to reproduce it
make clean
make html

that worked, so...

cd examples/specific
doxygen dotfile.cfg
cd ../../documentation
sphinx-build -W -E source build/html

that worked, so try to fail on purpose

cd documentation
rm -r build/
cd source
sphinx-build -W -E . ../build/html

that worked?! ok try to fail at repo root

rm -r documentation/build/
sphinx-build -W -E documentation/source documentation/build/html

that worked too?!
visually check the files in build/html ...
yep, it worked 🤷🏼‍♂️

Its worth mentioning that I'm running these dev ops in Windows using WSL. If I run doxygen in Windows and sphinx in Linux (or vice versa), then I get a path-related error about the dotfile.


I understand 88 files is a big ask for review. FWIW, I just got a review request for a PR with 246 file changes (some are just copyright year updates). So, I feel your pain. Please, take your time.

@michaeljones
Copy link
Collaborator

Thank you for reverting some of the changes. I might squash the branch down to a few commits tomorrow if that's ok.

I also like talking about git and doing history editing so if you'd be up for a video call or something we could chat about the joys of --amend and git rebase? If it is something you'd like to learn more about.

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

I'm used to squashing all commits in a PR, so yeah I'm good with that.

the joys of --amend and git rebase

🤣 that textual sarcasm right?

I tend to avoid using git CLI. I know its a disadvantage, but I always end up breaking stuff when I try using the CLI. About the only thing I've learned to do well with CLI is submodules.

@2bndy5
Copy link
Contributor Author

2bndy5 commented Feb 26, 2022

ok I modified the description of this commit using gitkraken. I didn't realize that pushing the change would act like a rebase.

What's the best course of action for multiple commits? (aside from committing more often in the future)🤦🏼

@michaeljones
Copy link
Collaborator

the joys of --amend and git rebase

rofl that textual sarcasm right?

A little but I really appreciate the flexibility that --amend and rebase provide in my workflow. I had to use svn before git and it was frustrating to have to stop my flow in order to try to create the "perfect" commit in order to avoid a cluttered history. With git, I can keep my flow going even if that means creating a cluttered history as I know I can edit it back into shape afterwards.

I tend to avoid using git CLI. I know its a disadvantage, but I always end up breaking stuff when I try using the CLI. About the only thing I've learned to do well with CLI is submodules.

Git does have a pretty terrible user experience. It is one of the few tools where I think it is best to learn about the underlying data structure of the graph in order to better understand what you can do with it. Bit of a shame that that is necessary but fortunately the underlying structure isn't too complex.

2bndy5 and others added 6 commits February 27, 2022 09:42
By adjusting either the restructured text or code/doxygen setup as
needed.

Including some renaming of C/C++ symbols for uniqueness so that we don't
have duplicate IDs throughout the docs.

Other parts use no-link to avoid generating unused or duplicate IDs.

Some other parts are commented out in the restructured text so that we
don't render them any more. For example, the mux vdhl stuff in the
doxygen test suite.

We've include the lists of warnings that doxygen generates but we can
get rid of those at some point.
- tell sphinx to treat warnings as errors (replacing nit-picky mode)
- fix awkward word choice in a a doc
- RTD will use conda forge to get updated docygen executable. GH CI will get doxygen from SourceForge archives binary executable
- document the entire namespace instead individual members of the typeedf example test
- use a different member as the `extern` member test (for reason related to undefined types in member's parameters)
- define empty structures to use as a reference for a type in a parameter/return value of a documented function
   - add comments to explain what the empty structures are for
- remove unnecessary inheritence from "image" example test
We use explicitly language-typed code blocks much more than before to
have better syntax highlighting.

We use links where possible instead of plain text references to
directives and config variables.

We reformat re-indent some of the text blocks as needed.
And further formatting tweaks.
We don't need a record of them.
@michaeljones
Copy link
Collaborator

I've force-pushed a new set of commits. They are basically the main ones you made. You remain the author though git stores me as the committer. I've pushed the original state of your branch as copy-of-docs-build-warnings-as-error in case there is any concern about losing information. They seem to be the same at the point before I deleted all the undoc-ed comments.

If we're not supporting it (and we probably shouldn't) then there is no
need to keep it around in the repository.
If there appear elsewhere in the docs then that is all that matters. We
don't need to keep commented out content about them.
2bndy5 added 13 commits June 20, 2022 16:19
If DOTFILE_DIRS tag is specified, then doxygen 1.9.3 will copy the dot file into the XML output folder and use a relative path when specifying the dotfile's name in XML.

Breathe expects the dotfile to be specified using a absolute path (and filename) as that was the default behavior in 1.9.2 or prior.

TL;DR: don't specify the DOTFILE_DIRS tag in the doxyfile config! Currently, there is no plan to workaround using DOTFILE_DIRS tag.
Specifically for building breathe's docs.

This is made possible by using the RST `ifconfig` directive.

See #811
Per request, most of the namespaced member changes are reverted.

Also reverted temporary changes to dot_graphs.cfg project as the fix was merged into master (which this branch should now be based on).

Some changes seemed to have been lost since I did a
`git reset --hard origin/branch-name`
I have restored what I noticed, but there may be some other changes that were lost.
reverted another namespace change in domains.rst
mathjax output was currently broken due to changes in mathjax distribution path/URL. Updating to latest restores proper output.
Maybe the error about the `.. c:function::` signature is specific to my setup.
@2bndy5
Copy link
Contributor Author

2bndy5 commented Jun 20, 2022

@michaeljones Sphinx still failed to recognize the C-specific array syntax. I can make it so the syntax looks like C++ (essentially ignoring the error) and open an issue describing the problem. That way we can merge this and circle back to that specific error (I suspect its a Sphinx problem).

@vermeeren
Copy link
Collaborator

vermeeren commented Jun 21, 2022

@michaeljones Sphinx still failed to recognize the C-specific array syntax. I can make it so the syntax looks like C++ (essentially ignoring the error) and open an issue describing the problem. That way we can merge this and circle back to that specific error (I suspect its a Sphinx problem).

@2bndy5 Yeah I'm in favour of this approach, that way we can get this merged asap and handle this finicky edge case whenever it works out. Good idea!

Edit: I'd like to do a final rebase prior to merging, so please @ me when it's ready. Thanks!

@2bndy5
Copy link
Contributor Author

2bndy5 commented Jun 21, 2022

I just did an interactive rebase on master. It should now be based on v4.34.0 release. I'll open an issue for the edge case, change the doc to ignore the edge case, and do another sweep through the diff (to make sure the rebase didn't have side effects).

Copy link
Contributor Author

@2bndy5 2bndy5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vermeeren I went through and verified all requests have been satisfied except for the c array syntax problem (which now has a devoted thread #854). I also combed through and made sure the rebase went well. ✅

For the record, I prefer these commits get squashed (its kinda my default on most projects). Lately, I've been a bit better at keeping a clean git history, and that's partly due to this experience (my contributions usually end up being learning opportunities).

@michaeljones
Copy link
Collaborator

Shall I squash and merge then?

@2bndy5
Copy link
Contributor Author

2bndy5 commented Jun 21, 2022

yeah, I think we're all onboard with that.

@michaeljones michaeljones merged commit caba061 into breathe-doc:master Jun 21, 2022
@michaeljones
Copy link
Collaborator

Done. Thanks so much for all the hard work. Sorry it has dragged out for so long. Happy to see it merged.

@2bndy5 2bndy5 deleted the docs-build-warnings-as-error branch June 21, 2022 19:55
@vermeeren
Copy link
Collaborator

Happy to see this merged, again thanks a lot all!

Lately, I've been a bit better at keeping a clean git history, and that's partly due to this experience

@2bndy5 Good to hear this as well from my pov, cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C++20 concepts supported by doxygen v1.9.2+
4 participants