Title: Split `usethis._tool.impl` into `impl/spec` and `impl/base` submodules by Copilot · Pull Request #1373 · usethis-python/usethis-python · GitHub
Open Graph Title: Split `usethis._tool.impl` into `impl/spec` and `impl/base` submodules by Copilot · Pull Request #1373 · usethis-python/usethis-python
X Title: Split `usethis._tool.impl` into `impl/spec` and `impl/base` submodules by Copilot · Pull Request #1373 · usethis-python/usethis-python
Description: The flat usethis._tool.impl module mixed ToolSpec subclasses (declarative metadata) and Tool subclasses (runtime behaviour) in the same files. This splits them into parallel submodule structures to separate concerns.
Structure
Each tool now has two dedicated modules:
usethis._tool.impl.spec.* — ToolSpec subclasses: meta, dev_deps, pre_commit_config, preferred_file_manager, etc.
usethis._tool.impl.base.* — Tool subclasses: config_spec, print_how_to_use, get_bitbucket_steps, selected_rules, etc.
src/usethis/_tool/impl/
├── spec/
│ ├── codespell.py # CodespellToolSpec
│ ├── ruff.py # RuffToolSpec
│ └── ...
└── base/
├── codespell.py # CodespellTool
├── ruff.py # RuffTool
└── ...
The test directory mirrors the src structure:
tests/usethis/_tool/impl/
└── base/
├── test_codespell.py
├── test_ruff.py
└── ...
Notable decisions
test_deps() moved to base/ for pytest and coverage_py: these methods call .is_used() on sibling Tool instances, making them runtime behaviour rather than declarative spec. Moving them to base/ eliminates the spec → base import cycle and enforces the clean base → spec dependency direction.
Import-linter contracts updated: the old tool_impl contract is replaced with three — tool_impl (base above spec), tool_impl_base, and tool_impl_spec — each with the same internal layer ordering as before.
All external consumers (_core/, _tool/all_.py, _toolset/, _ui/, tests) updated to the new paths.
Test suite restructured: all tests/usethis/_tool/impl/test_*.py files moved to tests/usethis/_tool/impl/base/ to match the src layout.
Original prompt
This section details on the original issue you should resolve
Open Graph Description: The flat usethis._tool.impl module mixed ToolSpec subclasses (declarative metadata) and Tool subclasses (runtime behaviour) in the same files. This splits them into parallel submodule structures to...
X Description: The flat usethis._tool.impl module mixed ToolSpec subclasses (declarative metadata) and Tool subclasses (runtime behaviour) in the same files. This splits them into parallel submodule structures to...
Opengraph URL: https://github.com/usethis-python/usethis-python/pull/1373
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:690f5a5d-9887-9b26-9603-74d4f3f00736 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DB58:F61E5:F34FEF:15037D1:6A4DD17D |
| html-safe-nonce | 46db63a089a4c200b8de3715a9adabe0ba14b6591972da19136bf2a23d8eb381 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjU4OkY2MUU1OkYzNEZFRjoxNTAzN0QxOjZBNEREMTdEIiwidmlzaXRvcl9pZCI6Ijc3NzY5MzMxNjkxMDI0NDI4NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 320e6debfe3b57f8b9a0146206fbd5d3363fc08c58d1c03bf6225cb41954dbab |
| hovercard-subject-tag | pull_request:3381773059 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/usethis-python/usethis-python/pull/1373/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | The flat usethis._tool.impl module mixed ToolSpec subclasses (declarative metadata) and Tool subclasses (runtime behaviour) in the same files. This splits them into parallel submodule structures to... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width