Write F#, run Python - a practical guide to Fable.Python
This is a comprehensive guide to Fable.Python, written as literate F# that transpiles to Python and generates its own documentation.
- Introduction - What is Fable.Python and why use it
- Getting Started - Setup, your first project, hello world
- Bindings - Python interop and type bindings
- Compatibility - Supported F# features and limitations
This guide is self-documenting: each chapter is an .fs file with embedded Markdown comments using FSharp.Formatting conventions. Fabletext, a literate converter inspired by jupytext (also written in F# and transpiled via Fable.Python), processes these files to generate the final Markdown output.
# Install dependencies
just setup
just restore
npm install
# Build everything (F# → Python → Markdown)
just all
# Or generate just the blogpost
just blogpostjust setup # Install Fable and Python dependencies (uv)
just restore # Restore NuGet packages
just build # Compile F# to Python with Fable
just generate # Convert chapters to individual markdown files
just blogpost # Generate concatenated blogpost.md for publishing
just format # Format Python files with ruff
just lint # Lint Python (ruff) and Markdown (markdownlint)
just all # Full pipeline: restore, build, generate, format, lint
just clean # Remove generated fileschapters/
├── 01-introduction.fs # What is Fable.Python
├── 02-getting-started.fs # Setup and first project
├── 03-bindings.fs # Python interop
└── 04-compatibility.fs # F# feature support
tools/
├── fabletext.fs # Fabletext converter (F#)
└── fabletext.fsproj
output/
├── chapters/ # Generated Python from chapters
└── tools/
└── fabletext.py # Generated converter (Python)
docs/
├── 01-introduction.md # Individual chapter docs
├── ...
└── blogpost.md # Concatenated for Hashnode
- Fable 5 (alpha) - F# to Python compiler
- uv - Python dependency management
- just - Command runner
- ruff - Python formatter/linter
- markdownlint - Markdown linter
GitHub Actions automatically:
- Builds all F# to Python
- Generates the blogpost
- Opens a PR when content changes
Part of F# Advent 2025