ipynb: Data structure for working with Jupyter notebooks (ipynb).

[ bsd3, library, text ] [ Propose Tags ] [ Report a vulnerability ]

ipynb defines a data structure for representing Jupyter notebooks, along with ToJSON and FromJSON instances for conversion to and from JSON .ipynb files.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1, 0.1.0.1, 0.1.0.2, 0.2, 0.3
Change log Changelog.md
Dependencies aeson (>=2.0), base (>=4.11 && <5), base64-bytestring, bytestring, containers (>=0.5.8), text, unordered-containers [details]
License BSD-3-Clause
Copyright Copyright (C) 2019 John MacFarlane
Author John MacFarlane
Maintainer jgm@berkeley.edu
Uploaded by JohnMacFarlane at 2026-11-14T18:06:11Z
Category Text
Source repo head: git clone https://github.com/jgm/ipynb.git
Distributions Arch:0.2, Fedora:0.2, LTSHaskell:0.2, Stackage:0.2
Reverse Dependencies 2 direct, 171 indirect [details]
Downloads 24322 total (55 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-11-14 [all 1 reports]

Readme for ipynb-0.3

[back to package description]

ipynb

CItests

ipynb is a Haskell library for representing Jupyter notebooks and converting them to and from the JSON .ipynb format. The format is documented here: https://nbformat.readthedocs.io/en/latest/.

Both version 4 and version 3 are supported, though the data structure used is the same. A phantom type is used to provide different JSON serializations for the two versions. When working with version 4, use Notebook NbV4; when working with version 3, use Notebook NbV3.

The test suite verifies that write . read and read . write are identities, up to semantically insignificant differences in the JSON output.

The JuPyTer-notebook library has a similar job description, but there are some important differences:

  • JuPyTer-notebook parses code cell output as JSON; ipynb has a custom representation of Output.

  • JuPyTer-notebook allows representing some illegal cells (e.g., with cell_type markdown but also with execution_count and outputs). ipynb goes further in making illegal notebooks unrepresentable.

  • ipynb supports both v3 and v4 of nbformat, both in reading and writing; JuPyTer-notebook supports only v4 (and does not support the more recent v4 feature, attachments).

  • JuPyTer-notebook parses some notebook metadata into custom structures (using data type disjunction (:|:) to provide a fallback of text or a JSON value when parsing fails). ipynb just leaves all metadata as JSON Values.

  • JuPyTer-notebook depends on json-autotype, and thus has a much heavier transitive dependency graph than ipynb.