◐ Shell
clean mode source ↗

Move `pylib` -> `crates/pylib` by ShaharNaveh · Pull Request #6225 · RustPython/RustPython

Walkthrough

The pull request moves the pylib crate into a crates/ subdirectory, updates workspace members and dependency paths in Cargo.toml files, adjusts library path files, and refactors crates/pylib/build.rs to use a CRATE_ROOT constant for path construction and adds processing for vm/Lib/core_modules/*.

Changes

Cohort / File(s) Summary
Workspace configuration
Cargo.toml, example_projects/frozen_stdlib/Cargo.toml
Replaced workspace member "pylib" with "crates/*"; updated rustpython-pylib dependency path from pylib (or ../../pylib) to crates/pylib (or ../../crates/pylib).
Build script refactor
crates/pylib/build.rs
Added CRATE_ROOT constant and replaced direct relative paths with format!("{CRATE_ROOT}/...") calls; added processing of vm/Lib/core_modules/*; updated Windows branch to use {CRATE_ROOT}/Lib/**/*.
Library path files
pylib/Lib, crates/pylib/Lib
Removed the previous content from top-level pylib/Lib; added a ../../Lib/ reference in crates/pylib/Lib to point to relocated library sources.

Sequence Diagram(s)

sequenceDiagram
    participant Build as build.rs
    participant FS as Filesystem
    Note over Build,FS `#dfefff`: CRATE_ROOT-based path resolution
    Build->>Build: set CRATE_ROOT = "../.."
    alt Non-Windows
        Build->>FS: process_python_libs("./Lib/**/*")
    else Windows
        Build->>FS: process_python_libs("{CRATE_ROOT}/Lib/**/*")
    end
    Build->>FS: process_python_libs("{CRATE_ROOT}/vm/Lib/python_builtins/*")
    Build->>FS: process_python_libs("{CRATE_ROOT}/vm/Lib/core_modules/*")
    Note over FS: files read / assets bundled
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to CRATE_ROOT value and its correctness across platforms.
  • Verify all updated dependency paths in example projects and workspace manifest.
  • Confirm crates/pylib/Lib relative reference resolves to expected files during build.

Poem

🐰
Hop to crates, with nimble feet,
Paths retied and build scripts neat,
CRATE_ROOT guides each wandering file,
I nibble changes—quick rabbit style! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: relocating the pylib directory from the root to crates/pylib across workspace configuration and related build files.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdbeccb and a3c670b.

📒 Files selected for processing (1)
  • example_projects/frozen_stdlib/Cargo.toml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-28T22:22:55.921Z
Learnt from: reactive-firewall
Repo: RustPython/RustPython PR: 6176
File: .github/workflows/Check_Tests.yml:133-141
Timestamp: 2025-09-28T22:22:55.921Z
Learning: In the RustPython project's CI-5974-Test-RustPython-Integration action, the override-rustpython-path input is marked as required but has runtime fallback logic that defaults to RUSTPYTHONPATH environment variable or "Lib" if neither is provided, making explicit specification unnecessary in most cases.

Applied to files:

  • example_projects/frozen_stdlib/Cargo.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Check the WASM package and demo
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Ensure compilation on various targets
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Check Rust code with clippy
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Run snippets and cpython tests on wasm-wasi
  • GitHub Check: auto_format
🔇 Additional comments (1)
example_projects/frozen_stdlib/Cargo.toml (1)

9-9: ✓ Path correctly updated for workspace restructuring.

The dependency path now correctly points to ../../crates/pylib to reflect the new directory structure after moving pylib under the crates/ subdirectory. The features and configuration remain unchanged, which is correct.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.