Title: Create standalone functions for default `Tool` methods · Issue #1350 · usethis-python/usethis-python · GitHub
Open Graph Title: Create standalone functions for default `Tool` methods · Issue #1350 · usethis-python/usethis-python
X Title: Create standalone functions for default `Tool` methods · Issue #1350 · usethis-python/usethis-python
Description: Toward #1311, we want a standalone is_likely_used function which would take a ToolSpec and ConfigSpec and basically just give the current implementation for Tool.is_used, i.e. the default implementation. Tool.is_used would be refactored ...
Open Graph Description: Toward #1311, we want a standalone is_likely_used function which would take a ToolSpec and ConfigSpec and basically just give the current implementation for Tool.is_used, i.e. the default implement...
X Description: Toward #1311, we want a standalone is_likely_used function which would take a ToolSpec and ConfigSpec and basically just give the current implementation for Tool.is_used, i.e. the default implement...
Opengraph URL: https://github.com/usethis-python/usethis-python/issues/1350
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Create standalone functions for default `Tool` methods","articleBody":"Toward #1311, we want a standalone `is_likely_used` function which would take a `ToolSpec` and `ConfigSpec` and basically just give the current implementation for `Tool.is_used`, i.e. the default implementation.\n\n`Tool.is_used` would be refactored to use `is_likely_used` using `self` for the `ToolSpec` and `self.config_spec` for the `ConfigSpec`.\n\n`Tool.is_used`, whose current implementation would serve as the basis for `is_likely_used`, currently uses `Tool.is_declared_as_dep`, which should be moved into `ToolSpec` so it is accessible from the `ToolSpec` arg. It also uses `Tool.is_config_present` which uses a `Tool._is_config_spec_present` helper method together with `ConfigSpec` from `Tool.config_spec`. We should move the `Tool._is_config_spec_present` method to `ConfigSpec.is_present` since it doesn't actually use the `self` arg in `Tool` at all. Then, `is_likely_used` can just use `ConfigSpec.is_present` directly from the `ConfigSpec` passed as an argument.\n\nLastly, `Tool.is_used` uses `Tool.is_pre_commit_config_present`. This, along with its dependent method `Tool.get_pre_commit_repos` should be moved into `ToolSpec`.\n\nThe `ToolSpec` implementation should be moved into a new module called `usethis._tool.spec`.\n\nThe new standalone `is_likely_used` method should be put into a new `usethis._tool.heuristics` module.\n\nThe new module layering for `usethis._tool` should be like the following:\nlayers =\n all_\n impl\n base\n heuristics\n spec\n config | pre_commit | rule","author":{"url":"https://github.com/nathanjmcdougall","@type":"Person","name":"nathanjmcdougall"},"datePublished":"2026-03-10T05:28:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1350/usethis-python/issues/1350"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:169a0966-d7c5-31e7-7496-422f85d3f31a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A868:29BB0:ABE04B:F18CC6:6A4C9F20 |
| html-safe-nonce | 214e578d5b8e8ce1c637b79aa0c2772deaee1ed29c355e67577f5fcf9c75715b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODY4OjI5QkIwOkFCRTA0QjpGMThDQzY6NkE0QzlGMjAiLCJ2aXNpdG9yX2lkIjoiNTM3MjEyMzYyNTA3ODY5MzY2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | eb688803e4a8a4d520454191f05370ba9f4733fb7b33db9775b2297196811c7c |
| hovercard-subject-tag | issue:4049496115 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/usethis-python/usethis-python/1350/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b92094f9537d11090eb35d6aaaa15b51caa3ace031c85ff2f95ee84bc7ed546a/usethis-python/usethis-python/issues/1350 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b92094f9537d11090eb35d6aaaa15b51caa3ace031c85ff2f95ee84bc7ed546a/usethis-python/usethis-python/issues/1350 |
| og:image:alt | Toward #1311, we want a standalone is_likely_used function which would take a ToolSpec and ConfigSpec and basically just give the current implementation for Tool.is_used, i.e. the default implement... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nathanjmcdougall |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ae90d426644ca15e89bacceb72e51f4e9dbf85f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width