Converter from Jupyter notebook format to Org format (Emacs text editor), without requirements for any libraries.
Project description
Table of Contents
j2o
Converter from Jupyter to Org file format without any dependencies.
I don't want to install Jupyter core and nbconver or pandoc with 164 dependencies just to be able to convert simple JSON format, that is why I just wrote coverter from scratch.
Tested for nbformat: 4.2.
TODO: make reverse convrter.
Command line usage
usage: j2o myfile.ipynb [-w] [-j myfile.ipynb] [-o myfile.org]
Convert a Jupyter notebook to Org file (Emacs) and vice versa
positional arguments:
jupfile_ Jupyter file
options:
-h, --help show this help message and exit
-j JUPFILE, --jupfile JUPFILE
Jupyter file
-o ORGFILE, --orgfile ORGFILE
Target filename of Org file. If not specified, it will
use the filename of the Jupyter file and append .ipynb
-w, --overwrite Flag whether to overwrite existing target file.
Other useful projects
- p2j https://pypi.org/project/p2j/ https://github.com/remykarem/python2jupyter
- https://github.com/jkitchin/ox-ipynb
Review of format for ipynb
JSON
{
cells: [
cell_type: "code/markdown",
source: ["\n","\n",""],
outputs: [{
text: ["\n", "\n"],
data: {
image/png: "base64....",
text/plain: "image description"}
}
]
],
metadata: {
kernelspec: {
language: "python"
}
}
}
How it works
- Loops through "cells".
- Extract "source"
- add Org header and tail around source ("#+begin_src python …", "#+end_src")
features
- in markdown cells conversion: source blocks, ‘#’ to ‘*’.
- code cells: images
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
j2o-0.0.5.tar.gz
(622.6 kB
view details)
Built Distribution
j2o-0.0.5-py3-none-any.whl
(5.9 kB
view details)
File details
Details for the file j2o-0.0.5.tar.gz
.
File metadata
- Download URL: j2o-0.0.5.tar.gz
- Upload date:
- Size: 622.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f58e103e22fa25253abd34e72dceea81e0e47427f16dec84a06796d3c56a2a01 |
|
MD5 | e98aeaa763a92f254cb96501009c1dba |
|
BLAKE2b-256 | 487580435b83520c5671977bc9b3b3aa47b82d198f026bf9a7ac1f406f8b2007 |
File details
Details for the file j2o-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: j2o-0.0.5-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1786930eff8e5ca15bc33672a6d2a7f478c82899857b1ce6abca0f33a7f5e7c6 |
|
MD5 | a2d84e1957703837e599f1a1eb556c28 |
|
BLAKE2b-256 | e56cf46862e2722e495bdcce2efa2f4ee9125713a8d05d3c6345f21adb47a04d |