219 properly handle other ruff configuration files#398
219 properly handle other ruff configuration files#398nathanjmcdougall merged 33 commits intomainfrom
Conversation
Rename `PyProject` -> `Pyproject` for consistency
… more generalized
CodSpeed Performance ReportMerging #398 will not alter performanceComparing Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #398 +/- ##
==========================================
+ Coverage 98.15% 98.39% +0.23%
==========================================
Files 72 69 -3
Lines 3095 3113 +18
==========================================
+ Hits 3038 3063 +25
+ Misses 57 50 -7 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the handling of TOML configuration files by introducing a new context manager (files_manager) to consolidate access to various TOML managers and by removing legacy pyproject.toml helper modules. Key changes include:
- Introducing files_manager in src/usethis/_config_file.py and corresponding classes (DotRuffTOMLManager and RuffTOMLManager) for managing TOML files.
- Replacing all direct usages of PyprojectTOMLManager with files_manager across modules, tests, and CLI interfaces.
- Removing legacy modules (e.g. the pyproject_toml core and Ruff rules helpers) that are no longer required.
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/usethis/_config_file.py | Adds a new files_manager context manager and TOML manager classes for handling .ruff.toml and ruff.toml. |
| src/usethis/integrations/file/toml/io.py | Refactors the base TOML file manager to use a unified property (self.path) and adds extra helper methods. |
| tests/usethis/_core/test_core_ci.py | Replaces direct PyprojectTOMLManager usage with files_manager in tests. |
| Various files under src/usethis/_interface/ | Updates CLI command context managers to use files_manager instead of PyprojectTOMLManager. |
| Other integration files (sonarqube, uv, deps, etc.) | Update accesses to TOML configuration values using the new files_manager and remove legacy code. |
| pyproject.toml | Updates layers and module lists to reflect the removal of legacy components. |
Comments suppressed due to low confidence (1)
src/usethis/_config_file.py:15
- [nitpick] The files_manager context manager yields nothing, which may be confusing for consumers expecting to work with an instance or a composite manager. Consider yielding a meaningful composite object (or documenting that it serves only to initialize multiple managers) to clarify its intended use.
def files_manager() -> Iterator[None]:
Lots of TODOs still to go but it's time to see how performance is affected.