Skip to content

Add cargo shear CI step#7461

Merged
youknowone merged 13 commits intoRustPython:mainfrom
ShaharNaveh:ci-cargo-shear
Mar 20, 2026
Merged

Add cargo shear CI step#7461
youknowone merged 13 commits intoRustPython:mainfrom
ShaharNaveh:ci-cargo-shear

Conversation

@ShaharNaveh
Copy link
Contributor

@ShaharNaveh ShaharNaveh commented Mar 17, 2026

Summary by CodeRabbit

  • Chores
    • Added automated dependency auditing to continuous integration to detect and report unused dependencies.
    • Cleaned up unused dependencies across the codebase.
    • Improved import clarity and removed redundant dependency references.

@ShaharNaveh ShaharNaveh added the skip:ci Skip running the ci label Mar 17, 2026
@ShaharNaveh ShaharNaveh changed the title Add cargo shear CI step Add cargo shear CI step Mar 17, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This pull request removes unused dependencies from the project and adds a cargo-shear CI job to detect them automatically. Dependencies are removed from the root Cargo.toml, crates/stdlib/Cargo.toml, crates/venvlauncher/Cargo.toml, crates/vm/Cargo.toml, and crates/wasm/Cargo.toml. An import in int.rs is updated to be more explicit. A cargo-shear configuration is added to the wasm crate manifest.

Changes

Cohort / File(s) Summary
CI Configuration
.github/workflows/ci.yaml
Added new cargo-shear CI job that installs the binary and runs it to detect unused dependencies.
Dependency Cleanup
Cargo.toml, crates/stdlib/Cargo.toml, crates/venvlauncher/Cargo.toml, crates/vm/Cargo.toml, crates/wasm/Cargo.toml
Removed unused workspace dependencies (ruff_python_parser, bytes, thread_local, num-integer, unicode-casing, unic-ucd-ident, windows-sys). Added cargo-shear metadata configuration to wasm crate to ignore certain packages from analysis.
Import Refactoring
crates/vm/src/builtins/int.rs
Made ExtendedGcd import explicit in the module-level imports instead of using a local glob import within the function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • youknowone
  • moreal

Poem

🐰 Unused crates we bid farewell, dependencies now lean,
Cargo-shear keeps watch with CI's keen eye so keen,
Imports stand explicit, no glob imports to hide,
The code is cleaner now, running lean and wide! 📦✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add cargo shear CI step' directly and accurately describes the primary change: introduction of a new CI job that runs cargo shear in the GitHub Actions workflow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@fanninpm
Copy link
Contributor

Error: unused dependency rustpython-common (remove this dependency)

@ShaharNaveh ShaharNaveh removed the skip:ci Skip running the ci label Mar 19, 2026
@ShaharNaveh ShaharNaveh marked this pull request as ready for review March 19, 2026 16:32
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)

561-573: Consider adding skip:ci label check for consistency.

Other jobs in this workflow (e.g., rust_tests, cargo_check, miri, wasm, wasm-wasi) include the condition if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} to allow skipping CI. This job lacks that condition.

🔧 Optional: Add skip condition
   cargo-shear:
+    if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
     name: cargo shear
     runs-on: ubuntu-latest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 561 - 573, The cargo-shear job is
missing the skip-PR-label condition used elsewhere; update the job definition
for cargo-shear to include the same if condition (if: ${{
!contains(github.event.pull_request.labels.*.name, 'skip:ci') }}) so the job is
skipped when a pull request has the 'skip:ci' label—apply this change to the job
named cargo-shear to match rust_tests/cargo_check/miri/wasm/wasm-wasi behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/ci.yaml:
- Around line 561-573: The cargo-shear job is missing the skip-PR-label
condition used elsewhere; update the job definition for cargo-shear to include
the same if condition (if: ${{
!contains(github.event.pull_request.labels.*.name, 'skip:ci') }}) so the job is
skipped when a pull request has the 'skip:ci' label—apply this change to the job
named cargo-shear to match rust_tests/cargo_check/miri/wasm/wasm-wasi behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 953b11b2-2993-491f-861f-33bae8e21d2f

📥 Commits

Reviewing files that changed from the base of the PR and between 53fa525 and 4670a03.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .github/workflows/ci.yaml
  • Cargo.toml
  • crates/stdlib/Cargo.toml
  • crates/venvlauncher/Cargo.toml
  • crates/vm/Cargo.toml
  • crates/vm/src/builtins/int.rs
  • crates/wasm/Cargo.toml
💤 Files with no reviewable changes (3)
  • crates/vm/Cargo.toml
  • crates/stdlib/Cargo.toml
  • crates/venvlauncher/Cargo.toml

Copy link
Contributor

@fanninpm fanninpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any dependencies are removed, would it be a good idea to review the contents of .github/dependabot.yml to see if that needs to be trimmed?

@youknowone youknowone merged commit 68cf736 into RustPython:main Mar 20, 2026
16 checks passed
@ShaharNaveh
Copy link
Contributor Author

If any dependencies are removed, would it be a good idea to review the contents of .github/dependabot.yml to see if that needs to be trimmed?

No remove deps appear in dependeabot groups:)

@fanninpm
Copy link
Contributor

If any dependencies are removed, would it be a good idea to review the contents of .github/dependabot.yml to see if that needs to be trimmed?

No remove deps appear in dependeabot groups:)

I forgot to specify that my inquiry would apply to the future, as well as now.

youknowone pushed a commit to youknowone/RustPython that referenced this pull request Mar 22, 2026
* Add `cargo shear` CI step

* Remove some deps

* Move `ruff_python_parser` to dev deps

* Remove `thread_local` crate

* Cleanup `num-integer` usage

* Remove parser fro. wasm

* Remove windows-sys from venv launcher

* Update lock

* Resolve more

* Fix wasm

* Update lock
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.

3 participants