Repository navigation
Port the remaining Python commands and tools to Flow - #1064
Merged
Merged
Conversation
This was referenced Sep 29, 2026
js_generator.py has no importer (flowc's jsgen.flow is the JavaScript emitter). pipeline_fusion.py and physics_dsl.py were imported only by their own unit tests; flowc fuses pipelines in compiler/src/pipeline_fusion.flow, covered by tests/lang/test_pipeline_fusion.flow and tests/cgen.
… Flow The package commands that still ran src/flow/package.py and src/flow/registry.py are now part of the Flow package manager (compiler/src/pkg.flow, pkg_main.flow): init, publish (the local index write, with --git/--tag/--path/--dry-run and the legacy crates/packets keys), build, run, build-native, run-native and clean. Builds run flowc through compiler/scripts/flowc_emit.sh and clang/clang++ through system(), with the same Running: lines, warnings and failure output. flow-driver runs the Flow tool for pkg, publish, init, build, build-native, run-native and clean, and for the Vulkan and UI demo launchers that called FlowPackageManager.run_native. scripts/check_pkg_commands.sh is the parity gate: 34 cases (success and error paths) recorded from the Python version at e6a7f04 into tests/pkg_commands, checked with python and python3 stubbed out. One deliberate difference: flow init writes host = "flowc" in [build] (Python wrote the retired "python" host).
Every package command is now the Flow package manager, so the Python package manager and registry writer go. tests/unit/test_registry.py and the package tests in test_package_manager.py are covered by scripts/check_pkg_parity.sh (install, add, sync, search, info, git and path dependencies) and scripts/check_pkg_commands.sh (init, publish, build, build-native, run-native, clean, including native sources from dependencies and publish_local's version sort). The two tests that read manifests through the Python front end, which the MLIR backend still uses (toml_compat, project_config, module_resolver), move to tests/unit/test_project_manifest.py. check_run_without_python.sh now also runs init, build, build-native, run-native, publish --dry-run and clean with python stubbed out. check_pkg_parity.sh maps the retired host = "python" line the old Python version wrote to the host = "flowc" that flow add writes, which had left 48 add cases failing on the base branch; it is back to 134/134. Docs and stability/surfaces.json name compiler/src/pkg.flow instead of package.py, and the package examples use flow sync.
No new .py files: the two manifest tests moved out of the deleted test_package_manager.py join the module resolver tests.
scripts/tools/llvm_target is the Flow version of src/flow/bpf_target.py and src/flow/wasm_compiler.py: the same argument handling, the bpfel IR checks (unwind constructs, userspace runtime symbols, dynamic allocas), triple and data layout rewrite, entry section and license metadata, the wasm32 export check and clang link. scripts/bpf_target.sh and scripts/wasm32_target.sh run it. A Flow source reaches LLVM IR through compiler/scripts/flow_to_llvm.sh: the flowc MLIR emitter and mlir_lower.sh, as flow compile --backend=mlir does. A program outside the emitter's slice falls back to the Python MLIR generator with a warning. For wasm32 a program with external functions also falls back, since only the Python generator lowers size_t as i32. compiler/scripts/parity_targets.sh runs 38 cases with python stubbed out and compares exit status, stderr and the object's SHA-256 with goldens captured from the Python modules: 38/38, objects byte-identical (bpf from .flow at -O0/-O2/-O3 and from .ll, wasm with and without exports at O1/O2/O3/Oz, every rejection and usage error).
flow bpf and flow wasm32 run scripts/tools/llvm_target. The bpf and
wasm32 CI jobs call the shims and run parity_targets.sh --portable (the
runner's LLVM 18 writes different bytes than the LLVM 22 goldens, so it
checks exit statuses and messages); bpf.yml no longer sets up Python.
wasm32.yml keeps it only because alloc_sum.flow (an unsized array) is
outside the flowc MLIR emitter and flow_to_llvm.sh lowers it with the
Python MLIR generator.
tests/wasm/compare_native_wasm.sh replaces the .py: it prints the same
JSON line ({"abs_error": 0.0, "native_mlir": 3.75, ...}).
Deleted: src/flow/bpf_target.py (340 lines), src/flow/wasm_compiler.py
(207), tests/unit/test_bpf_target.py (96), tests/unit/test_wasm_compiler.py
(82), tests/wasm/compare_native_wasm.py (133). Their assertions are cases
in tests/targets/cases.txt. The docs, the coverage map and the doc
coverage test follow.
tools/project_test/main.flow replaces src/flow/project_test_runner.py for `flow test` inside a project. It discovers files, rewrites native test blocks one case at a time, compiles through flow-driver, runs each binary with fork/exec and a timeout, and compares .expected, .expected-stderr and .exitcode goldens. The launcher routes project mode to it through the driver's __project-test command, which builds it on first use. compiler/scripts/parity_project_test.sh checks 32 argument sets over six generated projects against goldens written by the Python runner at e6a7f04, with python stubbed out: 32 passed, 0 failed.
tools/project_test replaced it. The unit tests' cases (duplicate slugs, native test rewriting, discovery skipping _helper and wip, substring and glob filters) are covered by compiler/scripts/parity_project_test.sh.
Moves the pathlib-style path helpers, the fork/exec runner with a timeout and the universal-newline reader out of tools/project_test into tools/hostlib/sys.flow so tools/dap can use them. parity_project_test.sh: 32 passed, 0 failed.
tools/dap/main.flow replaces src/flow/dap_server.py. It starts lldb-dap, forwards client requests to it, rewrites launch (builds the Flow file with flow debug --no-launch and points program at build/<stem>.debug, cwd defaulting to the repository), and forks a child that pumps lldb-dap's replies back. Messages are re-serialised the way json.dumps writes them, so the bytes match the Python server. Without lldb-dap it answers initialize and fails launch, then exits 2. From a terminal, flow-driver still opens flow debug. FLOW_LLDB_DAP overrides the lldb-dap search. compiler/scripts/parity_dap.sh runs three scripted sessions (no lldb-dap; no lldb-dap with early end of input; a fake lldb-dap covering the launch rewrite, missing and failing builds, relative and null cwd, non-ASCII text and float re-serialisation in both directions) against goldens from the Python server at e6a7f04, with python stubbed out: 3 passed, 0 failed.
tools/dap replaced it (parity_dap.sh: 3 of 3 sessions byte-identical).
The C compiler's wording differs between clang and gcc, so the failing fixture now stops in flowc. Goldens rewritten from the Python runner at e6a7f04; the Flow runner matches all 32.
tools/pywheel/main.flow ports src/flow/python_generator.py and the --python path of the transpiler. It parses the program and its imports with the flowc front end (the language server's analysis and import resolution), mirrors the Python monomorphizer's explicit instantiations, the @only filter and anonymous fork records, and writes the same export analysis, CPython extension source, setup.py and pyproject.toml. The program's C comes from flowc_emit.sh --strict, so type errors still stop generation before anything is written. flow-driver builds the tool with flow_native_tool (now also rebuilt when tools/lsp changes). --source runs no Python. The wheel build is the one step that runs Python: `python3 -m pip wheel` on the generated package, because building a wheel needs setuptools. That builds a Python artifact and does not run Flow's compiler in Python. The driver passes pip an absolute dist/ path; the Python generator passed a relative one from a temporary directory, so it always lost the built wheel and fell back to the source file. tests/pywheel/run.sh is the parity gate: 17 cases with python and python3 stubbed out on PATH, plus the package files and an optional real wheel build (FLOW_PYWHEEL_SMOKE=1). The goldens were checked against the Python generator: stdout, exit status and generated files match byte for byte in all 17 cases; stderr differs by design in three error cases (see tests/pywheel/expected/README). Across 67 example programs the two agree: 27 byte-identical packages and 40 identical failures (public structs, which the Python generator could not handle).
src/flow/python_generator.py (795 lines) and its unit test are gone; the Flow tool tools/pywheel generates the package and tests/pywheel/run.sh checks it against goldens captured from the Python generator. The override assertions of test_python_export_overrides.py (rename, doc, exclude, plain export) are the `overrides` case of that gate. `python3 -m flow.transpiler --python` now exits 2 and points at `flow python`, as `--c` does. The MLIR path is unchanged. docs/python-target.md describes the Flow tool, says the wheel build is the one step that runs Python (pip and setuptools build the Python artifact), and no longer claims that pointers and structs cross the boundary: they never did.
roundtrip.sh and the stage_a_* scripts it runs derived per-module C headers with compiler/scripts/flowc_c_to_hdr.py. The Flow tool scripts/tools/c_to_hdr does the same: #include lines, typedef structs, int32_t consts as extern, function definitions as prototypes. It reads with universal newlines as Python's text mode did. roundtrip.sh builds it once and exports C_TO_HDR; the stage_a_* scripts build it when run alone. Parity: on all 112 C files under compiler/build after a roundtrip, plus the 22 headers roundtrip wrote, the Flow output is byte-identical to the Python output (134/134). tests/c_to_hdr/run.sh holds goldens from the Python script for two real emits and five edge-case inputs (CRLF, no final newline, empty, Unicode line breaks, pattern edges) and checks the usage error (exit 2) and an unreadable input (exit 1), with python stubbed out: pass=9 fail=0. roundtrip.sh with python and python3 stubbed on PATH: ALL PASS, no stub calls. The CI roundtrip job drops its Python setup and runs the goldens.
…tions.py, idioms.py `flow check` is now the Flow program tools/check/main.flow, built on first use by flow-driver (flow_native_tool) like the LSP and the REPL. It reads [conventions].avoid from flow.toml with the package manager's TOML parser, matches avoid patterns with scripts/tools/lib/regex.flow (substring when a pattern has no metacharacter or does not compile), and with --idioms walks top-level function bodies from the flowc parser for FIDIOM001 and FIDIOM002, text or --format=json. It keeps the Python behaviour exactly, including its quirks: - Files come in Path.rglob order (scandir order per directory, the walk's subdirectories listed before their contents), filtered on "build/" and ".freebuff/" in the absolute path. - The advisor read `else_if` and `branches`, which the Python AST lacked, so any if or match statement in a reachable body dropped the whole file's hints. A file with one reports none here either. - Hint positions are the Python lexer's counts: a whitespace run starting with a space swallows the newlines after it, columns grow by expandtabs(4). They are recomputed from the parsed text. - Only flow blocks are expanded before parse, via flowc's own expansion, as Parser.parse did. Parity: over the whole repository (2737 .flow files) `flow check --idioms` and `--idioms --format=json` give byte-identical stdout and stderr and the same exit status as the Python version, in the same file order. tests/check/run.sh holds 18 cases recorded from the Python version (text, json, an unknown format, avoid-only, explicit files, a missing file, a directory named x.flow, symlinks, CRLF, invalid UTF-8, a parse error, flow blocks, suppression comments, tabs, Unicode columns, inline-table and invalid flow.toml, no conventions, no files, flow.toml found from a subdirectory). Cases without file arguments compare sorted lines, because rglob order is the file system's directory order. With python stubbed out: pass=18 fail=0. The CI no-Python compiler job runs it. Gap: patterns using lookaround or backreferences compile in Python but not in regex.flow, so they fall back to a substring match here.
tools/analyze/main.flow replaces src/flow/wcet_analysis.py and src/flow/misra_scan.py behind `flow analyze`. flow-driver builds it on first use with flow_native_tool and keeps the old routing: a .flow file (or --wcet / --stack-depth first) goes to the WCET and stack-depth analysis, anything else to the MISRA/CERT scan. The WCET analysis parses with the flowc front end, after the flow-block and impl expansions (the Python parser did both itself), and walks the AST the way the Python version walked the parser's dataclasses. It also reproduces the Python parser's own rewrites where they changed the counts: `dbg e` as a call to __flow_dbg, `|> find` and `|> sort` as non-calls, fork and choose blocks as fork_records lowered them, sum(range) helper calls and the helper functions range_sums appended, generic calls named f_T, module-block functions left out, and `shader` declarations rejected. Type sizes and statement costs come from compiler/src/wcet.flow. compiler/src/misra_scan.flow gains flowc_misra_report, a one-pass scan with Python's splitlines, strip and \b...\s*\( semantics and 80-character (code point) details. Both keep argparse's usage, help and error text and exit codes. Parity, python and python3 stubbed out on PATH: - tests/tools/analyze/run.sh: 64 cases (33 WCET reports over examples/ and tests/lang, 5 budget cases, 11 WCET argument and input errors, 9 MISRA scans over flowc-emitted and edge-case C, 6 MISRA errors), goldens recorded from the Python commands: 64 passed. - Every .flow file under examples/ and tests/lang (1685): stdout and exit code identical (1514 reports, 171 rejected by both). - Every tracked .c/.h file (143) plus fixtures, default and --fail-on-violation --standard cert-c: 286 of 286 identical. The Python analysis kept callees in a set, so tied chains depended on the hash seed; the goldens and the Flow tool use first-call order. Flow gap: a field read through a cast, `(p as ptr<Row>).value`, emits `.` instead of `->` in C; worked around with a typed local.
`flow analyze` runs tools/analyze/main.flow (previous commit), so the Python versions go: - src/flow/wcet_analysis.py (341 lines) - src/flow/misra_scan.py (102 lines) - tests/unit/test_wcet_analysis.py (148 lines). Its cases (stack depth and WCET of helper/compute/main chains, while loops under @max_iterations, extern callees at 64 bytes, results sorted by value) are covered by the report goldens in tests/tools/analyze/run.sh, which compare whole reports rather than bounds. - test_misra_scan_flags_malloc in tests/unit/test_misra_phase2.py, covered by the misra_* cases of the same gate. The file's @safe/@unsafe type checker tests stay. CI drops test_wcet_analysis.py from the arithmetic safety step. The tool transcript job, which already runs tests/tools/run.sh with python stubbed out, now also runs the analyze gate, and triggers on wcet.flow and misra_scan.flow. Docs: the WCET guide no longer points at `python3 -m flow.wcet_analysis`; python-in-flow.md and tests-in-flow.md record the port.
bpf_gen.flow and wasm_gen.flow ran python3 -m flow.transpiler for the Flow to LLVM IR step. They now run compiler/scripts/flow_to_llvm.sh, the flowc MLIR path. flow_to_llvm.sh unsets FLOWC_BACKEND so the inner flowc does not re-enter the bpf or wasm mode. Checked with a flowc built from these sources: answer.flow gives an eBPF ELF object and main_42.flow a wasm module exporting answer, with no Python call. The bootstrap C is regenerated in a later commit.
The three gates run with python stubbed out, so they join the flowc self-host job next to the flow check goldens.
flow fir-g now runs tools/fir/main.flow, built on first use by flow_native_tool. It loads the program and its imports in the Python resolver's order, parses with the flowc front end, monomorphizes generic functions the way monomorphize.py does, lowers every function into the FIR-G columns as fir_graphify.py did, and prints the same text and JSON reports, optimisation candidates, routing and calibration output. Where the Python parser desugars a construct the flowc parser keeps, the lowering follows the Python shape: elif chains, method calls, string interpolation, dbg, return void, forward declarations, fork and choose blocks (hoisted lets and match), |> sort / |> find stages, and sum(range) folding with its helper functions. compiler/src/fir_analysis.flow: the reachability stack is now sized by the number of call edges. A function is pushed once per incoming edge before it is visited, so sizing it by the function count overflowed on real programs. flow_native_tool also watches tools/lsp, whose JSON module fir-g uses.
tests/fir/run.sh builds tools/fir with the bootstrap flowc and runs 52 cases with python and python3 stubbed out: reports on 28 programs (text, JSON and --opts; generics, imports, range sums, choose and fork blocks, sort stages, claim-path imports, @gpu, @only and @hot), argument errors, missing files, parse and import errors, --device numpy/mlx/auto against six threshold files, --calibrate (stdout and the file written) and --bench, plus two runs through ./flow fir-g. The goldens were captured from src/flow/fir_cli.py with NumPy and MLX unavailable. Over the 1513 programs in examples/ and tests/lang that the Python tool accepts, the Flow tool's --json --opts and --opts output is byte-identical for all 1513; the 172 it rejects are rejected by both.
Removes src/flow/fir_cli.py, fir_g.py, fir_graphify.py, fir_analysis.py, fir_opts.py, fir_route.py and fir_mlx.py (1575 lines) and tests/unit/test_fir_g.py, test_fir_analysis.py, test_fir_route_opts.py and test_fir_mlx_oracle.py (674 lines). What those tests checked moves to the gate: tests/fir/programs/analysis.flow covers effect propagation through a call chain, dead functions, edge weights and mutual recursion; nomain.flow covers the root fallback when there is no main. tests/lang/test_fir_analysis.flow gains a fan-in graph that overflowed the old reachability stack. The MLX and NumPy oracle tests have no subject left. Also commits the golden .out files, which the repository's *.out ignore rule had kept out of the previous commit. Docs: fir-g.md, python-in-flow.md and tests-in-flow.md name the Flow files.
The *.out and dist/ ignore rules kept the flow run goldens, the flow python dist/ goldens and the bpf/wasm32 IR fixtures out of the port commits, so those gates failed on a clean checkout. They are now added with -f. The flow run gate maps the repository root to ROOT so the goldens do not name the checkout they were recorded in. The flow python setup.py golden is stored as setup.py.expect so the Python ratchet does not count it as source. tests/pywheel/run.sh 18/18, tests/flow_run/run.sh 18/18, parity_targets.sh 38/38.
tools/gpu/main.flow loads the program with the flowc front end in the Python resolver's order (tools/fir/lower.flow) and writes one shader per @gpu function the way src/flow/metal_codegen.py and wgsl_codegen.py did: NAME.metal and NAME_host.m, or NAME.wgsl. flow-driver runs it for `flow gpu [--wgsl]` in place of the inline Python, and watches tools/fir when deciding to rebuild a native tool. tests/gpu/run.sh is the parity gate: 40 cases (every repository program with @gpu functions plus fixtures for each statement and expression form, the WGSL errors, imports, no kernels, parse and import errors), goldens recorded from the Python generator through the flow-driver of fcd2edf, run with python stubbed out. 40 passed. Six cases hold the Flow text by design (flowc parse and import messages, and `vec` as a type name); tests/gpu/KNOWN_DIFFERENCES.md lists them. A WGSL traceback is now one error line with the same exit status.
`wasm/crossings.sh gpu` replaces wasm/flow_wasm_gpu.py. The WGSL and the kernel manifest come from tools/gpu (`flow gpu --build` prints the binary; `--crossing-manifest` writes the shaders and prints the manifest JSON as json.dumps(kernels, indent=2) did), the page from wasm/crossing_assets/pages/gpu.html, and the CPU reference from flowc and emcc with the same arguments. `crossings.sh all` runs it in place of python3. tests/gpu/crossing.sh: 6 cases (default, -n, another program, no kernels, a WGSL error after a written kernel, a missing program) recorded from flow_wasm_gpu.py, run with python stubbed out: 6 passed. A full emcc build of examples/wasm/gpu_vector_add.flow gave byte-identical .js, .wasm, .wgsl and index.html. The page names tools/gpu/main.flow and crossings.sh gpu where it named the Python files.
…der) `wasm/crossings.sh shader SOURCE [--name] [--size WxH] [--time T] [--out DIR]` replaces wasm/flow_webgpu_shader.py. flowc builds the WGSL (FLOWC_SHADER=list and =wgsl, as flow.shader_dsl ran it) and the page comes from wasm/crossing_assets/pages/shader.html; --time prints as Python's float repr. tests/gpu/crossing.sh gains 10 shader cases recorded from the Python script of fcd2edf (a plain and a named fill, float formatting, every argument and source error): 16 passed with python stubbed out. Usage errors keep exit status 2 and the message; the prefix is crossings.sh. The WGSL shaders and webgpu-host.js now credit tools/gpu/main.flow where they credited src/flow/wgsl_codegen.py; both gates apply that rename when they record, and re-recording from fcd2edf changes nothing else.
scripts/record_shader_gallery.sh runs scripts/tools/shader_record, the logic of scripts/record_shader_gallery.py in Flow: the same options, argparse messages, exit codes and output. flowc builds the MSL (FLOWC_SHADER=metal) where the script went through flow.shader_dsl, and xcrun clang builds runtime/shader_record_metal.m as before. Each GIF is still encoded by scripts/frames_to_gif.py, which stays in Python for Pillow's quantiser, so this tool runs python3 for that one step. Checked against the Python script on this Mac (Metal, Pillow 12.1.1): --name photoreal_marble and --group classic (3 shaders) at 2 frames give byte-identical GIFs and identical stdout; an unknown shader, --width 0, a bad --group and a bad --frames give the same message and exit status. The recorder needs a Metal device, so there is no CI gate for it.
Removed, now that tools/gpu, wasm/crossings.sh gpu|shader and scripts/record_shader_gallery.sh do their work: src/flow/metal_codegen.py 456 src/flow/wgsl_codegen.py 511 wasm/flow_wasm_gpu.py 330 wasm/crossing_common.py 104 wasm/flow_webgpu_shader.py 135 scripts/record_shader_gallery.py 214 tests/unit/test_metal_codegen.py 65 test_metal_codegen.py checked an empty program, a program without @gpu functions and one kernel's text; tests/gpu/run.sh covers all three on real programs. src/flow/shader_dsl.py stays: module_resolver.py, which the MLIR backend uses, imports it. Docs and generators name the Flow tools: wasm-crossings.md, architecture-writeup.md, python-in-flow.md, shaders.md, demos/README.md, examples/gpu/vgpu/README.md, the shader gallery and demo overview generators (docs/demos/shaders.md and overview.md regenerated), the crossings index template, and the comments of examples/wasm/gpu_vector_add.flow. site/wasm-crossings/index.html and site/wasm-crossings/gpu/ are rebuilt with crossings.sh (--no-build: the checked-in .js and .wasm are unchanged). docs/coverage.json drops the two deleted backend keys.
The GPU crossing page embeds the program source, so the recording takes examples/ from the working tree and only the Python builder from PARITY_REF. The two default-program goldens pick up the new comments of examples/wasm/gpu_vector_add.flow; nothing else changes. 16 passed.
All five run with python stubbed out, in the flowc self-host job.
README, getting-started, self-hosting.md and python-in-flow.md listed flow check, flow python, the package commands and the analyzers as Python. What remains is the MLIR backend, the setuptools wheel build, the wasm32 CI fallback and scripts that need Pillow, sockets or a browser.
The compile_fail golden held Apple clang's caret line, so it failed under Homebrew clang and would fail under gcc on CI. The gate still checks the JSON envelope and the compile stage.
- roundtrip and the self-emit scripts call the Flow c_to_hdr tool for the modules #1058 added (attributes, ordering_hints, sort_plans, sort_sites) - write() is declared with a string buffer everywhere: tools/hostlib and pkg_main.flow declared ptr<u8>, which clashed with cgen.flow and proof_doc.flow in one C unit (the fir tool failed to compile) - the gpu gates drop an empty files/ before diffing; git keeps no empty directories, so every case without output files failed
The Flow doc checker now compiles with the flowc that has #1058's attribute vocabulary. Eight expect-error blocks that flowc used to reject only for an unknown attribute (lifetime domains, span escapes) now compile, because flowc does not have the Python checker's lifetime and escape analysis; one book block holds only comments. They are recorded in the ledger as known gaps. The MLIR corpus is rerecorded (1072 programs).
godofecht
changed the base branch from
selfhost/retire-python-c-host
to
main
September 29, 2026 20:56
godofecht
force-pushed
the
port/remaining-python-commands
branch
from
September 29, 2026 20:56
3a79fcb to
cab2582
Compare
- flow check segfaulted on Linux reading dir.flow, a directory the rglob
walk returns: ftell on a directory stream is LONG_MAX there, so size + 1
overflowed and fread wrote through a null buffer. ft_read_file reads such
a stream as empty, as macOS already did, and checks the allocation.
- the flow test sweep skips the tool gate directories (tests/fir, gpu,
pywheel, targets and the rest); their inputs are rejected on purpose and
each gate checks its own.
- check_pkg_commands exports with ${e?} (shellcheck SC2163).
- tests/doc_examples builds flowc before the first case, so the build
notice does not land in that case's stderr.
glibc's stdlib.h declares both with char pointers, so the prototypes flowc built from the Flow externs (uint8_t*) conflicted and the tool did not compile on Linux. On macOS they live in unistd.h, which would clash with the tool's other externs, so the wrappers declare them there.
Content-Length values count the real checkout paths, so the goldens only matched where the checkout path had the recording's length, and the build log a failed flow debug launch carries depends on the host and on flowc. The gate compares with both normalised; the protocol messages and the failure itself still have to match.
dash applies a simple command's redirections in the shell itself, so its "Segmentation fault" line went into the program's captured stderr on Linux. Running the program in an exec'd subshell sends that report to the outer shell's stderr, which is /dev/null.
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
Conflicts resolved toward this branch where it had moved on: the MLIR path has no Python fallback, src/flow and its pytest files stay deleted, and the workflows, docs and corpus digests keep this branch's versions. The tool-port files this branch had not touched take #1064's latest.
A debug build on macOS writes a .dSYM bundle beside the binary. Linux has none, so the goldens recorded on a Mac failed there.
This was referenced Sep 29, 2026
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.
Builds on #1027 (selfhost/retire-python-c-host) and targets that branch, so the diff shows only this work. It merges together with #1027 and the feature-restore PR.
The commands and tools that still ran the Python front end after #1027 are now Flow tools, each with a parity gate recorded from the Python version before it was deleted. Every gate runs with
pythonandpython3stubbed out on PATH.Ports
flow check(check.py, conventions.py, idioms.py)tools/checktests/check/run.shflowc_c_to_hdr.py(roundtrip and stage_a scripts)scripts/tools/c_to_hdrtests/c_to_hdr/run.shflow analyze(wcet_analysis.py, misra_scan.py)tools/analyze+compiler/src/misra_scan.flowtests/tools/analyze/run.shflow fir-g(fir_cli, fir_g, fir_graphify, fir_analysis, fir_opts, fir_route, fir_mlx)tools/firtests/fir/run.shflow test(project_test_runner.py)tools/project_testcompiler/scripts/parity_project_test.shflow dap(dap_server.py)tools/dapcompiler/scripts/parity_dap.shinit,publish,build,build-native,run,run-native,clean(package.py, registry.py)compiler/src/pkg.flow,pkg_main.flowscripts/check_pkg_commands.shcheck_pkg_parity.sh134/134flow python(python_generator.py)tools/pywheeltests/pywheel/run.shpython -m flow.bpf_target,flow.wasm_compilerscripts/tools/llvm_target(flow bpf,flow wasm32)compiler/scripts/parity_targets.shflow gpu(metal_codegen, wgsl_codegen),wasm/flow_wasm_gpu.py,flow_webgpu_shader.py,record_shader_gallery.pytools/gpu, `wasm/crossings.sh gpu,scripts/tools/shader_record`tests/gpu/run.sh,tests/gpu/crossing.shcheck_doc_examples*.py,check_doc_flow_snippets.py,docs_blocks.py,verify_browser_interp.pytools/doc_examplesviascripts/check_doc_examples.shtests/doc_examples/run.shFLOW_RUN_PYTHONrunner (run.py, cost_model.py)tools/run(flow run --json,--predict)tests/flow_run/run.shFLOWC_BACKEND=bpf|wasm(bpf_gen.flow, wasm_gen.flow) calledpython3 -m flow.transpiler; they now callcompiler/scripts/flow_to_llvm.sh. The bootstrap C is regenerated in its own commit (fixed point at gen2).Deleted with nothing to port:
js_generator.py,pipeline_fusion.py,physics_dsl.py,ordering_hints.py(no caller outside their own tests).flow pythonstill runspython3 -m pip wheelon the generated package. That step builds a Python artifact with setuptools. The generator, the extension C,setup.pyandpyproject.tomlall come from the Flow tool, and--sourceruns no Python.Python removed
Ratchet: 278 files and 67005 lines before, 217 files and 53458 lines now (13547 lines, 61 files). No new
.pyfiles.Behaviour that differs, on purpose
expect-errorblocks are now unverified, because flowc does not reject what the Python type checker rejected (string toi32, assignment to an immutablelet, lifetime domains, span escape, undefined function in lenient mode). Listed intests/doc_examples/KNOWN_DIFFERENCES.md; the ledger is regenerated.flow python: public structs stop with a clear error where the Python generator crashed; the wheel lands indist/(the Python version lost it through a relative path).flow fir-g: no NumPy or MLX;--device numpy|mlxgives the Python "not available" error.flow gpu: parse and import errors use flowc's wording;attr.flownow compiles for Metal because flowc acceptsvecas a type name.error:messages with the same exit code.flow initwriteshost = "flowc".Gates
The new gates run in CI (flowc self-host job, bpf.yml, wasm32.yml, doc-examples-strict.yml).
What still calls the Python parser, type checker and monomorphizer
Outside the MLIR backend (transpiler.py, mlir_*.py, jit_runner.py, module_resolver.py, c_header_parser.py) there are no callers left in commands or tools. What remains:
flow run --backend=mlirand--jit,flow compile --backend=mlirfallback, theflow_to_llvm.shfallback used byflow bpf/flow wasm32when the Flow MLIR emitter refuses a program (the wasm32 CI job'salloc_sum.flow), the MLIR GPU and SPIR-V smoke ongpu_kernels.flow,scripts/compile_spirv_metal.py,scripts/run_bench.pyand the MLIR benchmarks underbenchmarks/.tests/fuzz/harness.pyand about 30tests/unitfiles that test the Python parser, type checker and monomorphizer directly.Flow gaps found (worked around, not fixed here)
f().x) or through a cast emits.where C needs->.&of a call result emits invalid C; aptr<ptr<Self>>field emits an untaggedSelf**.realpath,fdopen,filenoclash with the libc prototypes.toandfromare reserved and cannot be parameter names.size_twidth.