Title: Use `ALL_TOOLS` as single source of truth for canonical tool ordering by Copilot · Pull Request #1793 · usethis-python/usethis-python · GitHub
Open Graph Title: Use `ALL_TOOLS` as single source of truth for canonical tool ordering by Copilot · Pull Request #1793 · usethis-python/usethis-python
X Title: Use `ALL_TOOLS` as single source of truth for canonical tool ordering by Copilot · Pull Request #1793 · usethis-python/usethis-python
Description: Tool ordering was defined redundantly in three separate places (ALL_TOOLS, OTHER_TOOLS in pyproject_toml.py, ALL_TOOL_COMMANDS in tool.py), allowing them to drift. ALL_TOOL_COMMANDS already had a bug: pyproject.toml appeared before pyproject-fmt, contradicting alphabetical order in ALL_TOOLS. Changes _tool/impl/spec/all_.py (new) – introduces ALL_TOOL_SPECS, a canonical list of all ToolSpec instances in alphabetical order, mirroring ALL_TOOLS but at the spec layer. This avoids a circular import: _tool.impl.base can import from _tool.impl.spec, but not from _tool.all_. pyproject_toml.py – replaces the duplicated _OTHER_TOOLS list with a direct use of ALL_TOOL_SPECS from the new spec registry, filtering out PyprojectTOMLToolSpec inline and using is_likely_used(tool_spec) in place of tool.is_used(). All sibling base-Tool imports are removed. .importlinter – adds all_ as the top layer in the tool_impl_spec contract to accommodate the new module. tool.py – replaces the hardcoded ALL_TOOL_COMMANDS with a derived computation: def _get_all_tool_commands() -> list[str]: from usethis._tool.all_ import ALL_TOOLS return [tool.name.lower().replace(" ", "-") for tool in ALL_TOOLS] ALL_TOOL_COMMANDS: list[str] = _get_all_tool_commands() This fixes the pyproject.toml/pyproject-fmt ordering bug as a side effect. all_.py – OTHER_TOOLS is removed entirely. It had no remaining consumers in source code after the ALL_TOOL_SPECS refactor, and its only test was a circular self-validating assertion. Tests – test_tool_matches_command upgraded from set equality to list equality (enforces order); TestAllToolSpecs.test_in_sync_with_all_tools guards that ALL_TOOL_SPECS stays in sync with ALL_TOOLS.
Open Graph Description: Tool ordering was defined redundantly in three separate places (ALL_TOOLS, OTHER_TOOLS in pyproject_toml.py, ALL_TOOL_COMMANDS in tool.py), allowing them to drift. ALL_TOOL_COMMANDS already had a b...
X Description: Tool ordering was defined redundantly in three separate places (ALL_TOOLS, OTHER_TOOLS in pyproject_toml.py, ALL_TOOL_COMMANDS in tool.py), allowing them to drift. ALL_TOOL_COMMANDS already had a b...
Opengraph URL: https://github.com/usethis-python/usethis-python/pull/1793
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a1668a8d-b272-fa84-4e29-95c76f1d23a3 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E396:78281:1BCF281:28581FB:6A4CFB8B |
| html-safe-nonce | 4509923bf01d8c85e6fca5bd9752ede3e8b42f0a248455180ddee4d4a2645862 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzk2Ojc4MjgxOjFCQ0YyODE6Mjg1ODFGQjo2QTRDRkI4QiIsInZpc2l0b3JfaWQiOiI0OTkyMjkxNjc1NjYyNTcwMzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3ef8c78a271824d0c505094f69c21da08abd2cb6b1b6814519da4e4aa7b54992 |
| hovercard-subject-tag | pull_request:3487896357 |
| 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/1793/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 | Tool ordering was defined redundantly in three separate places (ALL_TOOLS, OTHER_TOOLS in pyproject_toml.py, ALL_TOOL_COMMANDS in tool.py), allowing them to drift. ALL_TOOL_COMMANDS already had a b... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 31e4db13a9e20081f2fac78f441659a6576e582bbb15e153f9c7fb6473aa29f5 |
| 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 | 8307e9ba117a26e92a64fb1daf085d795a6552ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width