Conversation
rustpython-host-env and move shared host abstractions out of rustpython-common
|
@copilot check CI failures |
Checked. I fixed the actionable CI failure in ed55155 by removing the unused |
ed55155 to
7852ece
Compare
|
@copilot confirmed, run also phase 2 and 4 |
Done in 468d21e. I added a small Phase 2/4 extraction slice into |
rustpython-host-env and move shared host abstractions out of rustpython-commonrustpython-host-env, move shared host abstractions out of rustpython-common, and extract initial Phase 2/4 host helpers
|
@copilot check CI failures. and no small phase 2/4 extraction. you must do full extraction. |
Done in 296cfb9. I checked the CI failures first: the actionable breakage on the previous head was the partial extraction causing wasm jobs to fail ( |
rustpython-host-env, move shared host abstractions out of rustpython-common, and extract initial Phase 2/4 host helpersrustpython-host-env, move shared host abstractions out of rustpython-common, and expand Phase 2/4 host extraction
|
@copilot check CI failures and rebase to main. and no small phase 2/4 extraction. you must do full extraction. |
Done in 3292b9f. I checked the current CI failures first: the actionable regressions from this PR were the cross-target host_env issues (Android/musl |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: (module 'dis test_yield_from' not found) Legend:
|
a020ed2 to
9707aeb
Compare
|
@copilot check CI failures. and no small phase 2/4 extraction. you must do full extraction. |
youknowone
left a comment
There was a problem hiding this comment.
@copilot also fix CI failures
| } | ||
| } | ||
|
|
||
| pub fn open(path: impl AsRef<Path>) -> io::Result<File> { |
There was a problem hiding this comment.
fileutils.rs is a counterpart of fileutils.c. these funcitons are not fileutils. Create a new file crates/host_env/src/fs.rs.
There was a problem hiding this comment.
Done in 9b606c9. The generic filesystem helpers were moved into the new crates/host_env/src/fs.rs, and the extracted VM/stdlib call sites now use rustpython_host_env::fs while fileutils.rs stays focused on the fileutils.c counterpart surface.
Handled in 9b606c9. I fixed the actionable branch regressions from the latest CI logs as part of the follow-up: the wasm-oriented |
|
@copilot Fix CI failures |
|
@copilot fix CI failure. |
Move os, crt_fd, fileutils, windows, macros modules from
rustpython-common into the new rustpython-host-env crate.
This isolates host OS API wrappers behind a crate boundary
with zero Python runtime dependency.
- Add crates/host_env to workspace
- Drop nix, windows-sys, widestring deps from common
- Wire vm and stdlib to depend on rustpython-host-env
- Migrate all imports from common::{os,crt_fd,fileutils,windows}
to rustpython_host_env::
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/48d1e64d-37ce-409f-b511-8e61a349665c Co-authored-by: youknowone <[email protected]>
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/97225fb7-7b3d-4197-a77c-eb44aead5b13 Co-authored-by: youknowone <[email protected]>
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/d96f57e1-b196-4460-9983-97d5ff118835 Co-authored-by: youknowone <[email protected]>
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/d96f57e1-b196-4460-9983-97d5ff118835 Co-authored-by: youknowone <[email protected]>
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/d96f57e1-b196-4460-9983-97d5ff118835 Co-authored-by: youknowone <[email protected]>
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/c57424c5-0e1d-490a-82b3-2d2f6c8cf2cd Co-authored-by: youknowone <[email protected]>
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/899eb717-ebc6-4a4a-870c-2a15c5f33e02 Co-authored-by: youknowone <[email protected]>
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/12f32740-8173-4b10-a1d6-00b29e90a8ec Co-authored-by: youknowone <[email protected]>
4e23827 to
f5f55e1
Compare
f5f55e1 to
dd650c5
Compare
This change starts the
host_envisolation plan by moving the shared OS-facing helpers out ofrustpython-commoninto a dedicatedrustpython-host-envcrate. The goal is to make host access explicit in crate dependencies and reduce accidental leakage of host-only code into sandbox-oriented builds.New
rustpython-host-envcratecrates/host_envto the workspacerustpython-host-envas the home for shared host abstractions with no Python runtime dependencyoscrt_fdfileutilsfswindowsmacrosMoved host-specific shared code out of
rustpython-commoncrates/common/src/intocrates/host_env/src/rustpython-commonnix,windows-sys, andwidestringfromrustpython-commonnow that those dependencies belong to the new host crateDependency graph updated
rustpython-host-envto workspace dependenciesrustpython-vmandrustpython-stdlibto depend onrustpython-host-envrustpython-vmasvm::host_envfor internal/external consumersImport migration in VM / stdlib / top-level consumers
rustpython_common::{os, crt_fd, fileutils, windows, suppress_iph}withrustpython_host_env(orcrate::host_env/vm::host_envwhere appropriate)Expanded Phase 2 / Phase 4 extraction into
rustpython-host-envrustpython-host-envbeyond the sharedcommonmoveposixsignaltimeshmselectsyslogtermiosfcntlmsvcrtntwinapirustpython-host-envtimehelpers no longer break non-unix/non-windows buildsAdded Phase 5 lint enforcement for host access
clippy.tomlconfiguration forrustpython-common,rustpython-vm, andrustpython-stdlib#![deny(clippy::disallowed_methods)]in those three cratesstd::fs,std::env,std::process, andstd::nethost APIs outsiderustpython-host-envrustpython-host-envexempt via its own local Clippy configFollow-up extraction and gating from review feedback
host_env-only gatingrustpython-host-envwith generic helpers for:fsmodule (open,read,read_to_string,read_dir,create_dir_all,remove_dir,remove_file,metadata,symlink_metadata,open_write)os(current_dir,temp_dir,var,var_os,vars_os,set_var,remove_var,set_current_dir,process_id,exit)posix::get_number_of_os_threads)fileutils.rsfocused on thefileutils.ccounterpart surface while moving the generic filesystem helpers into the newcrates/host_env/src/fs.rssys.__breakpointhook__environment lookupos/posixfilesystem and environment helpershost_envwhere appropriate instead of leaving direct host calls available in non-host_envbuildsCI follow-up fixes tied to the extraction work
rustpython-common::refcount_overflow()path so it no longer relies onlibc::abort()on wasm targetsvm::stdlib::osto use the extracted host_env wrapperExample of the migration pattern:
This keeps the behavioral surface unchanged while making host-environment coupling explicit at the crate boundary, which is the foundation for tighter sandbox enforcement in follow-up work.