Skip to content

Commit d7973ef

Browse files
dbrattligithub-actions[bot]
authored andcommitted
docs: generate blogpost file 50
1 parent 7466b5e commit d7973ef

1 file changed

Lines changed: 30 additions & 32 deletions

File tree

docs/blogpost.md

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

3-
*Generated on 2025-12-25 11:07 UTC using Fable v5.0.0-alpha.21*
3+
*Generated on 2026-03-08 17:54 UTC using Fable v5.0.0-rc.2*
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
@@ -397,12 +397,12 @@ cd my-fable-python
397397
# Create F# console app
398398
dotnet new console -lang F#
399399

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

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

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

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

416416
# Or with pip
417-
pip install "fable-library==5.0.0a21"
417+
pip install "fable-library==5.0.0rc2"
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.0a21` format instead of `5.0.0-alpha.21` for
424-
prerelease alpha releases.
423+
compiler version. Note that PyPI uses `5.0.0rc2` format instead of `5.0.0-rc.2` for
424+
prerelease release candidate versions.
425425

426426
---
427427

@@ -1788,10 +1788,8 @@ This generates:
17881788
async def process_item_task(item: str) -> str:
17891789
builder_0040: Any = task()
17901790

1791-
def _arrow43(
1792-
__unit: None = None, item: Any = item
1793-
) -> Callable[[FSharpRef[Any]], bool]:
1794-
def _arrow42(__unit: None = None) -> Callable[[FSharpRef[Any]], bool]:
1791+
def _arrow43(item: Any = item) -> Callable[[FSharpRef[Any]], bool]:
1792+
def _arrow42(__unit: Unit = UNIT) -> Callable[[FSharpRef[Any]], bool]:
17951793
return builder_0040.Return(item.upper())
17961794

17971795
return builder_0040.Bind(delay(int32(100)), _arrow42)
@@ -1870,9 +1868,9 @@ let simpleAsync () =
18701868
In Python, this generates:
18711869

18721870
```python
1873-
def simple_async(__unit: None = None) -> Async[int32]:
1874-
def _arrow52(__unit: None = None) -> Async[int32]:
1875-
def _arrow51(__unit: None = None) -> Async[int32]:
1871+
def simple_async(__unit: Unit = UNIT) -> Async[int32]:
1872+
def _arrow52(__unit: Unit = UNIT) -> Async[int32]:
1873+
def _arrow51(__unit: Unit = UNIT) -> Async[int32]:
18761874
return singleton.Return(int32(42))
18771875

18781876
return singleton.Bind(sleep(int32(500)), _arrow51)
@@ -1895,11 +1893,11 @@ let simpleTask () =
18951893
In Python, this generates:
18961894

18971895
```python
1898-
async def simple_task(__unit: None = None) -> int32:
1896+
async def simple_task(__unit: Unit = UNIT) -> int32:
18991897
builder_0040: Any = task()
19001898

1901-
def _arrow54(__unit: None = None) -> Callable[[FSharpRef[Any]], bool]:
1902-
def _arrow53(__unit: None = None) -> Callable[[FSharpRef[Any]], bool]:
1899+
def _arrow54(__unit: Unit = UNIT) -> Callable[[FSharpRef[Any]], bool]:
1900+
def _arrow53(__unit: Unit = UNIT) -> Callable[[FSharpRef[Any]], bool]:
19031901
return builder_0040.Return(int32(42))
19041902

19051903
return builder_0040.Bind(delay(int32(500)), _arrow53)
@@ -2327,8 +2325,8 @@ project setup:
23272325
<ItemGroup>
23282326
<PackageReference Include="Expecto" Version="10.2.1" />
23292327
<PackageReference Include="Fable.Pyxpecto" Version="2.0.0" />
2330-
<PackageReference Include="Fable.Core" Version="5.0.0-beta.4" />
2331-
<PackageReference Include="Fable.Python" Version="5.0.0-alpha.21" />
2328+
<PackageReference Include="Fable.Core" Version="5.0.0-rc.1" />
2329+
<PackageReference Include="Fable.Python" Version="5.0.0-rc.2" />
23322330
</ItemGroup>
23332331

23342332
<ItemGroup>
@@ -2467,10 +2465,10 @@ a minimum version constraint:
24672465
dependencies = ["fable-library>=5.0.0"]
24682466
```
24692467

