Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/workflows/*.lock.yml linguist-generated=true merge=ours
19 changes: 19 additions & 0 deletions .github/aw/actions-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"entries": {
"actions/github-script@v8": {
"repo": "actions/github-script",
"version": "v8",
"sha": "ed597411d8f924073f98dfc5c65a23a2325f34cd"
},
"actions/github-script@v9": {
"repo": "actions/github-script",
"version": "v9",
"sha": "373c709c69115d41ff229c7e5df9f8788daa9553"
},
"github/gh-aw-actions/setup@v0.68.3": {
"repo": "github/gh-aw-actions/setup",
"version": "v0.68.3",
"sha": "ba90f2186d7ad780ec640f364005fa24e797b360"
}
}
}
1,679 changes: 1,679 additions & 0 deletions .github/workflows/repo-assist.lock.yml

Large diffs are not rendered by default.

424 changes: 424 additions & 0 deletions .github/workflows/repo-assist.md

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Fable.Python

F# to Python compiler extension for Fable.

## Project Structure

- `src/stdlib/` - Python standard library bindings (Builtins, Json, Os, etc.)
- `src/flask/` - Flask web framework bindings
- `src/fastapi/` - FastAPI web framework bindings
- `src/pydantic/` - Pydantic model bindings
- `test/` - Test files
- `examples/` - Example applications (flask, fastapi, django, timeflies)
- `build/` - Generated Python output (gitignored)

## Build Commands

```bash
just clean # Clean all build artifacts (build/, obj/, bin/, .fable/)
just build # Build the project
just test-python # Run Python tests
just restore # Restore .NET and paket dependencies
just example-flask # Build and run Flask example
just example-fastapi # Build and run FastAPI example
just dev-fastapi # Run FastAPI with hot-reload
```

## Build Output

Generated Python code goes to `build/` directories (gitignored):
- `build/` - Main library output
- `build/tests/` - Test output
- `examples/*/build/` - Example outputs

## Key Concepts

### Fable Type Serialization

F# types compile to non-native Python types:

- `int` → `Int32` (not Python's `int`)
- `int64` → `Int64`
- F# array → `FSharpArray` (not Python's `list`)
- `ResizeArray<T>` → Python `list`
- `nativeint` → Python `int`

Use `Fable.Python.Json.dumps` with `fableDefault` for JSON serialization of Fable types.
Use `ResizeArray<T>` for collections in web API responses.
Use Pydantic `BaseModel` for FastAPI request/response types (handles `Int32` correctly).

See `JSON.md` for detailed serialization documentation.

### Decorator Attributes

Route decorators use `Py.DecorateTemplate`:

```fsharp
[<Erase; Py.DecorateTemplate("""app.get("{0}")""")>]
type GetAttribute(path: string) = inherit Attribute()
```

Class attributes use `Py.ClassAttributesTemplate` for Pydantic-style classes.

## Releasing

When asked to create a release, read `RELEASING.md` for the release process.
Use `Release-As: X.Y.Z-alpha.N.P` in commit messages or PR descriptions to set the version.
Loading
Loading