https://github.com/fslaborg/nbformat.net
A pure F# library for parsing and converting the `.ipynb` notebook file format
https://github.com/fslaborg/nbformat.net
Last synced: about 1 year ago
JSON representation
A pure F# library for parsing and converting the `.ipynb` notebook file format
- Host: GitHub
- URL: https://github.com/fslaborg/nbformat.net
- Owner: fslaborg
- License: mit
- Created: 2023-03-25T09:55:58.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-31T14:03:14.000Z (over 2 years ago)
- Last Synced: 2025-05-02T00:49:55.306Z (about 1 year ago)
- Language: F#
- Homepage:
- Size: 62.5 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NBFormat.NET
A pure F# library for parsing the `.ipynb` notebook file format v4.
It uses [System.Text.Json]() in conjunction with the absolutely amazing [FSharp.SystemTextJson](https://github.com/Tarmil/FSharp.SystemTextJson) library.
There currently is a missing link in the .NET ecosystem between working in .NET notebooks and exporting them to other formats.
If you want to use .NET polyglot notebooks for creating documentation or websites, you have to use `nbconvert`, which is a python tool and therefore requires the setup of a python environment.
This library aims to close that gap by
- providing a type model for the `.ipynb` format (and the additional magic sauce added by .NET interactive)
- providing an extensible interface for converting polyglot notebooks into other formats
## Develop
### build
Check the [build project](https://github.com/kMutagene/NBFormat.NET/blob/main/build) to take a look at the build targets. Here are some examples:
```shell
# Windows
# Build only
./build.cmd
# build and run tests
./build.cmd runTests
# Linux/mac
# Build only
build.sh
# build and run tests
build.sh runTests
```
## Usage
The library is not on nuget currently, so you currently have to clone the repo and build it yourself.
Then you can use it to deserialize a notebook file like this:
```fsharp
open NBFormat.NET
open System.IO
"your/path/to/a/notebook.ipynb"
|> File.ReadAllText
|> Serialization.deserializeNotebook
```