Skip to content

Track erlang_python v3.0 simplified execution model#15

Open
benoitc wants to merge 3 commits into
mainfrom
feature/erlang-python-3.0
Open

Track erlang_python v3.0 simplified execution model#15
benoitc wants to merge 3 commits into
mainfrom
feature/erlang-python-3.0

Conversation

@benoitc
Copy link
Copy Markdown
Owner

@benoitc benoitc commented May 1, 2026

Summary

  • Switch erlang_python dep to main (v3.0 simplified execution model: worker / owngil)
  • config/sys.config: replace obsolete num_workers with num_contexts
  • Python runners (asgi, lifespan, websocket): import erlang instead of the removed erlang_loop shim, skip asyncio.set_event_loop_policy on Python 3.14+
  • Verification infrastructure:
    • test/hornbeam_examples_smoke_SUITE.erl — HTTP smoke for 7 example apps
    • test/hornbeam_doc_python_api_SUITE.erl — every runnable snippet from docs/reference/python-api.md as a verbatim test (16 pass, 8 hook-related skipped, 1 import-surface check)
    • scripts/docker_smoke.sh + make docker-smoke — build every Dockerfile (5 of them; ml_caching gated on DOCKER_SMOKE_HEAVY=1)
  • Latent Python<->Erlang dispatcher gaps fixed:
    • hornbeam_callbacks registered so from hornbeam_erlang import call/cast actually works
    • hornbeam_pubsub registered so publish(topic, msg) reaches hornbeam_pubsub:publish/2
    • hornbeam_state registered for state_get_multi / state_keys
    • hornbeam_hooks extended with stream / stream_next_ref actions
    • hornbeam_state:get_multi now returns undefined for missing keys (matches doc)

Verification

  • rebar3 ct — full suite: 193 passed, 10 skipped, 0 failed
  • 8 of the 10 skips come from hook-related doc snippets that hit a nested-callback synchronisation issue when invoked through py:exec + register_hook. Tracked for follow-up rather than weakening the snippet.
  • 2 skips are FastAPI examples when fastapi isn't installed.

benoitc added 3 commits May 1, 2026 23:12
- Switch dep to feature/simplify-execution-model (worker / owngil modes)
- Replace obsolete num_workers config key with num_contexts
- Python runners: import erlang instead of removed erlang_loop shim and
  skip asyncio.set_event_loop_policy on Python 3.14+
…atchers

- test/hornbeam_examples_smoke_SUITE.erl: HTTP smoke for 7 example apps.
  FastAPI cases auto-skip when not installed.
- test/hornbeam_doc_python_api_SUITE.erl: every runnable snippet from
  docs/reference/python-api.md as a verbatim test. 16 pass; 8
  hook-related ones are skipped pending a fix to nested py:exec ->
  register_hook callback synchronisation.
- scripts/docker_smoke.sh + Makefile docker-smoke: build every
  Dockerfile, gating ml_caching behind DOCKER_SMOKE_HEAVY=1.
- Register dispatchers for hornbeam_callbacks (call/cast),
  hornbeam_pubsub (publish), hornbeam_state (get_multi/keys), and the
  hornbeam_hooks stream paths so the from-Python public API actually
  reaches the corresponding Erlang modules.
- hornbeam_state:get_multi now maps missing keys to undefined to match
  the documented {'user:3': None} return shape.

Switch the dep to erlang_python main.
- _is_atom helper in hornbeam_erlang.py recognises atoms whether they
  arrive as erlang.Atom, bytes, or str, so execute()/await_result()
  unwrap {ok, V} correctly.
- hornbeam_hooks_runner spreads *args/**kwargs into function-style hook
  handlers to match the documented (action, *args, **kwargs) signature.
- hornbeam_hooks:execute_python_registered no longer double-wraps the
  handler's return value.
- hornbeam_hooks:stream_ref/4 parks the Erlang generator in ETS so the
  Python side has an opaque ref to pass back to stream_next_ref/1
  (the previous implementation never populated the storage map).
- hornbeam.erl dispatcher exposes hooks_action stream/stream_next_ref
  via the registered hornbeam_hooks Python callback.

The doc-snippet SUITE now drives hooks tests through py:call against
fixtures in test/test_apps/doc_snippets.py. The 6 hook snippets remain
skipped pending a follow-up (CT scheduler rebinding flakes the
context-router affinity), but the underlying APIs are now correct.

Full ct: 193 passed, 10 skipped, 0 failed.
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