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

Importing Jupyter notebooks #1300

Open
J-Savage opened this issue Nov 6, 2021 · 11 comments
Open

Importing Jupyter notebooks #1300

J-Savage opened this issue Nov 6, 2021 · 11 comments

Comments

@J-Savage
Copy link

J-Savage commented Nov 6, 2021

Is there any way, or any plans, to import Jupyter notebooks into boost note? I've noticed that R Markdown output files import reasonably well as an html file, but not sure about Jupyter.

@Komediruzecki
Copy link
Contributor

Komediruzecki commented Nov 20, 2021

Hi,

Which type do you mean by Jupyter? If ipynb, you could convert It to markdown yourself: https://ipython.org/ipython-doc/3/notebook/nbconvert.html, or just use JupyterLab to load and download Markdown (or HTML) file from the notebook. Afterward, HTML or MD files could be imported to Boost Note.

Does this solution satisfy you, or you would need an importer who would do something similar?

We don't have any plans currently for this, but it seems like a nice feature, there is maybe some library that converts it, so we could use it to implement this.

@J-Savage
Copy link
Author

I tried the methods you suggested. Exporting from JupyterLab to HTML and then importing to BoostNote lost a lot of formatting. Doing the same with MD worked much better (as expected). The only major issue is that JupyterLab saves plots as separate png files which don't get imported automatically to BoostNote when importing the MD file. This isn't so much an issue with small notebooks, but when there are several dozen plots it can be a bit of a pain.

@Komediruzecki
Copy link
Contributor

Hi,

Since they are separate PNG files, then I suppose you would need to give the Boost Note the whole zip containing PNGs as well as ipynb, this would definitely need a custom importer but is not out of the question.

@webbdays
Copy link

webbdays commented Mar 2, 2022

I would like to work on this issue.

We can use existing file importer(allow to import jupyter notebooks as well).

  1. User uploads jupyter notebooks.
  2. Let's say those files saved in a folder1 on the server.
  3. Now on the server run a python script to convert the jupyter notebooks to Markdown files.
  4. Python script : use subprocess module to run system command.

@webbdays
Copy link

webbdays commented Mar 2, 2022

https://ipython.org/ipython-doc/3/notebook/nbconvert.html

Command : ipython nbconvert --to markdown notebook.ipynb

@webbdays
Copy link

webbdays commented Mar 8, 2022

Is it not implementable ?

@Komediruzecki
Copy link
Contributor

Hi,

sorry for long await,

It should be implementable, but maybe the best would be through dedicated server i.e. PDF exporter server which we use or something similar.

Unfortunatelly you cannot work on it since backend is currently not accessible for community.

Maybe @Rokt33r can give some insights into how achievable and prioritized this should be.

@webbdays
Copy link

webbdays commented Mar 8, 2022

Ok

@Rokt33r
Copy link
Member

Rokt33r commented Mar 9, 2022

@webbdays

I'd like to have a CLI app to tackle this issue rather than implementing directly to our server.

The CLI should:

  1. Be installable via NPM
  2. Generate markdown files and image assets
  3. Upload the assets via Boost Note API and generate a map of URL of the uploaded assets.
  4. Create docs via Boost Note while replacing asset URLs in the markdown files with the URL of the uploaded.

Do you think you can tackle the 1st and 2nd ones? I'll check our API to figure out what I need to implement more for the 3rd and the 4th.

@webbdays
Copy link

webbdays commented Mar 12, 2022

@Rokt33r

I am building a cli in python. Because nbconvert module is available in Python for notebook to Markdown conversion.

I was able to convert to markdown.
But trying to convert raw image data into images.

If it is done I will make a c program file out of it using cython and compile it.
And will use that binary in the module and package it as npm package.

@webbdays
Copy link

even better way to get binary from python program is with pyinstaller python package.

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

No branches or pull requests

4 participants