Skip to content

Convert exec tools rust - #2

Closed
rickeylev wants to merge 9 commits into
mainfrom
convert_exec_tools_rust
Closed

rickeylev wants to merge 9 commits into
mainfrom
convert_exec_tools_rust

Conversation

@rickeylev

Copy link
Copy Markdown
Owner

convert each python tool into a rust binary

@rickeylev
rickeylev force-pushed the convert_exec_tools_rust branch 2 times, most recently from 0de63e8 to f656093 Compare November 3, 2026 08:08
Comment thread .agents/rules/rust.md Resolved
Comment thread .agents/rules/rust.md Resolved
Comment thread crates/build_data_writer/src/lib.rs Resolved
Comment thread crates/build_data_writer/src/lib.rs Resolved
Comment thread crates/build_data_writer/src/lib.rs Resolved
Comment thread crates/py_console_script_gen/src/lib.rs Resolved
Comment thread crates/py_console_script_gen/src/lib.rs Resolved
Comment thread crates/py_console_script_gen/src/lib.rs Resolved
Comment thread crates/py_console_script_gen/src/lib.rs Resolved
Comment thread crates/py_console_script_gen/src/lib.rs Resolved
@rickeylev

Copy link
Copy Markdown
Owner Author

PTAL @Solumin — addressed all review comments across the crates and generalized the conventions into .agents/rules/rust.md.

This is an automatically generated agent comment.

@rickeylev
rickeylev force-pushed the convert_exec_tools_rust branch 2 times, most recently from fd75589 to ca78423 Compare November 14, 2026 08:37
Validating `py_test` main modules in Rust requires a real Python parser
rather than a hand-written tokenizer, and the parser must be pure Rust so
it compiles for every target platform, including
`powerpc64le-unknown-linux-musl`.

Add `ruff_python_ast` and `ruff_python_parser` to `crates/Cargo.toml` and
repin the Cargo lockfiles.

Work towards bazel-contrib#4250
Generating console script entry points via Python requires executing a
full Python binary during `py_console_script_gen` actions.

Add `//crates/py_console_script_gen:py_console_script_gen_lib` with an
`entry_points.txt` reader and PEP 503 distribution name normalizer,
register `py_console_script_gen` on `shrubbery`, and wire the rule to
`get_shrubbery_tool`.

Work towards bazel-contrib#4250
Validating `py_test` main files with Python requires an exec Python
toolchain even when only checking for `__main__` or test harness usage.

Add `//crates/py_test_main_validator:py_test_main_validator_lib` built
on `ruff_python_parser`, register `py_test_main_validator` on
`shrubbery`, and route `PyValidateTestMain` through
`get_shrubbery_tool`, skipping the exec runtime requirement when the
Rust tool is active. `get_shrubbery_tool` gains `files_to_run` and
`is_rust` so rules can branch on which implementation resolved.

Work towards bazel-contrib#4250
Copying stamped wheel outputs into a dist directory currently spawns a
Python interpreter per `py_wheel_dist` target.

Add `//crates/py_wheel_dist:py_wheel_dist_lib`, register `py_wheel_dist`
on `shrubbery`, and route `PyWheelDistDir` through `get_shrubbery_tool`.

Work towards bazel-contrib#4250
Extracting wheel files for `whl_filegroup` currently runs a Python
process per target to parse `RECORD` and unpack matching entries.

Add `//crates/extract_wheel_files:extract_wheel_files_lib` using `zip`,
`csv`, and `regex`, register `extract_wheel_files` on `shrubbery`, and
route `PyExtractWheelFiles` through `get_shrubbery_tool`.

Work towards bazel-contrib#4250
Rewriting virtualenv script shebangs uses separate shell and PowerShell
scripts across Unix and Windows hosts.

Add `//crates/venv_shebang_rewriter:venv_shebang_rewriter_lib`, register
`venv_shebang_rewriter` on `shrubbery`, and route `PyVenvRewriteBin`
through `get_shrubbery_tool` with the platform scripts as fallback.

Work towards bazel-contrib#4250
Generating wheel `RECORD` metadata uses separate shell and PowerShell
scripts across Unix and Windows hosts.

Add `//crates/wheel_record_rewriter:wheel_record_rewriter_lib` using
`csv`, register `wheel_record_rewriter` on `shrubbery`, and route
`PyGenWheelRecord` through `get_shrubbery_tool` with the platform
scripts as fallback.

Work towards bazel-contrib#4250
Writing target `build_data.txt` stamps uses separate shell and
PowerShell scripts across Unix and Windows hosts.

Add `//crates/build_data_writer:build_data_writer_lib`, register
`build_data_writer` on `shrubbery`, and route `PyWriteBuildData`
through `get_shrubbery_tool` with the platform scripts as fallback.

Work towards bazel-contrib#4250
Individual unit and analysis tests cover library functions and action
command lines, but do not verify end-to-end Bazel outputs across all
converted build tools together.

Add `//tests/exec_tools_e2e` exercising `py_zipapp_binary`, `py_wheel`,
`py_wheel_dist`, `whl_filegroup`, `py_console_script_binary`, `py_test`
main validation, `venv_rewrite_shebang`, `gen_wheel_record`, and
stamped `build_data.txt` outputs produced by `shrubbery`.

Work towards bazel-contrib#4250
@rickeylev
rickeylev force-pushed the convert_exec_tools_rust branch from ca78423 to 03fe001 Compare November 15, 2026 20:44
@rickeylev

Copy link
Copy Markdown
Owner Author

Superseded by stacked PRs on bazel-contrib/rules_python (branches rickeylev/shrubbery/01-e2e-harness through rickeylev/shrubbery/08-py-test-main-validator); each tool conversion will be reviewed as its own PR there.

This is an automatically generated agent comment.

@rickeylev rickeylev closed this Nov 15, 2026
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.

2 participants