axondeepseg / axondeepseg

Axon/Myelin segmentation using Deep Learning
https://axondeepseg.rtfd.io/
MIT License
113 stars 32 forks source link

Auto-fill models into our ReadTheDocs/Sphinx for auto-update #811

Open mathieuboudreau opened 2 weeks ago

mathieuboudreau commented 2 weeks ago

The idea would be that at each documentation build, it would crawl our models repo/repos and fetch information about them that we would then automatically include into our documentation.

This was suggested in a group meeting - I looked into the documentation and it appears we'd need to create a sphinx extension, but maybe someone's already done it?

If we need to code a sphinx extension, is the time saved not manually doing this really going to be shorter than the time it would take to code up an extension? Either way, we don't want this to hold up PR #800

mathieuboudreau commented 2 weeks ago

@joshuacwnewton do you guys do something like this for SCT, or are you aware of any projects that do?

joshuacwnewton commented 1 week ago

What perfect timing! Literally yesterday I had been thinking about this exact feature for SCT in the context of https://github.com/spinalcordtoolbox/spinalcordtoolbox/issues/4531.

We also wanted to programmatically generate a table of models, then insert that table into our documentation.

In my research, I found this: https://stackoverflow.com/questions/7250659/how-to-use-python-to-programmatically-generate-part-of-sphinx-documentation

I haven't yet tried this? But, assuming you can call a Python script from Sphinx's makefile, that gives us a lot of flexibility for fetching repo details using GitHub's Python API and formatting them into rST.

joshuacwnewton commented 1 week ago

It looks like RTD provides special config options for extending the build process, too: https://docs.readthedocs.io/en/stable/build-customization.html#override-the-build-process