2470-
For alpha/beta releases, pin the exact version to avoid surprises:
2468+
For pre-release versions, pin the exact version to avoid surprises:
24712469

24722470
```toml
2473-
dependencies = ["fable-library==5.0.0a21"]
2471+
dependencies = ["fable-library==5.0.0rc2"]
24742472
```
24752473

24762474
This makes dependency management much simpler and follows Python conventions.
@@ -2489,17 +2487,17 @@ That's **319 new tests** ensuring reliability across the board.
24892487

24902488
### Getting Started with Fable v5
24912489

2492-
To use Fable v5, install the alpha CLI:
2490+
To use Fable v5, install the CLI:
24932491

24942492
```bash
24952493
# Install Fable 5 CLI
2496-
dotnet tool install fable --version 5.0.0-alpha.21
2494+
dotnet tool install fable --version 5.0.0-rc.2
24972495

24982496
# Add Fable.Core to your project
2499-
dotnet add package Fable.Core --version 5.0.0-beta.4
2497+
dotnet add package Fable.Core --version 5.0.0-rc.1
25002498

25012499
# Install the Python runtime
2502-
uv add fable-library==5.0.0a21
2500+
uv add fable-library==5.0.0rc2
25032501
```
25042502

25052503
Then compile your F# to Python:
@@ -2970,19 +2968,19 @@ This generates Python with proper FastAPI decorators:
29702968
class API:
29712969
@app.get("/items")
29722970
@staticmethod
2973-
def get_items(__unit: None = None) -> list[Item]:
2971+
def get_items(__unit: Unit = UNIT) -> list[Item]:
29742972
return items
29752973

29762974
@app.get("/items/{item_id}")
29772975
@staticmethod
29782976
async def get_item(item_id: int32) -> Any:
29792977
builder_0040: Any = task()
29802978

2981-
def _arrow97(__unit: None = None) -> Callable[[FSharpRef[Any]], bool]:
2979+
def _arrow97(__unit: Unit = UNIT) -> Callable[[FSharpRef[Any]], bool]:
29822980
def predicate(i: Item) -> bool:
29832981
return i.Id == item_id
29842982

2985-
match_value: Item | None = try_find(predicate, to_enumerable(items))
2983+
match_value: Item | None = erase(try_find(predicate, to_enumerable(items)))
29862984
if match_value is None:
29872985
return builder_0040.Return({"error": "Item not found"})
29882986

@@ -2997,7 +2995,7 @@ class API:
29972995
async def create_item(request: CreateItemRequest) -> Any:
29982996
builder_0040: Any = task()
29992997

3000-
def _arrow99(__unit: None = None) -> Callable[[FSharpRef[Any]], bool]:
2998+
def _arrow99(__unit: Unit = UNIT) -> Callable[[FSharpRef[Any]], bool]:
30012999
def mapping(i: Item) -> int32:
30023000
return i.Id
30033001

@@ -3007,7 +3005,7 @@ class API:
30073005

30083006
new_item: Item = Item(
30093007
Id=int32.ONE
3010-
if (len(items) == int32.ZERO)
3008+
if (int32(len(items)) == int32.ZERO)
30113009
else (
30123010
max(map(mapping, to_enumerable(items)), ObjectExpr98()) + int32.ONE
30133011
),
@@ -3718,7 +3716,7 @@ def extract_symbol(symbol: str, lines: Array[str]) -> str | None:
37183716
else:
37193717
return lines[def_index]
37203718

3721-
return map(mapping, find_definition_index(symbol, lines))
3719+
return erase(map(mapping, find_definition_index(symbol, lines)))
37223720
```
37233721

37243722
### Main Entry Point

0 commit comments

Comments
 (0)