Open custom notebooks for different filetypes


I’d like to achieve the following:
Upon attempting to open a file with an extension/format not supported by Jupyter, I’d like to open a custom notebook instead. For example, I’d like to be able to open a .npz (numpy archive) file and, instead of an error saying that the file format isn’t utf-8 encoded, create a notebook that I could just run to visualize the content of the .npz file.

Is it achievable?


1 Like

Helping folks to work with files in templated notebooks is an interesting idea, but we’d want to be careful that Lab, etc. didn’t think the npz actually was a notebook… more like it would be a command (which ideally could be opened from that failure dialog), e.g.

foo.npz is not UTF-8 Encoded

[CANCEL] [Open with example notebook...]

A potential home for such an effort is jupyterlab-starters which is triggered by commands and launcher items, and creates templated files/folders. A starter is currently parametrized by (at least) the current working directory… but an alternate command would make it possible to pre-seed with a file.

In the case of an .npz, one would need, well, numpy, but other libraries might offer other interesting cases… i guess one would make packages that provided default notebooks (or really any activity), and ensure they brought the correct dependencies along for the ride.