Skip to content

Commit 81e1d5e

Browse files
committed
doc: Update README
1 parent c0ea80e commit 81e1d5e

1 file changed

Lines changed: 59 additions & 29 deletions

File tree

‎README.md‎

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,29 @@ This is a comprehensive guide to [Fable.Python](https://github.com/fable-compile
77
## Chapters
88

99
1. **Introduction** - What is Fable.Python and why use it
10-
2. **Getting Started** - Setup, your first project, hello world
11-
3. **Bindings** - Python interop and type bindings
12-
4. **Compatibility** - Supported F# features and limitations
13-
5. **Fable v5** - What's new in Fable v5 for Python
14-
6. **Pydantic** - Pydantic interop with Decorate and ClassAttributes
15-
7. **Units of Measure** - Compile-time dimensional analysis
16-
17-
## The Meta Twist
18-
19-
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](https://github.com/mwouts/jupytext) (also written in F# and transpiled via Fable.Python), processes these files to generate the final Markdown output.
10+
2. **For Python Developers** - F# concepts explained for Pythonistas
11+
3. **Getting Started** - Setup, your first project, hello world
12+
4. **Interop** - Using existing Python libraries and Fable.Python bindings
13+
5. **Bindings** - Creating your own type-safe bindings for Python libraries
14+
6. **Compatibility** - Supported F# features and limitations
15+
7. **Fable v5** - What's new in Fable v5 for Python
16+
8. **Libraries** - Existing ecosystem (Thoth.Json, AsyncRx, Siren, etc.) *(coming soon)*
17+
9. **Pydantic** - Pydantic interop with Decorate and ClassAttributes
18+
10. **Units of Measure** - Compile-time dimensional analysis
19+
11. **Testing** - XUnit and Fable.Pyxpecto *(coming soon)*
20+
12. **Fabletext: The Strange Loop** - The self-documenting finale
21+
22+
## The Strange Loop
23+
24+
This guide is self-documenting: each chapter is an `.fs` file with embedded Markdown comments. **Fabletext** (the final chapter) processes these files to generate the documentation you're reading - including itself.
25+
26+
The chain:
27+
1. Write F# with embedded Markdown (`chapters/*.fs`)
28+
2. Compile to Python with Fable
29+
3. Run Fabletext (F# compiled to Python) to extract documentation
30+
4. Output: the Markdown you're reading
31+
32+
The blog post is its own proof of concept.
2033

2134
## Quick Start
2235

@@ -41,7 +54,7 @@ just restore # Restore NuGet packages
4154
just build # Compile F# to Python with Fable
4255
just generate # Convert chapters to individual markdown files
4356
just blogpost # Generate concatenated blogpost.md for publishing
44-
just format # Format Python files with ruff
57+
just format # Format F# (fantomas) and Python (ruff) files
4558
just lint # Lint Python (ruff) and Markdown (markdownlint)
4659
just all # Full pipeline: restore, build, generate, format, lint
4760
just clean # Remove generated files
@@ -51,47 +64,64 @@ just clean # Remove generated files
5164

5265
```text
5366
chapters/
54-
├── 01-introduction.fs # What is Fable.Python
55-
├── 02-getting-started.fs # Setup and first project
56-
├── 03-bindings.fs # Python interop
57-
├── 04-compatibility.fs # F# feature support
58-
├── 05-fable-v5.fs # What's new in Fable v5
59-
├── 06-pydantic.fs # Pydantic interop
60-
└── 07-units-of-measure.fs # Dimensional analysis
67+
├── introduction.fs # What is Fable.Python
68+
├── python.fs # F# for Python developers
69+
├── getting-started.fs # Setup and first project
70+
├── interop.fs # Using Python libraries
71+
├── bindings.fs # Creating bindings
72+
├── compatibility.fs # F# feature support
73+
├── fable-v5.fs # What's new in Fable v5
74+
├── pydantic.fs # Pydantic interop
75+
└── units-of-measure.fs # Dimensional analysis
6176
tools/
62-
├── fabletext.fs # Fabletext converter (F#)
77+
├── fabletext.fs # Fabletext converter (F#)
6378
└── fabletext.fsproj
6479
output/
65-
├── chapters/ # Generated Python from chapters
80+
├── chapters/ # Generated Python from chapters
6681
└── tools/
67-
└── fabletext.py # Generated converter (Python)
82+
└── fabletext.py # Generated converter (Python)
6883
docs/
69-
├── 01-introduction.md # Individual chapter docs
84+
├── introduction.md # Individual chapter docs
85+
├── python.md
7086
├── ...
71-
└── blogpost.md # Concatenated for Hashnode
87+
└── blogpost.md # Concatenated for Hashnode
88+
```
89+
90+
## Chapter Order
91+
92+
Defined in `justfile`:
93+
94+
```just
95+
chapters := "introduction python getting-started interop bindings compatibility fable-v5 pydantic units-of-measure"
7296
```
7397

98+
To add a new chapter, just add the file and update this list.
99+
74100
## Technology Stack
75101

76102
- **Fable 5** (alpha) - F# to Python compiler
77103
- **uv** - Python dependency management
78104
- **just** - Command runner
79105
- **ruff** - Python formatter/linter
106+
- **fantomas** - F# formatter
80107
- **markdownlint** - Markdown linter
81108

82-
## CI/CD
83-
84-
GitHub Actions automatically:
109+
## Related Libraries
85110

86-
- Builds all F# to Python
87-
- Generates the blogpost
88-
- Opens a PR when content changes
111+
- [Thoth.Json.Python](https://github.com/thoth-org/Thoth.Json.Python) - Type-safe JSON
112+
- [AsyncRx](https://github.com/dbrattli/AsyncRx) - Reactive extensions
113+
- [Fable.Giraffe](https://github.com/dbrattli/Fable.Giraffe) - Web framework
114+
- [Feliz.ViewEngine](https://github.com/dbrattli/Feliz.ViewEngine) - HTML DSL
115+
- [Siren](https://github.com/Freymaurer/Siren) - Mermaid diagrams
116+
- [Fable.Pyxpecto](https://github.com/Freymaurer/Fable.Pyxpecto) - Testing
117+
- [ARCtrl](https://github.com/nfdi4plants/ARCtrl) - Real-world multi-target library
89118

90119
## Resources
91120

92121
- [Fable](https://fable.io/)
93122
- [Fable.Python Documentation](https://fable.io/docs/getting-started/python.html)
94123
- [Fable.Python GitHub](https://github.com/fable-compiler/Fable.Python/)
124+
- [BINDINGS_GUIDE.md](./BINDINGS_GUIDE.md) - Comprehensive binding patterns
95125

96126
---
97127

0 commit comments

Comments
 (0)