doc pipeline not working with sphinx 2.1.2 #1378
Replies: 11 comments
-
I am taking a stab at this. It would be helpful to have a working doc pipeline, if possible. So far, my efforts to get a doc pipeline working with sphinx 1.5 has not worked out. If you have a working pipeline, it would be useful to have the version numbers to most of the relevant packages/modules: python, lxml, doxygen, sphinx, latex, bibtex and perl. Angus's last update to supporting modules was back in 2017. I suppose I could try a OS(vm) from 2017 to see if I can get appropriate versions of stuff to line up? My initial goal is to get the doc pipeline working in Ubuntu 18.04.4 LTS and Ubuntu 20.04 LTS. |
Beta Was this translation helpful? Give feedback.
-
Just ran across something in dev. Does #979 replace this? |
Beta Was this translation helpful? Give feedback.
-
Hi Rob, I took a deep dive into this sometime last year, I will try to remember what I learned to help you out. Hopefully @angus-g will correct any details that I get wrong. The main problem is that we rely on two sphinx extensions which are no longer compatible with our pipeline:
Angus forked these two projects some time ago and made significant changes to them in order to get the MOM6 source to look how it does today. Since this work was completed, Sphinx has changed quite a bit and is no longer compatible with Angus' forks. And while the extensions have mostly stayed up-to-date with the latest Sphinx, it's no longer possible to simply merge Angus' changes into these updated extensions. I was able to do a very crude merge of his changes into the updated versions, but only got far enough to get a partial documentation. I don't think to finish this would be an impossible job, but it will be time consuming. I think there are three paths forward:
Raf looked into Breathe and Doxyrest, and I looked a bit into FORD, but all had their issues and limitations. Doxyrest in particular would take a significant amount of work, since it currently cannot parse Fortran. Stepping back a bit, Doxygen is actually somewhat limited in its ability to parse Fortran. I can't remember the details, but I do recall it makes a fair number of mistakes, misinterprets many terms, and even completely ignores some structs. (I know that's a big claim without evidence, so just take it as anecdotal for now, but I'll try to back it up later). As a wildcard solution, I have been trying to update my flint Fortran parser (https://github.com/marshallward/flint/) to produce reST files which could be fed to Sphinx. This would fully parse the Fortran and would not rely on Doxygen. I have made a lot of progress, but this will always be a moonshot and still needs a lot of work. If I were being asked to solve this in the quickest way, I'd probably try to update those two extensions and make them work in Sphinx 2. It would not be trivial but it ought to be doable. |
Beta Was this translation helpful? Give feedback.
-
Thank you for this information. I found a combination that is operational for html and reproduces what is out on RTD sites presently. I can attempt to move forward at this point. I like your suggestion to update the current extensions (if possible) as an interim step to get us through the current documentation task. We can circle back on Breathe/Doxyrest and/or flint after. For those in need of using the old pipeline, this is what worked for me. I grabbed a server version of Ubuntu 16.04.6 LTS. Ran apt-get upgrade.
The trick is to go WAY back to an ancient doxygen. You have to go back to doxygen version 1.8.11. We went as far back as 1.8.12. With 1.8.11, I can use a modern OS with sphinx 1.5. |
Beta Was this translation helpful? Give feedback.
-
@raphaeldussin: I took a look at doxyrest via https://github.com/raphaeldussin/MOM6/tree/doxyrest_doc and was only able to get a very partial html and pdf rendering. See: https://recon.lccllc.info/MOM6/doxyrest/_build @marshallward: I worked a bit with flint. I can get it to parse all the MOM6 code. Would the next step to build a sphinx extension around flint and the parsed structures? We would still need doxygen to pull forward all the references and latex/bib/citation materials? (see below) I have re-enabled doxygen output of html and pdf. It is not the RTD style, but at least references and links to citations work as intended. It is not the RTD style, but it gives us something to look at. For both the examples above, I have renamed the *.log files to *_log.txt files so they can be viewed through the web browser instead of triggering a download. e.g. latex log: https://recon.lccllc.info/MOM6/esmg/_build/doxygen_latex/latex_log.txt The disturbing issue is there are too many errors (>100) to produce a PDF.
It will take some time to discover how to fix this. I may need to start with a smaller set of code/material to get started and see where the errors are being generated. (A lot of the formula errors seem to stem from trying to support \eqref). My proposal at this point is complete reboot with the latest sphinx and doxygen and bring other tools into the pipleline as they become working. In the end, we should have two or more versions of html and pdf in at least doxygen and eventually RTD styles. If you find some workable pieces, @raphaeldussin or @marshallward, please let me know. I have rediscovered the usefulness of python virtual environments so I can easily switch between all the various pipelines. Back to flint... The flint tokenized data structures seem to be very simple. [ [line1tok1, line1tok2], [line2], ...]
I know the fortran compiler is case insensitive. The flint tokenization seems to push everything to lowercase. Should case be preserved for documentation? I would find it odd that the documentation is in one case and the actual code is in another. (I think doxygen and/or sphinx do this as well...) The one issue that flint could fix is doxygen's need for subroutine arguments to appear on separate lines. Doxygen complains about:
aMean, aMin, aMax need to be on separate lines to be properly documented. There are not too many of these that could be unwound. Should this be done for now? change:
to:
|
Beta Was this translation helpful? Give feedback.
-
I'll try to pull together my modified Sphinx plugins and see how far I got with them. I got past the errors, but the final result was incomplete. (Hopefully they are sitting around somewhere). The flint output that you're looking at is the final tokenized source code, but there are intermediate stages where things like whitespace and case are handled. For example, this is where the docstrings are stored before they are stripped. This would be the place to record the original, case-sensitive input. This is not yet done but I believe it can be added. Let's move this discussion to the flint repo, though. (I've opened this issue: marshallward/flint#5) On your third point, I believe Doxygen has a syntax for bundling multiple variables under a single docstring ( |
Beta Was this translation helpful? Give feedback.
-
Making slow progress on the reboot using sphinx-3.2.1. Working on Agnus's first module https://github.com/rmcgibbo/sphinxcontrib-autodoc_doxygen to process the Current rendering:
Discoveries:
Tasks:
|
Beta Was this translation helpful? Give feedback.
-
Some progress porting pieces of sphinxcontrib-autodoc_doxygen to sphinx-3.2.1. Citations still break on RTD. They work locally. Very strange. Local: https://recon.lccllc.info/MOM6/esmgNew/_build/html/index.html |
Beta Was this translation helpful? Give feedback.
-
I have managed to pull together code that generates html and pdf using sphinx-3.2.1 and doxygen-1.8.19. RTD's default doxygen is 1.8.13 which produces incorrect XML for our use. It turns out you can feed RTD a binary via git and force it to run a 1.8.19 version. The XML is still not perfect in 1.8.19. There is still some work to do, but the major hurdles I think are out of the way. If you like to test this before we push it upstream further:
If things look good, we can push this upstream to update the RTD for the ESMG and the official mom6.readthedocs.io. |
Beta Was this translation helpful? Give feedback.
-
@marshallward : I just got bitten by libpoppler in a CI run. Did you discover this was a transitory bug? https://github.com/NOAA-GFDL/MOM6/pull/1264#issuecomment-737277996 This is what I just saw with a commit attempting to re-sync my development branches without the errant embedded doxygen binary. It looks like an internal fetching issue and not necessarily a package issue. If it manages to get the package properly from a mirror, it should work. We will likely continue to see errors until the mirrors get ironed out.
Things may break again when they upgrade the workflows to 20.04.
|
Beta Was this translation helpful? Give feedback.
-
AFAIK @adcroft fixed it by adding a |
Beta Was this translation helpful? Give feedback.
-
not a pressing issue, but I'd like to put it out there. Current extensions to doxygen are not working with more recent sphinx versions so I couldn't update the rtd yml file. Currently works with sphinx 1.5.
Beta Was this translation helpful? Give feedback.
All reactions