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

You also need to install the fable-py .NET tool globally (and make sure it's available in PATH environment)

dotnet tool install -g fable-py --version 4.0.0-alpha-026

pip install fable-py
python -m fable_py install

To use the very latest changes (for development):

git clone https://github.com/dbrattli/Fable.Jupyter.git
cd Fable.Jupyter
python setup.py develop
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

# or

jupyter lab

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 separate tmp folder for each instance of the kernel.

Sometimes the generated F# program might become invalid because of the submitted code fragments (this can happen 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.

or you can use the reset command:

%reset

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.7.0.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

fable_py-0.7.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fable_py-0.7.0.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fable_py-0.7.0.tar.gz
Algorithm Hash digest
SHA256 0a524c4b2ebaa56b135d3944dc5f66ed00cf54720b7bd6436d324f296e92d69d
MD5 8049ee225303f436cfbd456585fa66c0
BLAKE2b-256 c6c484e43bd17b3bc4a18d26a2c52675d73f1b3e77a1df2bcf89f9c848ee9dee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fable_py-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fable_py-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f09bbd578abc37342622804f68b4fae953facad69233bf9b0fa90806e2f2572
MD5 eebcc08b8325a5d9722ce653951aa2f0
BLAKE2b-256 4198d8aff1a97a33817dea342ae22a94f5985f79ce550b3897e21c3c86977ba6

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