Skip to main content

A Fable (python) kernel for Jupyter

Project description

F# and Fable (Python) support for Jupyter

Fable Python is an F# kernel for Jupyter based on Fable and IPythonKernel. Fable is a transpiler that converts F# to Python (and JavaScript).

This work is work-in-progress and related to

Install

Make sure you have a recent version of .NET installed on your machine: https://dotnet.microsoft.com/download

git clone https://github.com/dbrattli/Fable.Jupyter.git
cd Fable.Jupyter

dotnet tool install -g fable-py --version 4.0.0-alpha-010
python -m fable_py install

Usage

You can use Fable Python in the Jupyter notebook by selecting the "F# (Fable Python)" kernel. To start Jupyter run e.g:

jupyter notebook

The process currently needs to be running while using the notebook. TODO: see if we can do it the other way around and start dotnet from Python instead.

Magic commands

You can inspect the generated Python code by executing %python in a cell:

%python

You can inspect the maintained F# program by executing %fsharp in a cell:

%fsharp

F# Program

The kernel works by maintaining an F# program Fable.fs behind the scenes. This program lives in a tmp folder.

Sometimes the generated F# program might become invalid because of the submitted code fragments (this happens with a Python notebook as well). The way to recover is to reset the kernel. That will reset the F# program that is running behind the notebook. To reset the kernel select on the menu: Kernel -> Restart or Kernel -> Restart & Clear Output.

If you need additional package references you currently need to add them manually to the Fable.fsproj project file. TODO: handle #r nuget "... commands from within the notebook.

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

fable_py-0.3.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

fable_py-0.3.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file fable_py-0.3.0.tar.gz.

File metadata

  • Download URL: fable_py-0.3.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.2

File hashes

Hashes for fable_py-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b362c9e0107921da0c4ec163f8d3fd143bf5cb3094ca0db81d454ceb9773cc2a
MD5 5d9fc55c4de2ffa4c469266606984de0
BLAKE2b-256 5e0caeae9cef267d48cbc6833e1a4a2c245a9bab2eee7b89261e6688c5ac2b2b

See more details on using hashes here.

File details

Details for the file fable_py-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: fable_py-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.2

File hashes

Hashes for fable_py-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aea4e92c889ca86b541cae8720d8b982890aceabf21f5478b595ccea90ecf935
MD5 1ff00aa74fc840e03c3dd2030860fcaa
BLAKE2b-256 028c7eb2811ebf163266677cf5bddd3c7ce0de309eea670fcc8e65ba820c7410

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