Skip to content

Commit 9d1e778

Browse files
committed
docs: improve python section
1 parent dd4e42a commit 9d1e778

1 file changed

Lines changed: 25 additions & 39 deletions

File tree

docs/blog/2026/2026-02-27-Fable_5_release_candidate.md

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -158,56 +158,42 @@ If you have been following the Fable 5 alpha releases, you know the Python targe
158158

159159
This is all thanks to Dag and early adopters who have been testing it.
160160

161-
### Interop has been improved
161+
* **Python 3.12-3.14 support** (3.10/3.11 are deprecated)
162+
* **fable-library via PyPI** - No more bundled runtime files
163+
* **Modern type parameter syntax** - Better type hinting in generated code
164+
* **`Py.Decorate` attribute** - Add Python decorators from F#
165+
* **`Py.ClassAttributes` attribute** - Fine-grained class generation control
166+
* **Improved Pydantic interop** - First-class support for data validation
162167

163-
Python interop has been improved to support more features of Python, such as decorators, classes, etc.
168+
### Rust Core with PyO3
164169

165-
#### Decorators
170+
One of the biggest changes is that the core of fable-library is now written in Rust using PyO3.
171+
The motivation is **correctness**, not performance:
166172

167-
```fs
168-
open Fable.Core
169-
170-
[<Py.Decorator("dataclasses.dataclass")>]
171-
type User =
172-
{
173-
Name: string
174-
Age: int
175-
}
176-
```
173+
**Why Rust?**
177174

178-
generates
179-
180-
```python
181-
@dataclasses.dataclass
182-
class User:
183-
name: str
184-
age: int32
185-
```
175+
* **Correct .NET semantics** - Sized/signed integers (int8, int16, int32, int64, uint8, etc.)
176+
* **Proper overflow behavior** - Matches .NET exactly
177+
* **Fixed-size arrays** - No more Python list quirks for byte streams
178+
* **Reliable numerics** - Fable 4's pure Python numerics were a constant source of bugs
186179

187-
#### Classes
180+
### fable-library via PyPI
188181

189-
```fs
190-
open Fable.Core
182+
Before Fable v5, the runtime was bundled in the NuGet package and copied to your output directory.
191183

192-
[<Py.ClassAttributes(Py.ClassAttributeStyle.Attributes)>]
193-
type Config() =
194-
member val Name = "default" with get, set
195-
member val Port = 8080 with get, set
196-
```
184+
Now it's a simple pip/uv dependency:
197185

198-
generates
186+
```bash
187+
# Install with pip
188+
pip install fable-library
199189

200-
```python
201-
class Config:
202-
name: str = "default"
203-
port: int = 8080
190+
# Or with uv (recommended)
191+
uv add fable-library
204192
```
205193

206-
You can learn more about Python interop in the [Python target documentation](https://fable.io/docs/python/features.html).
207-
208-
#### Native task
209-
210-
You can use `task { }` computation to write asynchronous code that compiles to native Python `async def` functions.
194+
:::info
195+
You can learn more about Fable.Python in general on our [documentation](https://fable.io/docs/python/build-and-run.html) or this [blog post](https://cardamomcode.dev/fable-python#heading-introduction-to-fablepython)
196+
:::
211197

212198
## Rust
213199

0 commit comments

Comments
 (0)