Skip to content

feat: top-level function for running awaitables in zarr's event loop - #3997

Open
d-v-b wants to merge 5 commits into
zarr-developers:mainfrom
d-v-b:feat/public-run
Open

d-v-b wants to merge 5 commits into
zarr-developers:mainfrom
d-v-b:feat/public-run

Conversation

@d-v-b

@d-v-b d-v-b commented May 22, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Adds public zarr.run, a synchronous bridge that runs a coroutine on Zarr's managed event loop by default, or on an explicitly supplied loop, and returns its result.

It translates the internal SyncError to RuntimeError when called from the target loop's thread. Unlike asyncio.run, it does not reject every running loop: a different active loop on the calling thread permits dispatch, although that thread is blocked. Async callers should normally await the async API directly.

Documentation and a regression test distinguish those cases. Audit validation: hatch run test.py3.12-minimal:pytest tests/test_sync.py -q — 27 passed; commit hooks passed. Existing timeout tests emit pending-task destruction diagnostics because this branch's sync timeout does not cancel the submitted coroutine.

@d-v-b

d-v-b commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@TomNicholas, @aladinor let me know how this looks

@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.34%. Comparing base (c0e2afa) to head (18069c3).
⚠️ Report is 178 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3997      +/-   ##
==========================================
+ Coverage   93.49%   94.34%   +0.84%     
==========================================
  Files          88       92       +4     
  Lines       11873    12940    +1067     
==========================================
+ Hits        11101    12208    +1107     
+ Misses        772      732      -40     
Files with missing lines Coverage Δ
src/zarr/__init__.py 100.00% <100.00%> (ø)
src/zarr/core/sync.py 94.44% <100.00%> (+0.10%) ⬆️

... and 63 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@d-v-b
d-v-b requested a review from jhamman May 22, 2026 13:53
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