Repository navigation
pycvc.ari: a Python program's Host is pycvc's, so arix needs no pycvc_gl - #1216
Merged
Merged
Conversation
A Python program run in place of the document (arix run app.py) adopts the host with Host(), which lived in pycvc_gl.ariadne (#985). Under arix the Host never draws: with no GL it drives the host's own runtime through core pycvc (pycvc.ari_app_attach), as a headless Host drives pycvc.AriApp. But the import ran pycvc_gl's __init__, which loads the native _pycvc_gl (cvcGL and VTK). So the arix recipe told programs to install pycvc-gl-cp312 beside it, and ctest arix_python_program failed in any tree built without pycvc_gl. The module moves to core pycvc as pycvc.ari (bindings/pycvc/pymod/ari.py). It is installed beside pycvc.py as _pycvc_ari.py, the way pycvc.ariadne is. pycvc.ariadne stays arisrvx's server Host. - pycvc imports it as pycvc.ari. pycvc-cp312's `_pycvc*` files already cover it. - A window or offscreen Host, host.lab, and an embedded Host in ariglx import pycvc_gl when they need it. If it is missing, the ImportError says to install pycvc-gl-cp312 or use mode="headless". - pycvc_gl.ariadne is the same module, not a copy. Importing it puts pycvc.ari in its place, so `pycvc_gl.ariadne is pycvc.ari`, and existing imports get the same Host, current_host() and export. - The browser's python312.zip and the pycvc-gl wasm host (link-host.sh) ship _pycvc_ari.py beside pycvc.py, since pycvc_gl.ariadne needs it. - The arix test program, the examples, ari's and ariglx's help, the recipes and ARIADNE.md 9.3 and 9.6 name pycvc.ari. The logger is pycvc.ari. Tests: - pycvc_ariadne runs a document under a headless pycvc.ari.Host and checks pycvc_gl is never imported. - pycvc_gl_ariadne_host checks the alias. - arix_python_program passes with CVC_BUILD_PYCVC_GL=OFF.
transfix
enabled auto-merge (squash)
November 13, 2026 05:15
#1198 edited bindings/pycvc/pymod_gl/ariadne.py, which this branch moves to bindings/pycvc/pymod/ari.py (pycvc.ari), leaving an alias behind. The alias stays as it was, and #1198's two hunks move to ari.py: - _arihost() never adopts arisrvx's host (mode "server"). - display(obj, **kwargs) imports pycvc_gl.ariadne_display by its full name, because a relative import does not resolve from pycvc.ari. pycvc_gl.ariadne.display is the same function, through the alias.
#1200 (ariglx-web's threaded build) rewrote the end of the ariglx-web recipe's description, on the line where this branch renames the Host a program adopts. The description keeps #1200's wasm and wasm-mt sentence and says pycvc.ari.Host(). The wasm-mt build packs python312.zip the same way the wasm build does (cvc_ariadne_python_wasm_host), so it ships _pycvc_ari.py too.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
The two conflicts were include lines. ariadne.cpp keeps this branch's requires.h and stream_intrinsics.h and adds #1180's rich_text.h. ariadne_runtime_test.cpp keeps stream/stream.h and adds rich_text.h. #1180's rich text reads its runs and fires on_link through the Runtime's existing reactive evaluation and handler queue, so it follows this branch's group routing as it is; its last-good runs are a per-Runtime map.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
- pycvc.ari (#1216): the Python Host moved there from pycvc_gl.ariadne, so set_plot and its plot helper move with it. pycvc_gl.ariadne is master's alias. - src/cvc/CMakeLists.txt: master's list (rich_text.cpp, #1180) plus chart_emit.cpp. - ariadne_ftxui_test: master's rich-text tests and the chart golden, both kept.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
Conflicts, all master's #1216 and #1177 against this branch's embedded Python: - python_engine.cpp: _arihost stays made at boot by install_arihost (no inittab entry); its docstring takes #1216's name for the host, pycvc.ari.Host(). - ARIADNE_SCRIPTING_HOSTS.md: the same, in the roadmap's words. - arigl/main.cpp: the conference camera keeps this branch's kWalkKeys comment and gains master's setMouseLookOrbits(true). Nothing master added calls what this branch removed (g_python, g_wasm, lent(), script_engine(), the inittab module, the CUDA manager's instance(), the load bench's globals). Checked on Windows (MSVC Release): full build; ratchet ok against #1217's allowlist (22 lines) and master's (59), 13 here; the scan's own tests; format clean; the host, Python and multi-app ctests, 24 pass and 18 skip (FTXUI and matplotlib, absent here), pycvc_ari and pycvc_ariadne_harness among the passes.
This was referenced Nov 14, 2026
transfix
added a commit
that referenced
this pull request
Nov 15, 2026
…ion mid-request loses none (#1243) On Windows, `pycvc_ariadne_server` (`bindings/pycvc/test_pycvc_ariadne_server.py`) hung until its timeout on every run from #1168 on. Each run printed `Task was destroyed but it is pending!` for its `client()` task. Windows, Winsock, asyncio's proactor and the GIL had nothing to do with it. The garbage collector freed a task that the test never kept. ## Cause The test started its HTTP client with a bare `host.loop.create_task(client())` and kept no reference to the task. - asyncio's loop holds tasks only weakly. - A client of `asyncio.open_connection` waits on its `StreamReader`, and its protocol holds that reader only weakly too. So while `client()` waits on `await reader.read()`, the only references to the task are a cycle of its own: ``` task -> coroutine frame -> reader -> reader._waiter (future) -> callback task.__wakeup -> task ``` The first full (generation-2) collection that runs during that wait frees the task. `host.stop(7)` never runs, and `host.run()` waits forever. Whether a full collection lands in that wait depends on how many objects were allocated before it. That is why the hang moved with unrelated changes. | Run | Live objects after `import pycvc` | Full collections during the run | Result | |---|---|---|---| | a286873 build | 30,664 | 1, 31 ms into the client's wait (collected 11, the task among them) | hangs | | 8857fe8 build (#1168's parent) | 30,264 | none before the test ends (`gens run: [95, 8, 0]`) | passes, 2/2 | | a286873, unchanged test, N extra live objects allocated before `import pycvc` | | | N ≤ 1000 hangs; N ≥ 1500 passes | | a286873, `gc.disable()` at the top | | | passes | | a286873, the task kept in a variable | | | passes | The other clues from the report fit the same way. `runpy.run_path`, and a sitecustomize without the `importlib` imports, each allocate a different number of objects before the test runs. ## Bisect - 62d1ff0 + #1216 (37c5ca9): passes. - 8857fe8 (master just before #1168): passes, 2/2. - a286873 (#1168): hangs, 2/2. The test file is the same in both. **#1168 is the commit that turns it on, but it is not the bug.** Its input-trace wrappers (`pycvc_trace.i`) leave about 400 more objects at `import pycvc`, and that moves the run's first full collection into the client's wait. The bug was there before #1168: - A `gc.collect()` while `client()` waits hangs the 8857fe8 build the same way. - A minimal asyncio program with no pycvc and no uvicorn (`start_server`, a client task nothing holds, one `gc.collect()` in the handler) loses its client the same way on Linux's `_UnixSelectorEventLoop` (Python 3.10, WSL) and on Windows' `ProactorEventLoop` (3.12). Keeping a reference fixes it on both. Linux CI passes only because its allocation counts happen not to put a full collection in that wait. ## Fix - **`test_pycvc_ariadne_server.py`**: keeps `client_task`. Its `/ping` handler now runs `gc.collect()`, so a full collection always falls inside the request. The test now checks that every task on the loop survives one, the host's tasks and its own. On every platform, the old test with that line added hangs. - **The arisrv ctest programs**, which used the same unheld idiom: - `http_listen.py`'s selftest waits on a stream exactly as `client()` did. It now keeps its task, and its `/ping` runs `gc.collect()` too, so `arisrvx_http_listen` checks arisrvx's own path under a full collection. - `service.py` (`arisrvx_serve`): its selftest and its in-flight `/slow` request are kept in `tasks`. - `program.py` (`arisrvx_program`, and the arisrvx package's smoke test in publish-cvcpkg.yml) waits on `asyncio.sleep`, whose timer keeps its task alive, so it could not hang this way. It keeps its task anyway, because it is the example people copy. - **Docs**: the `pycvc.ariadne` module docstring and ARIADNE.md's script-thread bullet now say to keep the task `host.loop.create_task()` returns until it is done. arisrvx's own serving path was already safe: `_Program.spawn`, `_Served.task` and uvicorn's per-connection tasks are all held. A packaged arisrvx serving HTTP does not hang this way. A service's own code would, on any platform, if it starts a task without keeping it and that task waits on a stream of its own, which is what the docs now warn about. ## Verification Windows 11, MSVC 14.44, static Release (pycvc core on, pycvc_gl off), Python 3.12.10. Built at this branch (master 4239741 + this commit): | Run | Result | |---|---| | ctest `pycvc_ariadne_server`, this branch's test | passed 3/3 (2.4–3.1 s) | | master's test unchanged, same build | hangs 2/2 (timeout, `Task was destroyed but it is pending!`) | | master's test plus only the `/ping` `gc.collect()` (task not kept) | hangs 2/2, deterministically | | `arisrvx --python http_listen.py --http-listen …`, this branch's program | passed (1 s) | | the same program with its task not kept | hangs 2/2 (`Task was destroyed`, no selftest line) | | ctest `-R '^(arisrvx_\|pycvc_ariadne)'` | 25/25 passed | Linux has not been run here beyond the minimal asyncio repro. pycvc-linux and the arisrvx lanes on this PR are the check there.
transfix
added a commit
that referenced
this pull request
Nov 15, 2026
#1216 moved the Python Host to `pycvc.ari` and left `pycvc_gl.ariadne` as an alias. To stay off lines that open PRs edited, it kept the old name in a few places. With #1169 in, they can change. Comments, docstrings and Markdown only. ## Now `pycvc.ari` - `ariadne_server.py`: the module docstring ("as `pycvc.ari.Host`'s do") and the values section's comment. - ARIADNE.md: - where `display(obj)` is predefined; - what arisrvx's `host.set` / `set_tree` / `set_series` / `set_plot` match. - Docstrings: `ariadne_display`'s (which host it shows in) and `ariadne_mpl.attach`'s. - Comments: the `pycvc_gl_ariadne_host` test's in `bindings/pycvc/CMakeLists.txt`, and the ariglx smoke's in `publish-cvcpkg.yml`. ## The roadmap (ARIADNE_SCRIPTING_HOSTS.md) - The plan's matplotlib bullet named `pycvc_gl.ariadne.mpl`. It now names the backend that shipped, `pycvc_gl.ariadne_mpl`. - The "as built" note says why: the Host's module is a module, not a package. It said `pycvc_gl.ariadne`; it now says `pycvc.ari`. - S7 is done: - the status says it shipped in #1177; - §10's row is **Done** (it said **Built**). ## Left as they are - Lines that say `pycvc_gl.ariadne` is the same module: - `ari.py` and the alias itself; - `pycvc.i`, and two CMake comments; - `link-host.sh`, the arix recipe, and ARIADNE.md §9.3. - Code that imports through the alias: - `cars.py`; - the `pycvc_gl_*` tests; - the matplotlib test documents. These keep the old name tested. ## Checks - `git grep 'pycvc_gl\.ariadne\b'` finds only the lines above. - The three edited Python files parse. - No changed line passes 100 columns, except the §10 table row, which was already longer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Python program that runs in place of the document (
arix run app.py) adopts the host withHost(). That class lived inpycvc_gl.ariadne(#985).Under arix the Host never draws. There is no GL, so it drives the host's own runtime through core pycvc (
pycvc.ari_app_attach), the way a headless Host drivespycvc.AriApp. But importing it ran pycvc_gl's__init__, which loads the native_pycvc_gl(cvcGL and VTK). As a result:pycvc-gl-cp312beside it;arix_python_programfailed in any tree built withCVC_BUILD_PYCVC_GL=OFF.CI never saw the failure, because pycvc-linux builds pycvc_gl.
The change
The module moves to core pycvc as
pycvc.ari, inbindings/pycvc/pymod/ari.py.It is installed beside
pycvc.pyas_pycvc_ari.py, andpycvc.pyregisters it aspycvc.ari. This is the same mechanismpycvc.ariadneuses.pycvc.ariadnestays arisrvx's server Host.pycvc-cp312's
_pycvc*file list already covers the new file, so no recipe file lists change.pycvc_gl is imported only where something draws:
host.lab;Without pycvc_gl, those raise an ImportError that says to install pycvc-gl-cp312 or use
mode="headless".pycvc_gl.ariadneis the same module, not a copy. Importing it putspycvc.ariin its place insys.modules. Sopycvc_gl.ariadne is pycvc.ari, and old imports get the sameHost,current_host()andexport.The browser's
python312.zip(cvc_ariadne_python_wasm_host) and the pycvc-gl wasm host (link-host.sh) ship_pycvc_ari.pybesidepycvc.py, sincepycvc_gl.ariadnenow needs it.These now name
pycvc.ari:--help;The logger is now
pycvc.ari.Not changed, to stay off lines that open PRs edit:
ariadne_server.py;Their mentions of
pycvc_gl.ariadnestay true through the alias.Open PRs that touch the old file
ariglx: matplotlib figures as Ariadne windows, and display() (C1) #1198 (matplotlib,
display()) landed first. The master merge (18315e6) moved its two hunks frompymod_gl/ariadne.pytopymod/ari.py:_arihost()never adopts arisrvx's host (mode"server").display()importspycvc_gl.ariadne_displayby its full name, because a relative import doesn't resolve frompycvc.ari.The display code itself stays in pycvc_gl.
pycvc_gl.ariadne.displayis the same function, andariadne_display'sfrom . import ariadnegetspycvc.ari.ariglx-web: the threaded build (wasm-mt), cross-origin isolated (W3) #1200 (ariglx-web's threaded build) rewrote the end of the ariglx-web recipe's description, on the line this PR renames. The merge (37c5ca9) keeps its wasm and wasm-mt sentence and says
pycvc.ari.Host(). The wasm-mt build packspython312.zipas the wasm build does, so it ships_pycvc_ari.pytoo.Ariadne chart: curves with their own x, bands, gaps, markers, log y, a play-head and a pick #1169 (
set_plot) still editspymod_gl/ariadne.py. If this PR lands first, its hunks move topymod/ari.py.Tests
pycvc_ariadne(core) now also:pycvc.ari;pycvc.ari.Hostwith a Python function;pycvc_glis never imported;pycvc_gl_ariadne_hostcheckspycvc_gl.ariadne is pycvc.ari.CVC_BUILD_PYCVC_GL=OFF:arix_python_program,arix_python_block,arix_python_error,arix_python_interpreter,ari_python_needs_arix,arix_wasm_block,ari_wasm_needs_arix,pycvc_smoke,pycvc_ariadne(45 checks) andpycvc_ariadne_serverall pass, 10 of 10.arix_python_programfailed there withModuleNotFoundError: No module named 'pycvc_gl'.pycvc_glpackage, includingdisplayand a package-relativefrom . import ariadne.arix_matplotlib_backendskips here, because this Python has no matplotlib.ariglx_python_program, thepycvc_gl_*tests, and the ariglx-web zip.