Skip to content

Comments

feat(wip): port reference JS implementation to Python#13

Open
0-th wants to merge 22 commits intostoracha:mainfrom
0-th:dev(wip)
Open

feat(wip): port reference JS implementation to Python#13
0-th wants to merge 22 commits intostoracha:mainfrom
0-th:dev(wip)

Conversation

@0-th
Copy link

@0-th 0-th commented Oct 28, 2025

The cooperative scheduler can run cooperatively run tasks

0-th added 5 commits October 28, 2025 03:29
 These functions are necessary for the cooperative scheduler.
The cooperative scheduler (`step` function) uses only `Stack`s for now.
`Group`s functionality would be added in further changes

resolve storacha#6, resolve storacha#8
@0-th
Copy link
Author

0-th commented Oct 28, 2025

Running the tests in test/test_task.py would give the following output:

py-actress on  dev(wip) [?] is 📦 v0.0.1 via 🐍 v3.13.2 (.venv) 
❯ python test/test_task.py

======================================================================
TEST 1: Stack Class
======================================================================
Empty stack size: 0
After adding to active: 1
After adding to idle: 2
✓ Stack tests passed!

======================================================================
TEST 2: Primitives
======================================================================
Got reference: <generator object test_primitives.<locals>.task at 0x7863bf7faa80>
Active tasks: 0
Idle tasks: 1
✓ Primitives tests passed!

======================================================================
TEST 3: Multiple Tasks
======================================================================
Execution order:
  task1: start
  task2: start
  task1: middle
  task2: end
  task1: end
✓ Multiple tasks test passed!

======================================================================
TEST 4: Suspend and Resume
======================================================================
{<generator object test_suspend_resume.<locals>.task1 at 0x7863bf3eb850>}
Execution order:
  task1: before suspend
  task2: running
  task2: resuming task1
  task1: after resume
✓ Suspend/resume test passed!

======================================================================
TEST 5: Messages
======================================================================
Collected messages: ['message-1', 'message-2', 'message-3']
✓ Messages test passed!

======================================================================
ALL TESTS PASSED! Great work on Milestone 3!
======================================================================

py-actress on  dev(wip) [?] is 📦 v0.0.1 via 🐍 v3.13.2 (.venv) 
❯ 

@0-th 0-th changed the title feat(wip): add minimal working cooperative scheduler feat(wip): port reference JS implementation to Python Nov 24, 2025
@0-th 0-th mentioned this pull request Jan 20, 2026
4 tasks
@0-th 0-th mentioned this pull request Jan 21, 2026
1 task
@0-th
Copy link
Author

0-th commented Feb 9, 2026

59 tests from the reference implementation are passing, all 64 tests have been implemented except 2 type tests that were typescript specific (which I'd assume the type checker - mypy would handle in this Python implementation).

3 of the tests are currently deadlocking, potentially caused by differences in event loop behaviour in Python and JS. These 3 tests are currently commented out, and I'm currently debugging them for a fix.

@0-th 0-th marked this pull request as ready for review February 17, 2026 14:20
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