notebook with pencil
Development, Functional programming

F# notebooks

Jupyter notebooks have been a thing for a while now in data science communities. Recently I wanted to take a look at how to set these up with support for the F# programming language. While there is some documentation out there, I quickly got lost in a plethora of alternative tools and out-of-date documentation. This walkthrough will get you up and running with F# Jupyter notebooks online and in your vscode editor in no time!

notebook with pencil


Notebooks enable a form of interactive computing. While we have been using REPLs (read-eval-print-loops) and interactive IDE’s for a while now, notebooks provide a somewhat different approach. Like a REPL they are designed to be interactive (you can change and play around with code in published notebooks), like a REPL they provide support for displaying intermediate results, tables and graphs in-line next to the code. Where notebooks differ from most REPLs is that they support literate programming, allowing you to mix text, images and documentation with in-line executable F# code which people can execute and even change on the fly. This combination of textual explanation and interactive code is a perfect match for sharing courses, interactive tutorials and data visualisations.

To get a better picture of the experience a notebook provides watch my youtube tutorial or take a look at the “Interactive Computing with F# Jupyter” 2019 FOSDEM talk by Colin Gravill. If you’re interested in how these notebooks work technically, the same talk gives a good overview on the .NET side of things.

Working with notebooks locally

I tried several approaches, but the easiest alternative as of now is by far the .NET interactive Notebooks vscode extension. It allows you to create new notebooks and interact with them on your machine, right in your vscode editor.

With this extension you just need to have vscode and .NET installed on your machine to get started. Download the latest .NET SDK, install vscode and the notebooks extension, hit ctrl+shift+p to “Create new interactive notebook” and you’re up and running! This setup beats all other alternatives I tried, which had me manually fumbling around with Python pip installers, jupyter kernelspecs and what have you. This extension does all the heavy lifting for you.

Working with notebooks online

Binder is a service that again does all the heavy lifting for you. With binder, you can share your own notebooks with people online where they can read, change and otherwise interact with notebooks, all from their browser window, no tools required! All you need to do yourself is set up a github repository containing your notebook files.

Again, it took me a couple of hours getting this up and running for F# initially (which I mainly spent wrestling with Dockerfiles and missing or otherwise out-of-date documentation). Once you have everything set up however, publishing a new online notebook is as straightforward as pushing a code change to a git repository.

I prepared a github repository you can fork yourself so you can get started with your own F# notebooks in 5 minutes.

Show me the code

  • github repository containing example notebooks, dockerfiles and everything you need for hosting your own notebooks online in binder
  • binder: the online environment where you can host, share and play around with Jupyter notebooks


Jupyter notebooks are an amazing platform to share interactive documents where text and code live alongside each other. They offer great data visualisation support and are designed to be interacted with.

It still requires a bit of tinkering to get up and running with F# in your Jupyter notebooks, but I hope this post and code examples help you get started quicker.

Have you create F# notebooks yourself? Have you seen impressive examples online?

I’d love to hear about them at ✉ @jovaneyck !


One thought on “F# notebooks

  1. Pingback: F# Weekly #29, 2021 – HOPL IV talk “Narratives in the Early History of F#” & .NET 6 Preview 6 – Sergey Tihon's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.