nbsphinx icon indicating copy to clipboard operation
nbsphinx copied to clipboard

CI: Move to Github Actions

Open mgeier opened this issue 5 years ago • 7 comments

This has already been asked for in #358 and #361.

I think it would be good - to keep it simple - to have several configuration files:

  • [x] run HTML builder with many Python and Sphinx versions

    • this was previously done on Travis-CI (config: https://github.com/spatialaudio/nbsphinx/blob/d5d352c5440cc7a185751bdf0d1ba263b7a2026d/.travis.yml)
    • I don't think we need to do this on multiple operating systems? Ubuntu should suffice?
    • implemented in #792.
  • [ ] run HTML builder on Windows, using default versions

  • [x] run HTML builder on macOS, using default versions (#559)

  • [ ] run HTML builder with default versions (whatever OS), upload HTML artifacts

    • Github still doesn't allow non-zipped artifacts, see #361.
    • I don't think we need multiple versions of the HTML artifacts, one OS (using default versions) should suffice
  • [ ] create PDF with TexLive, upload artifact

    • one OS should be sufficient?
    • if tectonic turns out to be much faster (while still producing a correct PDF), we can remove the TeXLive action
  • [ ] create PDF with tectonic, upload artifact

    • one OS should be sufficient?
  • [x] run linkcheck (only once), see #491

Any further suggestions?

cc @s-weigand

mgeier avatar Sep 27 '20 19:09 mgeier

I got pretty much all of this running, besides building of PDF on windows (see this workflow, still WIP with an ugly commit history). For tests on windows to pass I had to use python<3.8 (#496 ) and add the raises-exception tag to the bash-magic cell.

Latex and Windows

The problem with creating PDFs on Windows is due to the difference in the created nbsphinx.tex file.

textonic and pdflatex both fail with:

LaTeX Warning: Reference `a-normal-rst-file:example_python_function' on page 23
 undefined on input line 2056.

[23]
! FancyVerb Error:
  Empty verbatim environment
.
\FV@Error ...ncyVerb Error:^^J\space \space #1^^J}

l.2292 \end{sphinxVerbatim}

When looking at the diff of the linux and windows generated nbsphinx.tex

$ diff -Z --color latex-linux/nbsphinx.tex  latex-win/nbsphinx.tex

you find the following:

2292,2294c2292,2339
< 1
< 2
< 3
---
> \end{sphinxVerbatim}
> }
> 
> {
> 
> \kern-\sphinxverbatimsmallskipamount\kern-\baselineskip
> \kern+\FrameHeightAdjust\kern-\fboxrule
> \vspace{\nbsphinxcodecellspacing}
> 
> \sphinxsetup{VerbatimColor={named}{white}}
> \sphinxsetup{VerbatimBorderColor={named}{nbsphinx-code-border}}
> \begin{sphinxVerbatim}[commandchars=\\\{\}]
> \textcolor{ansi-red-intense}{\textbf{---------------------------------------------------------------------------}}
> \textcolor{ansi-red-intense}{\textbf{CalledProcessError}}                        Traceback (most recent call last)
> \textcolor{ansi-green-intense}{\textbf{<ipython-input-1-7f4108180772>}} in \textcolor{ansi-cyan}{<module>}
> \textcolor{ansi-green-intense}{\textbf{----> 1}}\textcolor{ansi-yellow-intense}{\textbf{ }}get\_ipython\textcolor{ansi-yellow-intense}{\textbf{(}}\textcolor{ansi-yellow-intense}{\textbf{)}}\textcolor{ansi-yellow-intense}{\textbf{.}}run\_cell\_magic\textcolor{ansi-yellow-intense}{\textbf{(}}\textcolor{ansi-blue-intense}{\textbf{'bash'}}\textcolor{ansi-yellow-intense}{\textbf{,}} \textcolor{ansi-blue-intense}{\textbf{''}}\textcolor{ansi-yellow-intense}{\textbf{,}} \textcolor{ansi-blue-intense}{\textbf{'for i in 1 2 3\textbackslash{}ndo\textbackslash{}n    echo \$i\textbackslash{}ndone\textbackslash{}n'}}\textcolor{ansi-yellow-intense}{\textbf{)}}
> 
> \textcolor{ansi-green-intense}{\textbf{C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}IPython\textbackslash{}core\textbackslash{}interactiveshell.py}} in \textcolor{ansi-cyan}{run\_cell\_magic}\textcolor{ansi-blue-intense}{\textbf{(self, magic\_name, line, cell)}}
> \textcolor{ansi-green}{   2379}             \textcolor{ansi-green-intense}{\textbf{with}} self\textcolor{ansi-yellow-intense}{\textbf{.}}builtin\_trap\textcolor{ansi-yellow-intense}{\textbf{:}}
> \textcolor{ansi-green}{   2380}                 args \textcolor{ansi-yellow-intense}{\textbf{=}} \textcolor{ansi-yellow-intense}{\textbf{(}}magic\_arg\_s\textcolor{ansi-yellow-intense}{\textbf{,}} cell\textcolor{ansi-yellow-intense}{\textbf{)}}
> \textcolor{ansi-green-intense}{\textbf{-> 2381}}\textcolor{ansi-yellow-intense}{\textbf{                 }}result \textcolor{ansi-yellow-intense}{\textbf{=}} fn\textcolor{ansi-yellow-intense}{\textbf{(}}\textcolor{ansi-yellow-intense}{\textbf{*}}args\textcolor{ansi-yellow-intense}{\textbf{,}} \textcolor{ansi-yellow-intense}{\textbf{**}}kwargs\textcolor{ansi-yellow-intense}{\textbf{)}}
> \textcolor{ansi-green}{   2382}             \textcolor{ansi-green-intense}{\textbf{return}} result
> \textcolor{ansi-green}{   2383}
> 
> \textcolor{ansi-green-intense}{\textbf{C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}IPython\textbackslash{}core\textbackslash{}magics\textbackslash{}script.py}} in \textcolor{ansi-cyan}{named\_script\_magic}\textcolor{ansi-blue-intense}{\textbf{(line, cell)}}
> \textcolor{ansi-green}{    140}             \textcolor{ansi-green-intense}{\textbf{else}}\textcolor{ansi-yellow-intense}{\textbf{:}}
> \textcolor{ansi-green}{    141}                 line \textcolor{ansi-yellow-intense}{\textbf{=}} script
> \textcolor{ansi-green-intense}{\textbf{--> 142}}\textcolor{ansi-yellow-intense}{\textbf{             }}\textcolor{ansi-green-intense}{\textbf{return}} self\textcolor{ansi-yellow-intense}{\textbf{.}}shebang\textcolor{ansi-yellow-intense}{\textbf{(}}line\textcolor{ansi-yellow-intense}{\textbf{,}} cell\textcolor{ansi-yellow-intense}{\textbf{)}}
> \textcolor{ansi-green}{    143}
> \textcolor{ansi-green}{    144}         \textcolor{ansi-red-intense}{\textbf{\# write a basic docstring:}}
> 
> \textcolor{ansi-green-intense}{\textbf{<decorator-gen-104>}} in \textcolor{ansi-cyan}{shebang}\textcolor{ansi-blue-intense}{\textbf{(self, line, cell)}}
> 
> \textcolor{ansi-green-intense}{\textbf{C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}IPython\textbackslash{}core\textbackslash{}magic.py}} in \textcolor{ansi-cyan}{<lambda>}\textcolor{ansi-blue-intense}{\textbf{(f, *a, **k)}}
> \textcolor{ansi-green}{    185}     \textcolor{ansi-red-intense}{\textbf{\# but it's overkill for just that one bit of state.}}
> \textcolor{ansi-green}{    186}     \textcolor{ansi-green-intense}{\textbf{def}} magic\_deco\textcolor{ansi-yellow-intense}{\textbf{(}}arg\textcolor{ansi-yellow-intense}{\textbf{)}}\textcolor{ansi-yellow-intense}{\textbf{:}}
> \textcolor{ansi-green-intense}{\textbf{--> 187}}\textcolor{ansi-yellow-intense}{\textbf{         }}call \textcolor{ansi-yellow-intense}{\textbf{=}} \textcolor{ansi-green-intense}{\textbf{lambda}} f\textcolor{ansi-yellow-intense}{\textbf{,}} \textcolor{ansi-yellow-intense}{\textbf{*}}a\textcolor{ansi-yellow-intense}{\textbf{,}} \textcolor{ansi-yellow-intense}{\textbf{**}}k\textcolor{ansi-yellow-intense}{\textbf{:}} f\textcolor{ansi-yellow-intense}{\textbf{(}}\textcolor{ansi-yellow-intense}{\textbf{*}}a\textcolor{ansi-yellow-intense}{\textbf{,}} \textcolor{ansi-yellow-intense}{\textbf{**}}k\textcolor{ansi-yellow-intense}{\textbf{)}}
> \textcolor{ansi-green}{    188}
> \textcolor{ansi-green}{    189}         \textcolor{ansi-green-intense}{\textbf{if}} callable\textcolor{ansi-yellow-intense}{\textbf{(}}arg\textcolor{ansi-yellow-intense}{\textbf{)}}\textcolor{ansi-yellow-intense}{\textbf{:}}
> 
> \textcolor{ansi-green-intense}{\textbf{C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}IPython\textbackslash{}core\textbackslash{}magics\textbackslash{}script.py}} in \textcolor{ansi-cyan}{shebang}\textcolor{ansi-blue-intense}{\textbf{(self, line, cell)}}
> \textcolor{ansi-green}{    243}             sys\textcolor{ansi-yellow-intense}{\textbf{.}}stderr\textcolor{ansi-yellow-intense}{\textbf{.}}flush\textcolor{ansi-yellow-intense}{\textbf{(}}\textcolor{ansi-yellow-intense}{\textbf{)}}
> \textcolor{ansi-green}{    244}         \textcolor{ansi-green-intense}{\textbf{if}} args\textcolor{ansi-yellow-intense}{\textbf{.}}raise\_error \textcolor{ansi-green-intense}{\textbf{and}} p\textcolor{ansi-yellow-intense}{\textbf{.}}returncode\textcolor{ansi-yellow-intense}{\textbf{!=}}\textcolor{ansi-cyan-intense}{\textbf{0}}\textcolor{ansi-yellow-intense}{\textbf{:}}
> \textcolor{ansi-green-intense}{\textbf{--> 245}}\textcolor{ansi-yellow-intense}{\textbf{             }}\textcolor{ansi-green-intense}{\textbf{raise}} CalledProcessError\textcolor{ansi-yellow-intense}{\textbf{(}}p\textcolor{ansi-yellow-intense}{\textbf{.}}returncode\textcolor{ansi-yellow-intense}{\textbf{,}} cell\textcolor{ansi-yellow-intense}{\textbf{,}} output\textcolor{ansi-yellow-intense}{\textbf{=}}out\textcolor{ansi-yellow-intense}{\textbf{,}} stderr\textcolor{ansi-yellow-intense}{\textbf{=}}err\textcolor{ansi-yellow-intense}{\textbf{)}}
> \textcolor{ansi-green}{    246}
> \textcolor{ansi-green}{    247}     \textcolor{ansi-green-intense}{\textbf{def}} \_run\_script\textcolor{ansi-yellow-intense}{\textbf{(}}self\textcolor{ansi-yellow-intense}{\textbf{,}} p\textcolor{ansi-yellow-intense}{\textbf{,}} cell\textcolor{ansi-yellow-intense}{\textbf{,}} to\_close\textcolor{ansi-yellow-intense}{\textbf{)}}\textcolor{ansi-yellow-intense}{\textbf{:}}
> 
> \textcolor{ansi-red-intense}{\textbf{CalledProcessError}}: Command 'b'for i in 1 2 3\textbackslash{}ndo\textbackslash{}n    echo \$i\textbackslash{}ndone\textbackslash{}n'' returned non-zero exit status 4294967295.
2588,2589c2633,2634
< /opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/traitlets/traitlets.py:2939: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
<   warn(
---
> C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}traitlets\textbackslash{}traitlets.py:2945: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
>   FutureWarning,
2611c2656
< \llap{\color{nbsphinxout}[18]:\,\hspace{\fboxrule}\hspace{\fboxsep}}[<matplotlib.lines.Line2D at 0x7f7fb2c631c0>]
---
> \llap{\color{nbsphinxout}[18]:\,\hspace{\fboxrule}\hspace{\fboxsep}}[<matplotlib.lines.Line2D at 0x15b196f4648>]
2722,2726c2767,2771
< 0  23  38  91  66
< 1  13  28  17   1
< 2  45  25  20  83
< 3  55  41  75  98
< 4  87  72  25   7
---
> 0  64  64  71  58
> 1  72  63  10  56
> 2  10  88  40  51
> 3   9  83  58   8
> 4  25  63  41   0
2810,2819c2855,2864
< 0 &         9 &       95 &        88 &        80 \\
< 1 &        99 &       59 &        29 &        29 \\
< 2 &        10 &       71 &        76 &        46 \\
< 3 &        88 &       20 &        56 &        70 \\
< 4 &        46 &       61 &        62 &        43 \\
< 5 &        97 &       93 &        79 &         7 \\
< 6 &         9 &       53 &        24 &        78 \\
< 7 &        10 &       35 &        56 &         4 \\
< 8 &         8 &       49 &         4 &        67 \\
< 9 &        89 &       47 &        70 &        99 \\
---
> 0 &        93 &       32 &        41 &         1 \\
> 1 &        62 &       15 &        66 &        23 \\
> 2 &        90 &       74 &        23 &        66 \\
> 3 &        84 &        7 &        78 &        29 \\
> 4 &         4 &       47 &        53 &        48 \\
> 5 &        70 &       10 &        12 &        49 \\
> 6 &        97 &       64 &         2 &        96 \\
> 7 &        96 &       86 &        42 &        13 \\
> 8 &        94 &       35 &        99 &        40 \\
> 9 &        68 &       93 &        66 &        73 \\
3605,3608c3650,3653
< \textcolor{ansi-red}{---------------------------------------------------------------------------}
< \textcolor{ansi-red}{NameError}                                 Traceback (most recent call last)
< \textcolor{ansi-green}{<ipython-input-1-7dd4c0df649c>} in \textcolor{ansi-cyan}{<module>}
< \textcolor{ansi-green}{----> 1}\textcolor{ansi-red}{ }nonsense
---
> \textcolor{ansi-red-intense}{\textbf{---------------------------------------------------------------------------}}
> \textcolor{ansi-red-intense}{\textbf{NameError}}                                 Traceback (most recent call last)
> \textcolor{ansi-green-intense}{\textbf{<ipython-input-1-7dd4c0df649c>}} in \textcolor{ansi-cyan}{<module>}
> \textcolor{ansi-green-intense}{\textbf{----> 1}}\textcolor{ansi-yellow-intense}{\textbf{ }}nonsense
3610c3655
< \textcolor{ansi-red}{NameError}: name 'nonsense' is not defined
---
> \textcolor{ansi-red-intense}{\textbf{NameError}}: name 'nonsense' is not defined
3631,3634c3676,3679
< \textcolor{ansi-red}{---------------------------------------------------------------------------}
< \textcolor{ansi-red}{ZeroDivisionError}                         Traceback (most recent call last)
< \textcolor{ansi-green}{<ipython-input-1-52cebea8b64f>} in \textcolor{ansi-cyan}{<module>}
< \textcolor{ansi-green}{----> 1}\textcolor{ansi-red}{ }\textcolor{ansi-cyan}{42} \textcolor{ansi-blue}{/} \textcolor{ansi-cyan}{0}
---
> \textcolor{ansi-red-intense}{\textbf{---------------------------------------------------------------------------}}
> \textcolor{ansi-red-intense}{\textbf{ZeroDivisionError}}                         Traceback (most recent call last)
> \textcolor{ansi-green-intense}{\textbf{<ipython-input-1-52cebea8b64f>}} in \textcolor{ansi-cyan}{<module>}
> \textcolor{ansi-green-intense}{\textbf{----> 1}}\textcolor{ansi-yellow-intense}{\textbf{ }}\textcolor{ansi-cyan-intense}{\textbf{42}} \textcolor{ansi-yellow-intense}{\textbf{/}} \textcolor{ansi-cyan-intense}{\textbf{0}}
3636c3681
< \textcolor{ansi-red}{ZeroDivisionError}: division by zero
---
> \textcolor{ansi-red-intense}{\textbf{ZeroDivisionError}}: division by zero
3657,3660c3702,3705
< \textcolor{ansi-cyan}{  File }\textcolor{ansi-green}{"<ipython-input-1-653b30cd70a8>"}\textcolor{ansi-cyan}{, line }\textcolor{ansi-green}{1}
< \textcolor{ansi-red}{    print 'Hello, world!'}
<           \^{}
< \textcolor{ansi-red}{SyntaxError}\textcolor{ansi-red}{:} Missing parentheses in call to 'print'. Did you mean print('Hello, world!')?
---
> \textcolor{ansi-cyan-intense}{\textbf{  File }}\textcolor{ansi-green-intense}{\textbf{"<ipython-input-1-653b30cd70a8>"}}\textcolor{ansi-cyan-intense}{\textbf{, line }}\textcolor{ansi-green-intense}{\textbf{1}}
> \textcolor{ansi-yellow-intense}{\textbf{    print 'Hello, world!'}}
> \textcolor{ansi-white-intense}{\textbf{                        \^{}}}
> \textcolor{ansi-red-intense}{\textbf{SyntaxError}}\textcolor{ansi-red-intense}{\textbf{:}} Missing parentheses in call to 'print'. Did you mean print('Hello, world!')?
3682,3685c3727,3730
< \textcolor{ansi-cyan}{  File }\textcolor{ansi-green}{"<ipython-input-1-8300b2622db3>"}\textcolor{ansi-cyan}{, line }\textcolor{ansi-green}{1}
< \textcolor{ansi-red}{    6 \textasciitilde{} 7}
<       \^{}
< \textcolor{ansi-red}{SyntaxError}\textcolor{ansi-red}{:} invalid syntax
---
> \textcolor{ansi-cyan-intense}{\textbf{  File }}\textcolor{ansi-green-intense}{\textbf{"<ipython-input-1-8300b2622db3>"}}\textcolor{ansi-cyan-intense}{\textbf{, line }}\textcolor{ansi-green-intense}{\textbf{1}}
> \textcolor{ansi-yellow-intense}{\textbf{    6 \textasciitilde{} 7}}
> \textcolor{ansi-white-intense}{\textbf{      \^{}}}
> \textcolor{ansi-red-intense}{\textbf{SyntaxError}}\textcolor{ansi-red-intense}{\textbf{:}} invalid syntax
3766,3769c3811,3814
< \textcolor{ansi-red}{---------------------------------------------------------------------------}
< \textcolor{ansi-red}{NameError}                                 Traceback (most recent call last)
< \textcolor{ansi-green}{<ipython-input-1-526ab3a89ffc>} in \textcolor{ansi-cyan}{<module>}
< \textcolor{ansi-green}{----> 1}\textcolor{ansi-red}{ }problem
---
> \textcolor{ansi-red-intense}{\textbf{---------------------------------------------------------------------------}}
> \textcolor{ansi-red-intense}{\textbf{NameError}}                                 Traceback (most recent call last)
> \textcolor{ansi-green-intense}{\textbf{<ipython-input-1-526ab3a89ffc>}} in \textcolor{ansi-cyan}{<module>}
> \textcolor{ansi-green-intense}{\textbf{----> 1}}\textcolor{ansi-yellow-intense}{\textbf{ }}problem
3771c3816
< \textcolor{ansi-red}{NameError}: name 'problem' is not defined
---
> \textcolor{ansi-red-intense}{\textbf{NameError}}: name 'problem' is not defined
4225c4270
< \sphinxcode{\sphinxupquote{\strut doc/subdir/a-notebook-in-a-subdir.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/subdir\textbackslash{}a-notebook-in-a-subdir.ipynb}} \dotfill}}
4283c4328
< doc/subdir/a-notebook-in-a-subdir.ipynb}} ends here.}}
---
> doc/subdir\textbackslash{}a-notebook-in-a-subdir.ipynb}} ends here.}}
4289c4334
< \sphinxcode{\sphinxupquote{\strut doc/subdir/gallery.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/subdir\textbackslash{}gallery.ipynb}} \dotfill}}
4344c4389
< \sphinxcode{\sphinxupquote{\strut doc/gallery/cell-tag.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/gallery\textbackslash{}cell-tag.ipynb}} \dotfill}}
4370,4371c4415,4416
< /opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/traitlets/traitlets.py:2939: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
<   warn(
---
> C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}traitlets\textbackslash{}traitlets.py:2945: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
>   FutureWarning,
4395c4440
< \llap{\color{nbsphinxout}[2]:\,\hspace{\fboxrule}\hspace{\fboxsep}}[<matplotlib.lines.Line2D at 0x7fd27c7b3940>]
---
> \llap{\color{nbsphinxout}[2]:\,\hspace{\fboxrule}\hspace{\fboxsep}}[<matplotlib.lines.Line2D at 0x177441b7a08>]
4412c4457
< doc/gallery/cell-tag.ipynb}} ends here.}}
---
> doc/gallery\textbackslash{}cell-tag.ipynb}} ends here.}}
4418c4463
< \sphinxcode{\sphinxupquote{\strut doc/gallery/cell-metadata.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/gallery\textbackslash{}cell-metadata.ipynb}} \dotfill}}
4455,4456c4500,4501
< /opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/traitlets/traitlets.py:2939: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
<   warn(
---
> C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}traitlets\textbackslash{}traitlets.py:2945: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
>   FutureWarning,
4506c4551
< \llap{\color{nbsphinxout}[5]:\,\hspace{\fboxrule}\hspace{\fboxsep}}<matplotlib.image.AxesImage at 0x7f6cf86517f0>
---
> \llap{\color{nbsphinxout}[5]:\,\hspace{\fboxrule}\hspace{\fboxsep}}<matplotlib.image.AxesImage at 0x247c3a7ffc8>
4523c4568
< doc/gallery/cell-metadata.ipynb}} ends here.}}
---
> doc/gallery\textbackslash{}cell-metadata.ipynb}} ends here.}}
4529c4574
< \sphinxcode{\sphinxupquote{\strut doc/gallery/multiple-outputs.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/gallery\textbackslash{}multiple-outputs.ipynb}} \dotfill}}
4611c4656
< doc/gallery/multiple-outputs.ipynb}} ends here.}}
---
> doc/gallery\textbackslash{}multiple-outputs.ipynb}} ends here.}}
4617c4662
< \sphinxcode{\sphinxupquote{\strut doc/gallery/no-thumbnail.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/gallery\textbackslash{}no-thumbnail.ipynb}} \dotfill}}
4628c4673
< doc/gallery/no-thumbnail.ipynb}} ends here.}}
---
> doc/gallery\textbackslash{}no-thumbnail.ipynb}} ends here.}}
4634c4679
< \sphinxcode{\sphinxupquote{\strut doc/gallery/thumbnail-from-conf-py.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/gallery\textbackslash{}thumbnail-from-conf-py.ipynb}} \dotfill}}
4678,4679c4723,4724
< /opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/traitlets/traitlets.py:2939: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
<   warn(
---
> C:\textbackslash{}hostedtoolcache\textbackslash{}windows\textbackslash{}Python\textbackslash{}3.7.9\textbackslash{}x64\textbackslash{}lib\textbackslash{}site-packages\textbackslash{}traitlets\textbackslash{}traitlets.py:2945: FutureWarning: --rc=\{'figure.dpi': 96\} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> {\ldots} multiple times to add items to a dict.
>   FutureWarning,
4717c4762
< doc/gallery/thumbnail-from-conf-py.ipynb}} ends here.}}
---
> doc/gallery\textbackslash{}thumbnail-from-conf-py.ipynb}} ends here.}}
4721c4766
< doc/subdir/gallery.ipynb}} ends here.}}
---
> doc/subdir\textbackslash{}gallery.ipynb}} ends here.}}
4727c4772
< \sphinxcode{\sphinxupquote{\strut doc/subdir/toctree.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/subdir\textbackslash{}toctree.ipynb}} \dotfill}}
4823c4868
< doc/subdir/toctree.ipynb}} ends here.}}
---
> doc/subdir\textbackslash{}toctree.ipynb}} ends here.}}
5224c5269
< \sphinxcode{\sphinxupquote{\strut doc/gallery/uno-rst.ipynb}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/gallery\textbackslash{}uno-rst.ipynb}} \dotfill}}
5235c5280
< doc/gallery/uno-rst.ipynb}} ends here.}}
---
> doc/gallery\textbackslash{}uno-rst.ipynb}} ends here.}}
5241c5286
< \sphinxcode{\sphinxupquote{\strut doc/gallery/due-rst.pct.py}} \dotfill}}
---
> \sphinxcode{\sphinxupquote{\strut doc/gallery\textbackslash{}due-rst.pct.py}} \dotfill}}
5310c5355
< doc/gallery/due-rst.pct.py}} ends here.}}
---
> doc/gallery\textbackslash{}due-rst.pct.py}} ends here.}}

The fist diff is due to, allowing the bash magic cell to fail. Some other diffs are also trivial (random numbers in the table or different memory addresses).

Noteworthy is the mixing of / and \ in paths, i.e.:

< doc/gallery/due-rst.pct.py}} ends here.}}
---
> doc/gallery\textbackslash{}due-rst.pct.py}} ends here.}}

I guess this could be saniticed within nbsphinx.

But I couldn't find that bug yet, which causes latex to fail the build. Maybe you have a keener eye for this (donwload i.e. this artifact)

tectonic vs TexLive

While tectonic is much quicker to build PDF (about 5sec, when all downloaded packages are cached) vs. texlive image based action (about 3min), I found that it also causes some formatting/encoding error. I.e. see page 4 the If you are using the conda package manager (e.g.˘awith nbsphinx.pdf

Also tectonic comes with its own bibtex implementation, as far as I know.

So IMHO tectonic would be suiteable to check if the latex code is valid, but to check if it looks properly TexLive will be needed.

Some other points to look out for

  • The old build folder needs to be removed before starting a new build or it starts nesting in itself.
  • Since actions/upload-artifact only supports files with valid windows names, so python:nbsphinx.pdf needs to be removed for latext builds before uploaded, when sphinx<2.4 is used
  • When istalling doc/requirements.txt the --prefer-binary should be used with pip, since pypy3 will fail to build matplotlib if the current wheel is missing

Conclusion

  1. As #496 shows, multiple versions of python should be tested on windows
  2. TexLive while slower than textonic provides the correct PDF
  3. Only test PDF creation on Linux (at least not windows) for now, since this is mostly done only on RTD anyway?
  4. Run linkcheck as separate job with github actions since it has 20 parallel jobs

s-weigand avatar Sep 29 '20 15:09 s-weigand

Just found the Error in the Windows version of nbsphinx.tex, it was caused by an extra empy sphinxVerbatim envionment.

{

\kern-\sphinxverbatimsmallskipamount\kern-\baselineskip
\kern+\FrameHeightAdjust\kern-\fboxrule
\vspace{\nbsphinxcodecellspacing}

\sphinxsetup{VerbatimColor={named}{white}}
\sphinxsetup{VerbatimBorderColor={named}{nbsphinx-code-border}}
\begin{sphinxVerbatim}[commandchars=\\\{\}]
\end{sphinxVerbatim}
}

This was caused by allowing the bash magic cell to fail with raises-exception.

s-weigand avatar Sep 29 '20 15:09 s-weigand

After some more investigation i found the problem with the malformed tectonic output. At some point when generating nbsphinx.tex a utf-8 none breaking space (b"\xc2\xa0") gets inserted after e.g. and i.e.. Since tectonic skips inputenc, but leaved the utf8 as is, this won't be converted to b"~". But since the font (pplr9d which is adobe palatino) doesn't support it, the PDF end up with ˘a.

One possible solution would be to replace b"\xc2\xa0" with b"~" after the *.tex file got created, but than we still get warning about other missing characters (, , , , , ł, ō). The characters ł and ō aren't displyed correctly as well.

The other solution would be to differentiate between different tex engines in the preamble and change the font for xelatex, which tectonic is dirived from. But since I'm a pdflatex user, I have no idea how to do this xelatex with fontspec, all my experiments did fail so far at least.

Another interesting point is that the tectonic generated PDF at some places looks more like the wanted result, than the pdflatex generated one. I.e. section 2.1.1.2, the link with adding copy to clipboard buttons, has the while the pdflatex version doesn't has it. nbsphinx-pdflatex.pdf nbsphinx-tectonic.pdf

s-weigand avatar Sep 29 '20 20:09 s-weigand

Thanks for your work on this!

So it looks like it would be good to use both TeXLive and Tectonic (because of the encoding differences, which we hopefully can fix at some later point). But do we need PDF generation on multiple OSs? I have the feeling that one would be enough. And the setup file would be simpler in case people want to use it as a template for their own CI.

Only test PDF creation on Linux (at least not windows) for now, since this is mostly done only on RTD anyway?

Yes, I think that's enough for now. We can always add more configurations later, if we feel like it.

[...] and add the raises-exception tag to the bash-magic cell.

Alternatively, we could just get rid of this example. Maybe we can use another cell magic as an example? Or we completely delete it, because there is a %%javascript example further down, anyway.

Noteworthy is the mixing of / and \ in paths, i.e.:

< doc/gallery/due-rst.pct.py}} ends here.}}
---
> doc/gallery\textbackslash{}due-rst.pct.py}} ends here.}}

I guess this could be saniticed within nbsphinx.

This can be fixed by changing nbsphinx_prolog, either by changing the slash to a backslash, or by filtering the rest of the path through posix_path.

The old build folder needs to be removed before starting a new build or it starts nesting in itself.

This should not be necessary if the build directory is outside the source directory. But we can discuss this in more details if you make a concrete PR.

The other solution would be to differentiate between different tex engines in the preamble and change the font for xelatex, which tectonic is dirived from. But since I'm a pdflatex user, I have no idea how to do this xelatex with fontspec, all my experiments did fail so far at least.

I don't have experience with that either, probably some if-clauses like in https://tex.stackexchange.com/a/44701/ should be used?

But anyway, we can leave this as is for now and try to fix it later.

Would you like to start with a PR for one of the setups (we don't have to do everything at once)?.

mgeier avatar Oct 01 '20 10:10 mgeier

I've just merged #491 which adds a workflow for linkcheck.

mgeier avatar Nov 02 '20 13:11 mgeier

@s-weigand Any news?

mgeier avatar Nov 24 '20 11:11 mgeier

I've just added #559 for building HTML on macOS.

@s-weigand Do you want to provide your work on the other variants as a PR (or multiple PRs)?

Doesn't matter if it's incomplete, we can keep working on the individual PRs.

mgeier avatar Apr 29 '21 14:04 mgeier