Skip to content

Resolve cargo-shear warnings#8031

Open
ShaharNaveh wants to merge 5 commits into
RustPython:mainfrom
ShaharNaveh:cargo-shear-comments
Open

Resolve cargo-shear warnings#8031
ShaharNaveh wants to merge 5 commits into
RustPython:mainfrom
ShaharNaveh:cargo-shear-comments

Conversation

@ShaharNaveh
Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh commented Jun 3, 2026

Summary

Summary by CodeRabbit

  • Removals

    • Disabled the optional Tkinter graphical UI and its platform-specific components.
  • Chores

    • Moved a TLS backend to development-only usage and reorganized optional dependency handling.
    • Disabled several platform verifier and certificate-related workspace dependencies.
    • Simplified and normalized feature-flag declarations for standard library and codegen.
    • Ensured an unused runtime module is explicitly excluded from builds.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 6a82f998-6bee-4457-964c-b1b2e5eb4536

📥 Commits

Reviewing files that changed from the base of the PR and between f82c038 and c94eeb8.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml
  • crates/stdlib/Cargo.toml

📝 Walkthrough

Walkthrough

Workspace TLS and Tk/Tcl workspace dependencies are disabled and rustls-graviola is moved to dev-dependencies; crates/stdlib and crates/codegen update feature lists and dependency entries accordingly, and crates/stdlib/src/lib.rs adds an explicit #[cfg(false)] module guard.

Changes

Feature and Dependency Cleanup

Layer / File(s) Summary
Workspace dependency disabling and dev-dependency reorganization
Cargo.toml
Removed optional rustls-graviola from root [dependencies], added it under [dev-dependencies], and commented out workspace rustls-platform-verifier, tcl-sys, and x509-cert.
stdlib feature and dependency adjustments
crates/stdlib/Cargo.toml
Reformatted tkinter and __ssl-rustls features to multiline arrays, disabled dep:tcl-sys in the tkinter feature, commented out tcl-sys, rustls-platform-verifier, and x509-cert dependencies, and normalized chrono = { workspace = true }.
codegen std feature simplification
crates/codegen/Cargo.toml
Reformatted the std feature to multiline, left "thiserror/std" enabled and commented out itertools/use_std, and commented out the itertools dependency in [dependencies].
Module compilation guard formalization
crates/stdlib/src/lib.rs
Replaced a commented-out mod re; with #[cfg(false)] mod re; to ensure the module is excluded from all builds.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • RustPython/RustPython#7747: Touches the same Cargo dependencies for Tk/Tcl and Rustls certificate verification (tcl-sys, tk-sys, x509-cert, rustls-platform-verifier).
  • RustPython/RustPython#7733: Related changes to TLS backend wiring that affect SSL-enabled vs SSL-disabled CI/testing paths.

Suggested reviewers

  • fanninpm

Poem

