JupyterLab bundler names

Does somebody know the different ways a bundler extension can influence the name displayed in the “Export As …” menu of JupyterLab?

I created a new extension that allows users to save their notebook as PDF. I would like to display a name like in this screenshot. However the way it is setup right now I get a 404 when I click that menu item.

I am currently using nbconvert’s “register a exporter via an entry point” way of configuring things:

JupyterLab seems to use the part to the left of the = as the name to display in the menu. When I change the entrypoint definition to

        "nbconvert.exporters": ["PDF = notebook_as_pdf:PDFExporter"]

I get two entries called “PDF”. The first one is my new extension, the second one the default exporter. Everything works (how the notebook keeps them apart is a mystery :wink: ) in this setup. The problem is that as a unsuspecting user it is hard to know which “PDF” extension is which.

My thinking right now is that using a white-spaced name in the entry points definition doesn’t quite work. In classic notebook the export_from_notebook attribute of the exporter class is used. So I can get a pretty name that way. However lab doesn’t seem to use that. Does anyone know what is used instead? In particular the menu entry for rST exporter or reveal.js exporter have “pretty names” which I would like to copy. Looking at the nbconvert code (here and here) I can’t work out how it does this magic trick. Some pointers or ideas would be welcome.

Try yourself with this binder

Hi Tim,

We’re getting the info from the /api/nbconvert endpoint. Here’s where we query the info and build up that menu.

1 Like

@betatim If it helps, last time I checked my nb2xls NBConvert extension works in JupyterLab’s Export menu. It has quite a small codebase that might be easy to compare to yours!

I’m afraid I understood the question but not the answer.
I can see setting export_from_notebook has an effect in “classic” notebook view, not in JLab.
However some built-in exporters in JLab do have pretty names in the “Files>Save and export as…” menu.

Question: How can a custom exporter do that?
Thanks in advance.