Skip to content

Commit a5eedd7

Browse files
authored
Merge pull request #16 from cardamomcode/update-blogpost
docs: blogpost update
2 parents 3ce27a6 + 078a918 commit a5eedd7

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

‎docs/blogpost.md‎

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

3-
*Generated on 2025-12-22 14:47 UTC using Fable v5.0.0-alpha.21*
3+
*Generated on 2025-12-25 08:26 UTC using Fable v5.0.0-alpha.21*
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
@@ -838,16 +838,23 @@ class DecoratedUser:
838838
Control how class members are generated for Python frameworks like Pydantic:
839839

840840
```fsharp
841+
// BaseModel from Pydantic (import this from Fable.Python.Pydantic in
842+
// real code to get proper bindings)
843+
[<Import("BaseModel", "pydantic")>]
844+
type BaseModel() = class end
845+
841846
[<Py.ClassAttributes(Py.ClassAttributeStyle.Attributes, false)>]
842847
type PydanticModel() =
848+
inherit BaseModel()
843849
member val Name: string = "" with get, set
844850
member val Age: int = 0 with get, set
845851
```
846852

847-
This generates class-level type annotations suitable for Pydantic:
853+
This generates class-level type annotations suitable for Pydantic.
854+
See the Pydantic chapter for more on working with Pydantic models:
848855

849856
```python
850-
class PydanticModel:
857+
class PydanticModel(BaseModel):
851858
Age: int32 = int32.ZERO
852859
Name: str = ""
853860
```
@@ -3423,13 +3430,7 @@ Utility functions for naming conversion and line classification:
34233430
```fsharp
34243431
module Utils =
34253432
/// List of contributors to thank (Fable-style).
3426-
let contributors = [|
3427-
"@dbrattli"
3428-
"@alfonsogarciacaro"
3429-
"@ncave"
3430-
"@MangelMaxime"
3431-
"@claude 🤖"
3432-
|]
3433+
let contributors = [| "@dbrattli"; "@alfonsogarciacaro"; "@ncave"; "@MangelMaxime"; "@claude 🤖" |]
34333434
34343435
/// Returns a random contributor from the list.
34353436
let randomContributor () : string =
@@ -3539,7 +3540,8 @@ Parse lines into a document AST
35393540
lines
35403541
|> Seq.fold parseLine initial
35413542
|> flushState
3542-
|> _.Blocks |> List.rev
3543+
|> _.Blocks
3544+
|> List.rev
35433545
```
35443546

35453547
### Transform Module
@@ -3720,7 +3722,8 @@ We've covered a lot of ground in this guide:
37203722
- **Testing**: Running F# code with pytest and other Python test runners
37213723
- **Fable v5**: The latest features including the Rust core and PyPI packages
37223724
- **Pydantic**: Building validated data models with Python's favorite library
3723-
- **Units of Measure**: Compile-time dimensional analysis that vanishes at runtime
3725+
- **FastAPI**: Building type-safe web APIs in the Python ecosystem
3726+
- **Units of Measure**: Compile-time dimensional analysis that vanishes (erased) at runtime
37243727
- **Fable.Literate**: A self-documenting literate programming converter
37253728

37263729
### The Punchline

0 commit comments

Comments
 (0)