Skip to main content

Converter from Jupyter notebook format to Org format (Emacs text editor), without requirements for any libraries.

Project description

Table of Contents

  1. j2o
  2. Command line usage
  3. Other useful projects
  4. Review of format for ipynb
  5. How it works
  6. features

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.

https://pypi.org/project/j2o/

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

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

  1. Loops through "cells".
  2. Extract "source"
  3. 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.4.tar.gz (622.6 kB view details)

Uploaded Source

Built Distribution

j2o-0.0.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file j2o-0.0.4.tar.gz.

File metadata

  • Download URL: j2o-0.0.4.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

Hashes for j2o-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4f5e0c451776b382f299d2a1560f0a4600f72ea12ad9e8e1f7a731cb233cedff
MD5 4544b57343a87c46399ca26c8fe29257
BLAKE2b-256 7e1ad301ab430293dc8035a9f5bf3029c48bf7c8f43e2f390afd42f3ff5cb5d3

See more details on using hashes here.

File details

Details for the file j2o-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: j2o-0.0.4-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

Hashes for j2o-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fcb5ae6919c5e1ea1a874ade240c28d93f4f101d1fda00f5347989d8f2959e20
MD5 9dbe80da2c713c21fa5536c025395b18
BLAKE2b-256 2fe0445f28c2d44a756ea32dbc5867bfa60fbac4b040cd3b37488a8d45f40b94

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page