nbsphinx icon indicating copy to clipboard operation
nbsphinx copied to clipboard

Github action for generating docs using nbsphinx

Open psychemedia opened this issue 6 years ago • 8 comments
trafficstars

Via a Jupyter discourse thread on using Github actions to automatically build MyBinder images from pushes to a Github repo, I wondered if there is an example nbsphinx Github action defined anywhere?

Eg I note this https://github.com/ammaraskar/sphinx-action

psychemedia avatar Nov 23 '19 18:11 psychemedia

I have never used Github Actions, and I don't know whether anyone has used it with nbsphinx.

Did you try if the above-mentioned Sphinx action works?

I guess it should work fine if you can specify the nbsphinx requirement (which I guess you can do with a requirements.txt file).

I guess the "fancy in-line warnings" will not work because nbsphinx doesn't track line numbers in .ipynb files.

mgeier avatar Dec 02 '19 20:12 mgeier

See also #361.

mgeier avatar Dec 16 '19 18:12 mgeier

OK, I quickly tried it, and I found two problems:

  • A Makefile is needed (see https://github.com/ammaraskar/sphinx-action/issues/2)
  • I don't know how to install pandoc

mgeier avatar Dec 16 '19 18:12 mgeier

No need to use Sphinx-action, you can just run the commands as you normally would. I got a first example working on my branch for the PR.

Pandoc and librsvg can be installed with conda, for osx and Linux. If it wasn't for librsvg, it would even work on windows. With tectonic, you can even compile latex cross platform.

s-weigand avatar Dec 16 '19 19:12 s-weigand

Cool, I'm looking forward to this PR!

As far as I'm concerned, you don't have to support Python 2 in your efforts, I was planning to drop Python 2 support in early 2020 anyway.

If it wasn't for librsvg, it would even work on windows.

Shouldn't it work on Windows? At least there's a win32 directory: https://gitlab.gnome.org/GNOME/librsvg/tree/master/win32

I guess the problem is that Windows isn't supported on the conda-forge package, right?

With tectonic, you can even compile latex cross platform.

Cool, I didn't know this project!

... but I don't know if we really need to generate the PDF on multiple platforms?

mgeier avatar Dec 17 '19 11:12 mgeier

@psychemedia if you just want to rebuild your binder image, when i.e. master is updated you can use this action.

s-weigand avatar Dec 18 '19 17:12 s-weigand

@s-weigand Thanks for that; I'm wary of rebuilding too often on MyBinder - I often make piecemeal pushes / do edits on single files via Github UI, and some of my Binder images force quite lengthy builds!

PS I've also started looking at this action — https://github.com/machine-learning-apps/repo2docker-action — for building images from repos using repo2docker and then pushing the result to Dockerhub.

psychemedia avatar Dec 19 '19 16:12 psychemedia

In the meantime, I've used Github Actions in a different project, see https://github.com/AudioSceneDescriptionFormat/splines/blob/master/.github/workflows/docs.yml.

This uses https://github.com/dante-ev/latex-action for building the PDF. It uses quite a big image, which needs nearly 3 minutes to load. Maybe using tectonic, as @s-weigand suggested above (https://github.com/spatialaudio/nbsphinx/issues/358#issuecomment-566205536), is faster, but I didn't try it (yet).

mgeier avatar Aug 11 '20 10:08 mgeier