Skip to content

Commit ef45229

Browse files
dbrattliclaude
andcommitted
chore: upgrade to Fable 5.0.0 stable
Bump Fable CLI to 5.0.0, Fable.Core to 5.0.0, Fable.Python to 5.1.0, and fable-library (PyPI) to 5.0.0. Update version references in GettingStarted, FableV5, and Testing chapter sources, and remove prerelease-pinning language now that stable releases exist. Also fix the Interop chapter's json example (issue #17) by adding actual json.dumps and json.loads calls with the resulting output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d2a6af5 commit ef45229

12 files changed

Lines changed: 138 additions & 158 deletions

File tree

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"fable": {
6-
"version": "5.0.0-rc.2",
6+
"version": "5.0.0",
77
"commands": [
88
"fable"
99
],

Fable.Literate.Tests/Fable.Literate.Tests.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<PackageReference Include="Fable.Pyxpecto" Version="2.0.0" />
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
1515
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.14.3" />
16-
<PackageReference Include="Fable.Core" Version="5.0.0-beta.4" />
17-
<PackageReference Include="Fable.Python" Version="5.0.0-alpha.21.5" />
16+
<PackageReference Include="Fable.Core" Version="5.0.0" />
17+
<PackageReference Include="Fable.Python" Version="5.1.0" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

Fable.Literate/Fable.Literate.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Fable.Core" Version="5.0.0-beta.4" />
11-
<PackageReference Include="Fable.Python" Version="5.0.0-alpha.21.5" />
10+
<PackageReference Include="Fable.Core" Version="5.0.0" />
11+
<PackageReference Include="Fable.Python" Version="5.1.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

Fable.Literate/Python.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ let isMultilineDefinition (line: string) : bool =
8989
/// Extracts the body of a multiline definition.
9090
let extractMultilineBody (startIndex: int) (defIndex: int) (lines: string array) : string =
9191
let shouldStop idx (line: string) =
92-
idx > defIndex && (isTopLevelDefinition line || isDunderMethod line)
92+
idx > defIndex
93+
&& (isTopLevelDefinition line || isDunderMethod line)
9394

9495
// Start from decorator or definition line
9596
lines[startIndex..]

chapters/FableV5.fs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,16 @@ pip install fable-library
6363
uv add fable-library
6464
```
6565
66-
For projects, pin your dependencies in `pyproject.toml`. For stable releases use
67-
a minimum version constraint:
66+
For projects, pin your dependencies in `pyproject.toml`:
6867
6968
```toml
7069
dependencies = ["fable-library>=5.0.0"]
7170
```
7271
73-
For pre-release versions, pin the exact version to avoid surprises:
72+
To pin an exact version, use:
7473
7574
```toml
76-
dependencies = ["fable-library==5.0.0rc2"]
75+
dependencies = ["fable-library==5.0.0"]
7776
```
7877
7978
This makes dependency management much simpler and follows Python conventions.
@@ -96,13 +95,13 @@ To use Fable v5, install the CLI:
9695
9796
```bash
9897
# Install Fable 5 CLI
99-
dotnet tool install fable --version 5.0.0-rc.2
98+
dotnet tool install fable --version 5.0.0
10099
101100
# Add Fable.Core to your project
102-
dotnet add package Fable.Core --version 5.0.0-rc.1
101+
dotnet add package Fable.Core --version 5.0.0
103102
104103
# Install the Python runtime
105-
uv add fable-library==5.0.0rc2
104+
uv add fable-library==5.0.0
106105
```
107106
108107
Then compile your F# to Python:

chapters/GettingStarted.fs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ dotnet new console -lang F#
4141
4242
# Set up local tools and install Fable 5
4343
dotnet new tool-manifest
44-
dotnet tool install fable --version 5.0.0-rc.2
44+
dotnet tool install fable --version 5.0.0
4545
4646
# Add Fable.Core package
47-
dotnet add package Fable.Core --version 5.0.0-rc.1
47+
dotnet add package Fable.Core --version 5.0.0
4848
```
4949
5050
## Install Python Dependencies
@@ -53,17 +53,16 @@ Fable-generated Python code requires the `fable-library` runtime:
5353
5454
```bash
5555
# Using uv (recommended)
56-
uv add "fable-library==5.0.0rc2"
56+
uv add "fable-library==5.0.0"
5757
5858
# Or with pip
59-
pip install "fable-library==5.0.0rc2"
59+
pip install "fable-library==5.0.0"
6060
```
6161
6262
---
6363
6464
**Note:** Version pinning matters. The fable-library version must match your Fable
65-
compiler version. Note that PyPI uses `5.0.0rc2` format instead of `5.0.0-rc.2` for
66-
prerelease release candidate versions.
65+
compiler version.
6766
6867
---
6968

chapters/Interop.fs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ For basic JSON operations, use Python's built-in `json` module:
3737

3838
open Fable.Python.Json
3939

40-
// Serialize F# data to JSON string
40+
// Serialize F# data to a JSON string
4141
let data = {|
4242
name = "Alice"
4343
age = 30
4444
|}
4545

46+
let encoded = json.dumps data
47+
// '{"name": "Alice", "age": 30}'
48+
49+
// Parse a JSON string back to a Python dict
50+
let decoded = json.loads """{"city": "Oslo", "temp": -5}"""
51+
4652
(**
4753
Anonymous records (`{| ... |}`) are perfect for JSON - they compile to
48-
Python dictionaries. See the Compatibility chapter for details on how F#
54+
Python dictionaries, so `json.dumps` and `json.loads` work directly without
55+
any conversion layer. See the Compatibility chapter for details on how F#
4956
types map to Python types.
5057
5158
## Calling Python Functions

chapters/Testing.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ project setup:
222222
<ItemGroup>
223223
<PackageReference Include="Expecto" Version="10.2.1" />
224224
<PackageReference Include="Fable.Pyxpecto" Version="2.0.0" />
225-
<PackageReference Include="Fable.Core" Version="5.0.0-rc.1" />
226-
<PackageReference Include="Fable.Python" Version="5.0.0-rc.2" />
225+
<PackageReference Include="Fable.Core" Version="5.0.0" />
226+
<PackageReference Include="Fable.Python" Version="5.1.0" />
227227
</ItemGroup>
228228
229229
<ItemGroup>

docs/blogpost.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Introduction to Fable.Python
22

3-
*Generated on 2026-03-08 17:54 UTC using Fable v5.0.0-rc.2*
3+
*Generated on 2026-05-14 16:03 UTC using Fable v5.0.0*
44

55
> This post is part of the [F# Advent Calendar
66
2025](https://sergeytihon.com/2025/11/03/f-advent-calendar-in-english-2025/). Thank you, Sergey Tihon, for organizing
@@ -399,10 +399,10 @@ dotnet new console -lang F#
399399

400400
# Set up local tools and install Fable 5
401401
dotnet new tool-manifest
402-
dotnet tool install fable --version 5.0.0-rc.2
402+
dotnet tool install fable --version 5.0.0
403403

404404
# Add Fable.Core package
405-
dotnet add package Fable.Core --version 5.0.0-rc.1
405+
dotnet add package Fable.Core --version 5.0.0
406406
```
407407

408408
### Install Python Dependencies
@@ -411,17 +411,16 @@ Fable-generated Python code requires the `fable-library` runtime:
411411

412412
```bash
413413
# Using uv (recommended)
414-
uv add "fable-library==5.0.0rc2"
414+
uv add "fable-library==5.0.0"
415415

416416
# Or with pip
417-
pip install "fable-library==5.0.0rc2"
417+
pip install "fable-library==5.0.0"
418418
```
419419

420420
---
421421

422422
**Note:** Version pinning matters. The fable-library version must match your Fable
423-
compiler version. Note that PyPI uses `5.0.0rc2` format instead of `5.0.0-rc.2` for
424-
prerelease release candidate versions.
423+
compiler version.
425424

426425
---
427426

@@ -529,15 +528,22 @@ For basic JSON operations, use Python's built-in `json` module:
529528
```fsharp
530529
open Fable.Python.Json
531530
532-
// Serialize F# data to JSON string
531+
// Serialize F# data to a JSON string
533532
let data = {|
534533
name = "Alice"
535534
age = 30
536535
|}
536+
537+
let encoded = json.dumps data
538+
// '{"name": "Alice", "age": 30}'
539+
540+
// Parse a JSON string back to a Python dict
541+
let decoded = json.loads """{"city": "Oslo", "temp": -5}"""
537542
```
538543

539544
Anonymous records (`{| ... |}`) are perfect for JSON - they compile to
540-
Python dictionaries. See the Compatibility chapter for details on how F#
545+
Python dictionaries, so `json.dumps` and `json.loads` work directly without
546+
any conversion layer. See the Compatibility chapter for details on how F#
541547
types map to Python types.
542548

543549
### Calling Python Functions
@@ -2325,8 +2331,8 @@ project setup:
23252331
<ItemGroup>
23262332
<PackageReference Include="Expecto" Version="10.2.1" />
23272333
<PackageReference Include="Fable.Pyxpecto" Version="2.0.0" />
2328-
<PackageReference Include="Fable.Core" Version="5.0.0-rc.1" />
2329-
<PackageReference Include="Fable.Python" Version="5.0.0-rc.2" />
2334+
<PackageReference Include="Fable.Core" Version="5.0.0" />
2335+
<PackageReference Include="Fable.Python" Version="5.1.0" />
23302336
</ItemGroup>
23312337

23322338
<ItemGroup>
@@ -2458,17 +2464,16 @@ pip install fable-library
24582464
uv add fable-library
24592465
```
24602466

2461-
For projects, pin your dependencies in `pyproject.toml`. For stable releases use
2462-
a minimum version constraint:
2467+
For projects, pin your dependencies in `pyproject.toml`:
24632468

24642469
```toml
24652470
dependencies = ["fable-library>=5.0.0"]
24662471
```
24672472

2468-
For pre-release versions, pin the exact version to avoid surprises:
2473+
To pin an exact version, use:
24692474

24702475
```toml
2471-
dependencies = ["fable-library==5.0.0rc2"]
2476+
dependencies = ["fable-library==5.0.0"]
24722477
```
24732478

24742479
This makes dependency management much simpler and follows Python conventions.
@@ -2491,13 +2496,13 @@ To use Fable v5, install the CLI:
24912496

24922497
```bash
24932498
# Install Fable 5 CLI
2494-
dotnet tool install fable --version 5.0.0-rc.2
2499+
dotnet tool install fable --version 5.0.0
24952500

24962501
# Add Fable.Core to your project
2497-
dotnet add package Fable.Core --version 5.0.0-rc.1
2502+
dotnet add package Fable.Core --version 5.0.0
24982503

24992504
# Install the Python runtime
2500-
uv add fable-library==5.0.0rc2
2505+
uv add fable-library==5.0.0
25012506
```
25022507

25032508
Then compile your F# to Python:
@@ -3708,7 +3713,7 @@ For example, the extractSymbol function in F# generates this Python:
37083713
def extract_symbol(symbol: str, lines: Array[str]) -> str | None:
37093714
"""Extracts a single symbol definition from Python source lines."""
37103715

3711-
def mapping(def_index: int32, symbol: Any = symbol, lines: Any = lines) -> str:
3716+
def mapping(def_index: int32, lines: Any = lines) -> str:
37123717
start_index: int32 = find_decorator_start(lines, def_index)
37133718
if is_multiline_definition(lines[def_index]):
37143719
return extract_multiline_body(start_index, def_index, lines)

fable-python.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Fable.Core" Version="5.0.0-beta.4" />
10-
<PackageReference Include="Fable.Python" Version="5.0.0-alpha.21.5" />
9+
<PackageReference Include="Fable.Core" Version="5.0.0" />
10+
<PackageReference Include="Fable.Python" Version="5.1.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

0 commit comments

Comments
 (0)