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

Upgrade nbconvert #1015

Merged
merged 42 commits into from
Nov 7, 2022
Merged

Upgrade nbconvert #1015

merged 42 commits into from
Nov 7, 2022

Conversation

martinRenou
Copy link
Member

@martinRenou martinRenou commented Aug 11, 2022

Revive #1003 and merge with #1014

closes #1003
closes #1014
closes #959

this is now handled upstream
avoids super-deprecated nose
@minrk minrk force-pushed the upgrade-nbconvert branch 2 times, most recently from 08b6195 to 5346159 Compare August 22, 2022 12:47
@minrk minrk force-pushed the upgrade-nbconvert branch 3 times, most recently from 6c7a227 to 2c55978 Compare August 22, 2022 13:52
@minrk
Copy link
Member

minrk commented Aug 22, 2022

@martinRenou this mostly works now, but the lab template's font-awesome 5 is conflicting with the font-awesome 4 used on the nbviewer page, erasing the icons:

Screen Shot 2022-08-22 at 14 47 05

Not sure if there's a simple fix for that.

@minrk minrk force-pushed the upgrade-nbconvert branch 2 times, most recently from db4a3d2 to 47bfe99 Compare August 22, 2022 13:55
@martinRenou
Copy link
Member Author

martinRenou commented Aug 22, 2022

Thanks a lot for pushing on this @minrk !

but the lab template's font-awesome 5 is conflicting with the font-awesome 4 used on the nbviewer page, erasing the icons:

In Voila we do the following, maybe that will fix the nbviewer case:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@^5/css/all.min.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@^5/css/v4-shims.min.css" type="text/css" />

See https://github.com/voila-dashboards/voila/blob/2b6694191324109c884dc48cc93073977fdacca6/share/jupyter/voila/templates/lab/index.html.j2#L20

I am not sure where to add this though. I wonder if this should go directly in nbconvert.

@minrk
Copy link
Member

minrk commented Aug 24, 2022

We should update to fa5, but this backward-incompatibility is definitely an issue. The shims do work in layout.html (after our own css), but result in a different size than before:

before:
Screen Shot 2022-08-24 at 12 39 30

after:
Screen Shot 2022-08-24 at 12 39 27

@Carreau
Copy link
Member

Carreau commented Oct 31, 2022

The navbar seem to be missing visually as well.
Screen Shot 2022-10-31 at 09 31 59

Replace ImportError with ModuleNotFoundError, and cleanup a number of
types
@Carreau
Copy link
Member

Carreau commented Oct 31, 2022

One another big problem is that some notebooks completely fail.

For example, IRuby from the main page:

      File "/Users/bussonniermatthias/miniforge3/envs/nbv/share/jupyter/nbconvert/templates/lab/base.html.j2", line 162, in block 'data_svg'
        {{ output.data['image/svg+xml'] | clean_html }}
      File "src/lxml/html/clean.py", line 562, in lxml.html.clean.Cleaner.clean_html
      File "/Users/bussonniermatthias/miniforge3/envs/nbv/lib/python3.10/site-packages/lxml/html/__init__.py", line 873, in fromstring
        doc = document_fromstring(html, parser=parser, base_url=base_url, **kw)
      File "/Users/bussonniermatthias/miniforge3/envs/nbv/lib/python3.10/site-packages/lxml/html/__init__.py", line 759, in document_fromstring
        value = etree.fromstring(html, parser, **kw)
      File "src/lxml/etree.pyx", line 3254, in lxml.etree.fromstring
      File "src/lxml/parser.pxi", line 1908, in lxml.etree._parseMemoryDocument
    ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

@@ -138,7 +138,7 @@ Pass `-d` or `--debug` to `invoke less` to create a CSS sourcemap, useful for de

```shell
$ cd <path to repo>
$ python -m nbviewer --debug --no-cache
$ python -m nbviewer --debug --no-cache --host=127.0.0.1
Copy link
Member

Choose a reason for hiding this comment

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

I think listening on 0.0.0.0 by default is a security problem. Well, here on macos, it present me from doing so without root access so It's ok-ish, but i'd like to fix it.

Copy link
Member

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

Slides are also quite broken.

For example you can compare with https://nbviewer.org/format/slides/github/astrojuanlu/talk-dataframes/blob/main/slides.ipynb

nbviewer/app.py Show resolved Hide resolved
nbviewer/app.py Show resolved Hide resolved
nbviewer/formats.py Show resolved Hide resolved
nbviewer/providers/base.py Outdated Show resolved Hide resolved
nbviewer/providers/github/handlers.py Outdated Show resolved Hide resolved
@Carreau
Copy link
Member

Carreau commented Oct 31, 2022

Most of the reveal issue seem to be coming down to font-size being way to big.

Something like the following in the right place make it bearable.

div.reveal {
    font-size: 10px;

}

Now we do seem to have 2 sets of reveal controls on the page if you look carefully:

Screen Shot 2022-10-31 at 16 15 10

@Carreau Carreau force-pushed the upgrade-nbconvert branch 2 times, most recently from 930b404 to 4545153 Compare November 1, 2022 08:46
@Carreau
Copy link
Member

Carreau commented Nov 1, 2022

So there are indeed 2 reveal. One done by nbconvert, and one by nbviewer.

Really this is crazy that we are embedding a full nbconvert with body|safe, that even include DOCTYPE ????. And of course the Reveal from nbconvert has no hooks, so we can't listen to the slide change event to hide the the nbviewer header.

The new nbconverts are really backward in term of reusing the templates...

@Carreau Carreau mentioned this pull request Nov 1, 2022
MathJax.Hub.Rerender(Reveal.getCurrentSlide());
}
var idx = Reveal.getIndices();
$('#menubar').headroom((!idx.h && !idx.v) ? 'pin' : 'unpin');
Copy link
Member

Choose a reason for hiding this comment

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

That is the part we can't do without changes to nbviewer.

Copy link
Member

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

I think that's about as far as I we can reasonably take it in a single PR. It works, but there is still alot of work to do.

@Carreau
Copy link
Member

Carreau commented Nov 7, 2022

I think we should leapfrog nbconvert 6.x and go directly to 7.x, I'm going to create a 1.x branch that is the current main, and suggest main become 2.x.

@minrk
Copy link
Member

minrk commented Nov 7, 2022

If that makes it easier, by all means!

@Carreau
Copy link
Member

Carreau commented Nov 7, 2022

If that makes it easier, by all means!

It's more on the communication side, there will be likely so much change between 1.x and main, that it does make sens to bump major version number. This also let us re-do a 1.x at one point if ever necessary.

I've push a 1.x branch, and I'm going to merge this and keep iterating, once this is merged, main should not be considered stable as a number of notebook likely won't render yet, and reveal is still partially broken .

@Carreau Carreau merged commit ae2f358 into jupyter:main Nov 7, 2022
@martinRenou martinRenou deleted the upgrade-nbconvert branch November 7, 2022 10:04
@martinRenou
Copy link
Member Author

Thanks a lot for pushing on this!

@mgeier
Copy link

mgeier commented Nov 16, 2024

Would it be possible to get another nbconvert upgrade on https://nbviewer.org/?

I think the latest release should fix an issue where SVG images are not displayed correctly: jupyter/nbconvert#1863.
See also #1037.

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.

5 participants