◐ Shell
clean mode source ↗

Improve deps output by youknowone · Pull Request #6874 · RustPython/RustPython

📝 Walkthrough

Walkthrough

This pull request refactors the scripts/update_lib module structure by consolidating utilities from separate modules (path.py, io_utils.py) into a new comprehensive file_utils.py, renaming command modules to use cmd_ prefixes, and updating all imports and function calls accordingly. The function test_name_from_path is renamed to get_test_module_name across the codebase.

Changes

Cohort / File(s) Summary
Module consolidation and removal
scripts/update_lib/file_utils.py
New module aggregating utilities from path.py and io_utils.py; adds 289 lines of safe file I/O, AST parsing, path utilities, comparison helpers, module/test name resolution, and CPython-to-local path conversions.
Removed utility modules
scripts/update_lib/path.py, scripts/update_lib/io_utils.py
Deleted modules; functionality moved to file_utils.py. Path parsing, lib/test conversions, module resolution, and safe I/O helpers consolidated.
Command module renames in main entry point
scripts/update_lib/__main__.py
Updates import paths from update_lib.* to update_lib.cmd_* for all subcommands (quick, copy-lib, migrate, patches, auto-mark, deps, todo); changes local alias names for auto-mark, deps, todo correspondingly.
Import path updates across cmd modules
scripts/update_lib/cmd_quick.py, scripts/update_lib/cmd_copy_lib.py, scripts/update_lib/cmd_migrate.py
Relocate imports of parse_lib_path and related utilities from update_lib.path/update_lib.io_utils to update_lib.file_utils; add imports of get_cpython_dir and remove local implementations.
Function name updates
scripts/update_lib/cmd_auto_mark.py
Replace test_name_from_path calls with get_test_module_name; update import source from update_lib.path to update_lib.file_utils.
Enhanced test/lib display logic
scripts/update_lib/cmd_deps.py
Expand imports to include count_test_todos, is_path_synced, is_test_up_to_date; update output formatting to display sync status, up-to-date status, and TODO counts for libs and tests.
Dependency utilities refactor
scripts/update_lib/deps.py
Add new parsing utilities (parse_test_imports, parse_lib_imports), TODO marker handling, test path resolution helpers (is_test_tracked, is_test_up_to_date, count_test_todos), and path synchronization logic (is_path_synced); consolidate comparison logic into compare_paths.
TODO subcommand refactor
scripts/update_lib/cmd_todo.py
Replace internal utilities with imports from update_lib.deps; remove locally-defined test-tracking/TODO-filtering functions; simplify to rely on imported modules for module listing and test status checks.
Test file updates
scripts/update_lib/tests/test_*.py
Update imports across all test files to reference new module paths (cmd_auto_mark, cmd_copy_lib, cmd_migrate, cmd_quick) and new function names (get_test_module_name, lib_to_test_path).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • moreal
  • ShaharNaveh

Poem

Hop, hop! The paths and files now unite,
From io_utils and path.py, a consolidation bright!
Into file_utils they gather with care,
Commands renamed with "cmd_" flair,
Cleaner imports, a modular delight! 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Improve deps output' is vague and generic. It uses a non-descriptive term 'Improve' without clarifying what specific improvements were made to the deps command or its output format. Consider a more specific title that captures the main change, such as 'Add sync status and TODO counts to deps output' or 'Refactor deps command with status markers and utilities extraction'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 96.88% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.