🐰 I trimmed the crates and tucked them neat,
Comments hush TLS and Tcl at my feet,
rustls-graviola naps in dev-only space,
#[cfg(false)] keeps re in a quiet place,
A tidy workspace makes the tree more sweet. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Resolve cargo-shear warnings' is directly related to the main changes in the changeset, which involve commenting out unused dependencies and adjusting feature flags to address tool warnings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@ShaharNaveh ShaharNaveh marked this pull request as ready for review June 3, 2026 14:07
Copy link
Copy Markdown
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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Cargo.toml`:
- Line 64: The example `custom_tls_providers` is gated on a non-existent feature
name `rustls-graviola` because `rustls-graviola` is only in dev-dependencies and
not declared as an optional dependency/feature; fix by either moving
`rustls-graviola` from `[dev-dependencies]` into `[dependencies]` with `optional
= true` so Cargo creates a `rustls-graviola` feature, or remove
`"rustls-graviola"` from the example's `required-features` and instead gate
`custom_tls_providers` on one of the existing declared features (e.g.,
`rustls/ring`, `ssl-rustls`) in Cargo.toml; update the `[[example]]
custom_tls_providers` stanza and the dependency declaration for
`rustls-graviola` accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 10cfb8ab-63e2-4e33-a992-ebfb19c41e81

📥 Commits

Reviewing files that changed from the base of the PR and between c5f555e and f82c038.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • crates/codegen/Cargo.toml
  • crates/stdlib/Cargo.toml
  • crates/stdlib/src/lib.rs

Comment thread Cargo.toml
pyo3 = { workspace = true, features = ["auto-initialize"] }
rustpython-stdlib = { workspace = true }
ruff_python_parser = { workspace = true }
rustls-graviola = { workspace = true }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the example exists and check its feature requirements
fd -t f 'custom_tls_providers.rs' examples
echo "---"
# Check if rustls-graviola is referenced anywhere else as a feature
rg -n 'rustls-graviola' --type toml

Repository: RustPython/RustPython

Length of output: 308


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== custom_tls_providers entry in Cargo.toml =="
rg -n 'custom_tls_providers' Cargo.toml

echo "== Cargo.toml lines 1-140 =="
nl -ba Cargo.toml | sed -n '1,160p'

echo "== Cargo.toml lines 240-360 =="
nl -ba Cargo.toml | sed -n '240,360p'

echo "== Cargo.toml features section =="
rg -n '^\[features\]' -n Cargo.toml
start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
# print from features start to next section
awk -v s="$start" 'NR>=s {print NR ":" $0}' Cargo.toml | head -n 200

Repository: RustPython/RustPython

Length of output: 280


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== custom_tls_providers entry in Cargo.toml =="
rg -n 'custom_tls_providers' Cargo.toml

echo "== Cargo.toml lines 1-160 =="
nl -ba Cargo.toml | sed -n '1,200p'

echo "== Cargo.toml lines 240-420 =="
nl -ba Cargo.toml | sed -n '240,420p'

echo "== Features section =="
rg -n '^\[features\]' Cargo.toml || true

Repository: RustPython/RustPython

Length of output: 280


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# show the features table fully if present
if rg -q '^\[features\]' Cargo.toml; then
  start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
  end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR; exit}' Cargo.toml || true)
  if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
  echo "== Cargo.toml features block (lines $start-$end) =="
  nl -ba Cargo.toml | sed -n "${start},${end}p"
fi

Repository: RustPython/RustPython

Length of output: 172


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== custom_tls_providers entry in Cargo.toml =="
rg -n 'custom_tls_providers' Cargo.toml

echo
echo "== Cargo.toml lines 50-130 =="
nl -ba Cargo.toml | sed -n '50,140p'

echo
echo "== Cargo.toml lines 260-360 =="
nl -ba Cargo.toml | sed -n '260,360p'

echo
echo "== Cargo.toml features block =="
if rg -q '^\[features\]' Cargo.toml; then
  start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
  end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR-1; exit}' Cargo.toml || true)
  if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
  nl -ba Cargo.toml | sed -n "${start},${end}p"
else
  echo "No [features] section in Cargo.toml"
fi

echo
echo "== Dependencies/dev-dependencies around rustls-graviola =="
rg -n 'rustls-graviola' Cargo.toml

Repository: RustPython/RustPython

Length of output: 282


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the example block for custom_tls_providers and print nearby lines
ex_line=$(rg -n 'name\s*=\s*"custom_tls_providers"' Cargo.toml | head -n1 | cut -d: -f1)
echo "== custom_tls_providers [[example]] block around line $ex_line =="
start=$((ex_line-15)); end=$((ex_line+40))
sed -n "${start},${end}p" Cargo.toml

echo
echo "== rustls-graviola lines in Cargo.toml (with context) =="
rg -n 'rustls-graviola\s*=\s*' Cargo.toml

echo "--- context around each rustls-graviola match ---"
while IFS=: read -r ln _; do
  echo "## rustls-graviola context at Cargo.toml:$ln"
  sed -n "$((ln-5)),$((ln+10))p" Cargo.toml
done < <(rg -n 'rustls-graviola\s*=\s*' Cargo.toml)

echo
echo "== Search for optional = true near rustls-graviola =="
rg -n 'optional\s*=\s*true' Cargo.toml || true
rg -n 'rustls-graviola.*optional' Cargo.toml || true

echo
echo "== Dependency section headers (dependencies/dev-dependencies) =="
rg -n '^\[(dependencies|dev-dependencies|features)\]' Cargo.toml || true

echo
echo "== [features] block (if present) =="
if rg -q '^\[features\]' Cargo.toml; then
  start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
  end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR-1; exit}' Cargo.toml || true)
  if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
  sed -n "${start},${end}p" Cargo.toml
else
  echo "No [features] section in Cargo.toml"
fi

Repository: RustPython/RustPython

Length of output: 1457


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Show Cargo.toml around line 40-110 =="
sed -n '40,110p' Cargo.toml

echo
echo "== Show Cargo.toml around line 260-320 =="
sed -n '260,320p' Cargo.toml

echo
echo "== Find which section rustls-graviola line 64 is in (dependencies/dev-dependencies) =="
# Print the nearest preceding section header for line 64
line=64
sed -n "${line}p" Cargo.toml
echo "Preceding section headers:"
awk -v target="$line" '
  NR<=target && $0 ~ /^\[(dependencies|dev-dependencies|features)\]/ {
    last=NR ":" $0
  }
  END { print last }
' Cargo.toml

echo
echo "== Find section header for rustls-graviola line 289 =="
line=289
sed -n "${line}p" Cargo.toml
echo "Preceding section headers:"
awk -v target="$line" '
  NR<=target && $0 ~ /^\[(dependencies|dev-dependencies|features|workspace\.dependencies)\]/ {
    last=NR ":" $0
  }
  END { print last }
' Cargo.toml

echo
echo "== Does Cargo.toml define [features] ? =="
if rg -q '^\[features\]' Cargo.toml; then
  start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
  end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR-1; exit}' Cargo.toml || true)
  if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
  echo "Features block lines $start-$end"
  sed -n "${start},${end}p" Cargo.toml
else
  echo "No [features] section in Cargo.toml"
fi

echo
echo "== Search for optional=true and explicit feature mappings for rustls-graviola =="
rg -n 'rustls-graviola' Cargo.toml
rg -n 'optional\s*=\s*true' Cargo.toml || true
rg -n '^\s*rustls-graviola\s*=' Cargo.toml || true
rg -n '\brustls-graviola\b' Cargo.toml | head -n 50

Repository: RustPython/RustPython

Length of output: 5658


Fix example gating: custom_tls_providers requires a feature that no longer exists

[[example]] custom_tls_providers sets required-features = ["rustls-graviola", ...], but rustls-graviola is only declared under [dev-dependencies] and there is no [features] entry for rustls-graviola (and it is not optional = true), so Cargo will treat "rustls-graviola" as an unknown feature and fail to build the example.

Options:

  1. Move rustls-graviola to [dependencies] as optional = true (so the rustls-graviola feature exists), or
  2. Remove "rustls-graviola" from required-features and gate the example via existing features (e.g., rustls/ring, ssl-rustls, etc.).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Cargo.toml` at line 64, The example `custom_tls_providers` is gated on a
