Skip to content

fix(python): complete Async and Task APIs - #5106

Draft
dbrattli wants to merge 3 commits into
mainfrom
feat/python-async-task-parity
Draft

dbrattli wants to merge 3 commits into
mainfrom
feat/python-async-task-parity

Conversation

@dbrattli

@dbrattli dbrattli commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Python's Async replacement accepted several F# members without corresponding runtime functions. This adds Async.Choice, Async.OnCancel, and Async.StartImmediateAsTask, plus cancellable Task.Delay and direct Async<'T> binding and return! in task { }.

Compiled Async.StartChild now uses a new start_child_linked runtime entry point: it starts its child when the outer async runs, links the child's token to the parent, and cancels the underlying child when a timeout expires. The existing Python start_child function keeps its published behavior. A timeout still leaves the parent token usable, and a child-raised timeout exception keeps its original identity.

Async.Choice converts Fable enumerables through the runtime iterator adapter, which also keeps its generated Python type correct. The Python async and task suites exercise the new members and timeout behavior through F# on .NET and generated Python.

Python counterpart to #5097.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Python Type Checking Results (Pyright)

Metric Value
Total errors 33
Files with errors 4
Excluded files 4
New errors ✅ No
Excluded files with errors (4 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_hash_set.py 18 Excluded
temp/tests/Python/test_applicative.py 11 Excluded
temp/tests/Python/test_nested_and_recursive_pattern.py 2 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 2 Excluded

@dbrattli
dbrattli marked this pull request as draft October 16, 2026 20:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant