Add vulture for development and clean up dead code references#1837
Merged
Conversation
…ent` Add docstring
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds vulture to the development toolchain and removes several now-dead/internal code paths (largely CI/environment helpers), while also adjusting backend auto-detection to prefer Poetry when uv isn’t available and no pyproject.toml exists.
Changes:
- Add
vultureto dev dependencies, configure it inpyproject.toml, and run it via pre-commit. - Remove unused modules/APIs (CI GitHub tag integration, environment Python queries, uv python/version helpers, and some tool helper properties/methods).
- Move test-only utilities into a dedicated
_testmodule and update tests to import from it.
Reviewed changes
Copilot reviewed 119 out of 120 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Adds vulture to the dev lock set. |
| pyproject.toml | Adds vulture dev dep and config under [tool.vulture]. |
| .pre-commit-config.yaml | Adds the vulture pre-commit hook. |
| .importlinter | Removes layers/contracts for deleted modules. |
| docs/module-tree.txt | Updates module tree to reflect removed modules. |
| docs/functions.txt | Removes references to deleted public/internal functions. |
| AGENTS.md | Updates agent documentation for removed modules/functions. |
| src/usethis/_backend/dispatch.py | Backend auto-detection now falls back to Poetry when appropriate. |
| src/usethis/_backend/poetry/detect.py | Alters Poetry “used” detection logic. |
| src/usethis/_backend/uv/errors.py | Removes unused uv error type. |
| src/usethis/_core/tool.py | Removes now-dead use_tool dispatch and related typing. |
| src/usethis/_file/manager.py | Minor cleanup in __exit__ (unused args). |
| src/usethis/file/yaml/io.py | Removes edit_yaml/read_yaml helpers from production code. |
| src/usethis/_integrations/pre_commit/hooks.py | Removes unused hooks_are_equivalent. |
| src/usethis/_integrations/pre_commit/version.py | Removes get_pre_commit_version from production code. |
| src/usethis/_integrations/environ/init.py | Deletes unused integration package. |
| src/usethis/_integrations/environ/python.py | Deletes unused environment Python query logic. |
| src/usethis/_integrations/ci/init.py | Deletes unused CI integration package. |
| src/usethis/_integrations/ci/github/init.py | Deletes unused GitHub CI integration package. |
| src/usethis/_integrations/ci/github/errors.py | Deletes unused GitHub CI error types. |
| src/usethis/_integrations/ci/github/tags.py | Deletes unused GitHub tag fetcher. |
| src/usethis/_tool/base.py | Removes unused is_config_present. |
| src/usethis/_tool/pre_commit.py | Removes unused any_require_venv. |
| src/usethis/_pipeweld/func.py | Removes unused compatible_config_groups field. |
| src/usethis/_backend/uv/version.py | Deletes unused uv version helper module. |
| src/usethis/_backend/uv/python.py | Deletes unused uv python helper module. |
| src/usethis/_file/pyproject_toml/remove.py | Deletes unused pyproject removal helper. |
| src/usethis/_test.py | Removes test utilities from the usethis package namespace. |
| src/_test.py | Adds consolidated test utilities module used by the test suite. |
| tests/conftest.py | Switches imports to _test and removes cache clear for deleted helper. |
| tests/test_help.py | Switches CliRunner import to _test. |
| tests/test_install.py | Switches change_cwd import to _test. |
| tests/usethis/test_init.py | Switches change_cwd import to _test. |
| tests/usethis/test_fallback.py | Switches GitHub tag helper imports to _test. |
| tests/usethis/test_deps.py | Switches change_cwd import to _test. |
| tests/usethis/test_config.py | Switches change_cwd import to _test. |
| tests/usethis/_ui/interface/test_version.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_typecheck.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_tool.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_test.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_status.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_spellcheck.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_show.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_rule.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_readme.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_list.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_lint.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_interface_readme.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_interface_badge.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_init.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_hook.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/ui/interface/test_format.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_docstyle.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_doc.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_browse.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_author.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_ui/interface/test_arch.py | Switches CliRunner/change_cwd import to _test. |
| tests/usethis/_tool/test_pre_commit.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/test_heuristics.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/test_base.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_ty.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_tach.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_ruff.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_requirements_txt.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_pytest.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_pyproject_toml.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_pyproject_fmt.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_pre_commit.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_mkdocs.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_import_linter.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_deptry.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_coverage_py.py | Switches change_cwd import to _test. |
| tests/usethis/_tool/impl/base/test_codespell.py | Switches change_cwd import to _test. |
| tests/usethis/_pipeweld/test_func.py | Removes assertions tied to removed compatible_config_groups. |
| tests/usethis/_integrations/sonarqube/test_sonarqube_config.py | Switches helpers to _test (incl. uv_python_pin). |
| tests/usethis/_integrations/pytest/test_core.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/project/test_packages.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/project/test_license.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/project/test_layout.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/project/test_imports.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/pre_commit/test_yaml.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/pre_commit/test_version.py | Switches get_pre_commit_version import to _test. |
| tests/usethis/_integrations/pre_commit/test_pre_commit_schema.py | Switches helpers to _test. |
| tests/usethis/_integrations/pre_commit/test_pre_commit_core.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/pre_commit/test_language.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/pre_commit/test_init.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/pre_commit/test_hooks.py | Switches helpers to _test. |
| tests/usethis/_integrations/mkdocs/test_core.py | Switches change_cwd import to _test. |
| tests/usethis/_integrations/environ/test_python.py | Deletes tests for removed environ integration. |
| tests/usethis/_integrations/ci/github/test_tags.py | Deletes tests for removed GitHub CI integration. |
| tests/usethis/file/yaml/test_yaml_io.py | Switches YAML edit helpers to _test. |
| tests/usethis/_file/yaml/test_update.py | Switches YAML edit helper to _test. |
| tests/usethis/file/toml/test_toml_io.py | Switches change_cwd import to _test. |
| tests/usethis/_file/test_manager.py | Switches change_cwd import to _test. |
| tests/usethis/_file/pyproject_toml/test_valid.py | Switches change_cwd import to _test. |
| tests/usethis/_file/pyproject_toml/test_requires_python.py | Switches change_cwd import to _test. |
| tests/usethis/_file/pyproject_toml/test_remove.py | Deletes tests for removed remove_pyproject_toml. |
| tests/usethis/file/pyproject_toml/test_pyproject_toml_io.py | Switches change_cwd import to _test. |
| tests/usethis/_file/pyproject_toml/test_project.py | Switches change_cwd import to _test. |
| tests/usethis/_file/pyproject_toml/test_name.py | Switches change_cwd import to _test. |
| tests/usethis/file/ini/test_ini_io.py | Switches change_cwd import to _test. |
| tests/usethis/_core/test_status.py | Switches change_cwd import to _test. |
| tests/usethis/_core/test_rule.py | Switches change_cwd import to _test. |
| tests/usethis/_core/test_list.py | Switches change_cwd import to _test. |
| tests/usethis/_core/test_docstyle.py | Switches change_cwd import to _test. |
| tests/usethis/_core/test_core_tool.py | Switches helpers to _test (incl. use_tool). |
| tests/usethis/_core/test_core_readme.py | Switches change_cwd import to _test. |
| tests/usethis/_core/test_core_badge.py | Switches change_cwd import to _test. |
| tests/usethis/_core/test_author.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/uv/test_lockfile.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/uv/test_link_mode.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/uv/test_init.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/uv/test_detect.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/uv/test_call.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/uv/test_available.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/uv/test_version.py | Deletes tests for removed uv version helper. |
| tests/usethis/_backend/uv/test_python.py | Deletes tests for removed uv python helper. |
| tests/usethis/_backend/test_dispatch.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/poetry/test_detect.py | Switches change_cwd import to _test. |
| tests/usethis/_backend/poetry/test_call.py | Switches change_cwd import to _test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Open
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most of these are from CI implementations which are now removed.
Also sneaking in a change in functionality where we will prefer to use poetry if available in the environment when uv isn't instead of using the None backend and pyproject.toml doesn't exist.
Solves #1816 and solves #1836