non-existent feature name `rustls-graviola` because `rustls-graviola` is only in
dev-dependencies and not declared as an optional dependency/feature; fix by
either moving `rustls-graviola` from `[dev-dependencies]` into `[dependencies]`
with `optional = true` so Cargo creates a `rustls-graviola` feature, or remove
`"rustls-graviola"` from the example's `required-features` and instead gate
`custom_tls_providers` on one of the existing declared features (e.g.,
`rustls/ring`, `ssl-rustls`) in Cargo.toml; update the `[[example]]
custom_tls_providers` stanza and the dependency declaration for
`rustls-graviola` accordingly.

Comment thread crates/stdlib/Cargo.toml Outdated
ssl-openssl = ["ssl", "openssl", "openssl-sys", "foreign-types-shared", "openssl-probe"]
ssl-openssl-vendor = ["ssl-openssl", "openssl/vendored"]
tkinter = ["dep:tk-sys", "dep:tcl-sys", "dep:widestring"]
# TODO: Fix tkinter
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it broken now?

Copy link
Copy Markdown
Contributor Author

@ShaharNaveh ShaharNaveh Jun 3, 2026

Choose a reason for hiding this comment

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

We aren't checking it on the CI, I was assuming so.
Enabling this on the CI will require a lot more effort I believe

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we don't need to break local build due to lack of CI support. (though probably it is already broken)
if dependencies are being used out of CI context, we'd better to the build to CI rather then explicitly breaking it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll revert this part.


The issue with keeping a broken build is that we are still "paying" for the dependencies it brings, even if it's unused. The Cargo.lock will contain those unused dependencies.

Essentially we are getting more deps, without using them:/

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