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
3 changes: 3 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@ jobs:
- name: Build
run: just build

- name: Pyright type check
run: just pyright

- name: Test
run: just test
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ test-python: build
{{fable}} {{test_path}} --lang Python --outDir {{build_path}}/tests
uv run pytest {{build_path}}/tests

# Type-check the generated Python bindings with pyright (see issue #278)
pyright: build
uv run pyright

# Create NuGet package with version from CHANGELOG.md
pack:
#!/usr/bin/env bash
Expand Down
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ readme = "README.md"
license = "MIT"
dependencies = [
"fable-library==5.0.0",
"pyright>=1.1.409",
]

[project.urls]
Expand Down Expand Up @@ -67,10 +68,16 @@ indent-style = "space"
line-ending = "auto"

[tool.pyright]
# Type-check the Fable-generated Python bindings in build/stdlib so the shipped
# output stays clean for downstream pyright users (see issue #278).
include = ["build/stdlib"]
reportMissingTypeStubs = false
reportMissingImports = false
reportUnnecessaryTypeIgnoreComment = true
reportUnusedImport = true
# Disabled: Fable emits unused `UNIT` imports and single-occurrence TypeVars
# from F# generics. Those are codegen artifacts, not bindings bugs.
reportUnusedImport = false
reportInvalidTypeVarUse = false
reportUnusedVariable = true
reportUnnecessaryIsInstance = true
reportUnnecessaryComparison = true
Expand All @@ -83,4 +90,4 @@ reportOverlappingOverload = true
reportInconsistentConstructor = true
reportImplicitStringConcatenation = true
pythonVersion = "3.12"
typeCheckingMode = "basic"
typeCheckingMode = "standard"
4 changes: 2 additions & 2 deletions src/stdlib/Json.fs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ let private slotsToDict (o: obj) : obj = nativeOnly
let private unionToList (o: obj) (caseName: string) : obj = nativeOnly

[<Emit("getattr(type($0), 'cases', lambda: [])()")>]
let private getCases (o: obj) : string array = nativeOnly
let private getCases (o: obj) : ResizeArray<string> = nativeOnly

[<Emit("(_ for _ in ()).throw(TypeError(f'Object of type {type($0).__name__} is not JSON serializable'))")>]
let private raiseTypeError (o: obj) : obj = nativeOnly
Expand Down Expand Up @@ -136,7 +136,7 @@ let fableDefault (o: obj) : obj =
let tag: int = getattr o "tag" :?> int

let caseName =
if tag < cases.Length then
if tag < cases.Count then
cases.[tag]
else
"Case" + string tag
Expand Down
28 changes: 27 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading