From bffce84a1df38a738038f069d5fcf8b3befc58d2 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Tue, 17 Mar 2026 16:31:34 +0100 Subject: [PATCH 01/11] Add `cargo shear` CI step --- .github/workflows/ci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b99b8a162db..def78ef35ea 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -544,3 +544,17 @@ jobs: run: wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm -- `pwd`/extra_tests/snippets/stdlib_random.py - name: run cpython unittest run: wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm -- `pwd`/Lib/test/test_int.py + + cargo-shear: + name: cargo shear + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - uses: cargo-bins/cargo-binstall@1800853f2578f8c34492ec76154caef8e163fbca # v1.17.7 + + - run: cargo binstall --no-confirm cargo-shear + + - run: cargo shear From 95b009a1a4196f3688c8f03e41f303d7099a2159 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Tue, 17 Mar 2026 16:38:04 +0100 Subject: [PATCH 02/11] Remove some deps --- Cargo.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c62ddaf9e6b..3451ba8caa0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,6 @@ rustpython-compiler = { workspace = true } rustpython-pylib = { workspace = true, optional = true } rustpython-stdlib = { workspace = true, optional = true, features = ["compiler"] } rustpython-vm = { workspace = true, features = ["compiler", "gc"] } -ruff_python_parser = { workspace = true } cfg-if = { workspace = true } log = { workspace = true } @@ -169,7 +168,6 @@ ascii = "1.1" bitflags = "2.11.0" bitflagset = "0.0.3" bstr = "1" -bytes = "1.11.1" cfg-if = "1.0" chrono = { version = "0.4.44", default-features = false, features = ["clock", "oldtime", "std"] } constant_time_eq = "0.4" From 8ddc8bb361c5066a5fdd31007c79f4918ab46fb0 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:26:11 +0100 Subject: [PATCH 03/11] Move `ruff_python_parser` to dev deps --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 3451ba8caa0..7486e77c59b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ rustyline = { workspace = true } criterion = { workspace = true } pyo3 = { version = "0.28.2", features = ["auto-initialize"] } rustpython-stdlib = { workspace = true } +ruff_python_parser = { workspace = true } [[bench]] name = "execution" From 62ec50b9db2afa7f25abfde7a527b316de97c5f4 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:29:17 +0100 Subject: [PATCH 04/11] Remove `thread_local` crate --- Cargo.lock | 10 ---------- Cargo.toml | 1 - crates/vm/Cargo.toml | 1 - 3 files changed, 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e7d738c7c55..de896a6ce37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3424,7 +3424,6 @@ dependencies = [ "strum", "strum_macros", "thiserror 2.0.18", - "thread_local", "timsort", "uname", "unic-ucd-bidi", @@ -3944,15 +3943,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "thread_local" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" -dependencies = [ - "cfg-if", -] - [[package]] name = "time" version = "0.3.47" diff --git a/Cargo.toml b/Cargo.toml index 7486e77c59b..8debf3ca321 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -215,7 +215,6 @@ strum = "0.27" strum_macros = "0.28" syn = "2" thiserror = "2.0" -thread_local = "1.1.9" unicode-casing = "0.1.1" unic-char-property = "0.9.0" unic-normal = "0.9.0" diff --git a/crates/vm/Cargo.toml b/crates/vm/Cargo.toml index 5f7e901b834..8a684c93dd9 100644 --- a/crates/vm/Cargo.toml +++ b/crates/vm/Cargo.toml @@ -72,7 +72,6 @@ static_assertions = { workspace = true } strum = { workspace = true } strum_macros = { workspace = true } thiserror = { workspace = true } -thread_local = { workspace = true } memchr = { workspace = true } caseless = "0.2.2" From 44f9e5de9e34fe2de3c34466b37c1a1429adfd84 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:37:13 +0100 Subject: [PATCH 05/11] Cleanup `num-integer` usage --- crates/vm/src/builtins/int.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/vm/src/builtins/int.rs b/crates/vm/src/builtins/int.rs index e42391acd61..0ae1c6d8654 100644 --- a/crates/vm/src/builtins/int.rs +++ b/crates/vm/src/builtins/int.rs @@ -24,7 +24,7 @@ use core::cell::Cell; use core::ops::{Neg, Not}; use core::ptr::NonNull; use malachite_bigint::{BigInt, Sign}; -use num_integer::Integer; +use num_integer::{ExtendedGcd, Integer}; use num_traits::{One, Pow, PrimInt, Signed, ToPrimitive, Zero}; #[pyclass(module = false, name = "int")] @@ -414,7 +414,6 @@ impl PyInt { if a.is_negative() { a + n } else { a } } fn inverse(a: BigInt, n: &BigInt) -> Option { - use num_integer::*; let ExtendedGcd { gcd, x: c, .. } = a.extended_gcd(n); if gcd.is_one() { Some(normalize(c, n)) From bd2f7644f76087837a6a53cf026b0062f452a1b1 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:42:04 +0100 Subject: [PATCH 06/11] Remove parser fro. wasm --- crates/wasm/Cargo.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/wasm/Cargo.toml b/crates/wasm/Cargo.toml index a2bb1a9f948..596ea707669 100644 --- a/crates/wasm/Cargo.toml +++ b/crates/wasm/Cargo.toml @@ -23,8 +23,6 @@ rustpython-stdlib = { workspace = true, default-features = false, optional = tru # make sure no threading! otherwise wasm build will fail rustpython-vm = { workspace = true, features = ["compiler", "encodings", "serde", "wasmbind"] } -ruff_python_parser = { workspace = true } - serde = { workspace = true } wasm-bindgen = { workspace = true } From 0d74328445e18e975a84812a9e71112f6e41b39c Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:42:22 +0100 Subject: [PATCH 07/11] Remove windows-sys from venv launcher --- crates/venvlauncher/Cargo.toml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/crates/venvlauncher/Cargo.toml b/crates/venvlauncher/Cargo.toml index ac3ea106b7a..c88dc5d356b 100644 --- a/crates/venvlauncher/Cargo.toml +++ b/crates/venvlauncher/Cargo.toml @@ -13,15 +13,5 @@ license.workspace = true name = "venvlaunchert" path = "src/main.rs" -[target.'cfg(windows)'.dependencies] -windows-sys = { workspace = true, features = [ - "Win32_Foundation", - "Win32_System_Threading", - "Win32_System_Environment", - "Win32_Storage_FileSystem", - "Win32_System_Console", - "Win32_Security", -] } - [lints] workspace = true From ce44511fc558d909994fbf4b1e3636d894e2c878 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:42:38 +0100 Subject: [PATCH 08/11] Update lock --- Cargo.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index de896a6ce37..33e97121ba6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3452,7 +3452,6 @@ version = "0.5.0" dependencies = [ "console_error_panic_hook", "js-sys", - "ruff_python_parser", "rustpython-common", "rustpython-pylib", "rustpython-stdlib", From 27478ba663e00ebe4d282ea6f382a1c9f7a6de5f Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:52:17 +0100 Subject: [PATCH 09/11] Resolve more --- Cargo.lock | 7 ------- crates/stdlib/Cargo.toml | 5 ----- crates/wasm/Cargo.toml | 4 +++- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33e97121ba6..b364d43865a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3299,7 +3299,6 @@ dependencies = [ "mt19937", "nix 0.30.1", "num-complex", - "num-integer", "num-traits", "num_enum", "oid-registry", @@ -3342,9 +3341,7 @@ dependencies = [ "unic-ucd-age", "unic-ucd-bidi", "unic-ucd-category", - "unic-ucd-ident", "unicode-bidi-mirroring", - "unicode-casing", "unicode_names2 2.0.0", "uuid", "webpki-roots", @@ -3358,9 +3355,6 @@ dependencies = [ [[package]] name = "rustpython-venvlauncher" version = "0.5.0" -dependencies = [ - "windows-sys 0.61.2", -] [[package]] name = "rustpython-vm" @@ -3452,7 +3446,6 @@ version = "0.5.0" dependencies = [ "console_error_panic_hook", "js-sys", - "rustpython-common", "rustpython-pylib", "rustpython-stdlib", "rustpython-vm", diff --git a/crates/stdlib/Cargo.toml b/crates/stdlib/Cargo.toml index 4942467b586..02f122596f6 100644 --- a/crates/stdlib/Cargo.toml +++ b/crates/stdlib/Cargo.toml @@ -48,7 +48,6 @@ libc = { workspace = true } nix = { workspace = true } num-complex = { workspace = true } malachite-bigint = { workspace = true } -num-integer = { workspace = true } num-traits = { workspace = true } num_enum = { workspace = true } parking_lot = { workspace = true } @@ -78,16 +77,12 @@ constant_time_eq = { workspace = true } ## unicode stuff unicode_names2 = { workspace = true } -# TODO: use unic for this; needed for title case: -# https://github.com/RustPython/RustPython/pull/832#discussion_r275428939 -unicode-casing = { workspace = true } # update version all at the same time unic-char-property = { workspace = true } unic-normal = { workspace = true } unic-ucd-bidi = { workspace = true } unic-ucd-category = { workspace = true } unic-ucd-age = { workspace = true } -unic-ucd-ident = { workspace = true } ucd = "0.1.1" unicode-bidi-mirroring = { workspace = true } diff --git a/crates/wasm/Cargo.toml b/crates/wasm/Cargo.toml index 596ea707669..8d96715f792 100644 --- a/crates/wasm/Cargo.toml +++ b/crates/wasm/Cargo.toml @@ -17,7 +17,6 @@ freeze-stdlib = ["rustpython-vm/freeze-stdlib", "rustpython-pylib/freeze-stdlib" no-start-func = [] [dependencies] -rustpython-common = { workspace = true } rustpython-pylib = { workspace = true, optional = true } rustpython-stdlib = { workspace = true, default-features = false, optional = true } # make sure no threading! otherwise wasm build will fail @@ -46,3 +45,6 @@ wasm-opt = false#["-O1"] [lints] workspace = true + +[package.metadata.cargo-shear] +ignored = ["serde"] From 9598b2588c3ce766e719d233fb964502c6d9f956 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:57:36 +0100 Subject: [PATCH 10/11] Fix wasm --- crates/wasm/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/wasm/Cargo.toml b/crates/wasm/Cargo.toml index 8d96715f792..a285dcabda9 100644 --- a/crates/wasm/Cargo.toml +++ b/crates/wasm/Cargo.toml @@ -17,6 +17,7 @@ freeze-stdlib = ["rustpython-vm/freeze-stdlib", "rustpython-pylib/freeze-stdlib" no-start-func = [] [dependencies] +rustpython-common = { workspace = true } rustpython-pylib = { workspace = true, optional = true } rustpython-stdlib = { workspace = true, default-features = false, optional = true } # make sure no threading! otherwise wasm build will fail @@ -47,4 +48,4 @@ wasm-opt = false#["-O1"] workspace = true [package.metadata.cargo-shear] -ignored = ["serde"] +ignored = ["serde", "rustpython-common"] From 4670a03ec428b8db3398aa04a644e643db629419 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 16:07:55 +0100 Subject: [PATCH 11/11] Update lock --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index b364d43865a..532cb7204b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3446,6 +3446,7 @@ version = "0.5.0" dependencies = [ "console_error_panic_hook", "js-sys", + "rustpython-common", "rustpython-pylib", "rustpython-stdlib", "rustpython-vm",