Skip to content

Always include tools as dev deps even when using pre-commit#1251

Merged
nathanjmcdougall merged 3 commits intomainfrom
1020-when-using-a-uv-backend-include-pre-commit-hooks-as-dev-deps-too
Dec 30, 2025
Merged

Always include tools as dev deps even when using pre-commit#1251
nathanjmcdougall merged 3 commits intomainfrom
1020-when-using-a-uv-backend-include-pre-commit-hooks-as-dev-deps-too

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

This only affects a couple of tools; codespell and pyproject-fmt

This only affects a couple of tools; codespell and pyproject-fmt
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #1020 by ensuring that certain tools (codespell and pyproject-fmt) are always installed as dev dependencies, even when using pre-commit. Previously, these tools were only added as pre-commit hooks without being installed as dev dependencies, which could cause issues with IDE integrations and local development workflows.

Key Changes:

  • Modified use_codespell() and use_pyproject_fmt() to always add dev dependencies regardless of pre-commit usage
  • Removed logic from migrate_config_to_pre_commit() and migrate_config_from_pre_commit() that conditionally managed dev dependencies
  • Updated test assertions to expect dev dependencies to be present when using pre-commit

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/usethis/_core/tool.py Moved tool.add_dev_deps() calls outside of the pre-commit conditional check for codespell and pyproject-fmt
src/usethis/_tool/base.py Removed conditional dev dependency management logic from migration methods
tests/usethis/_core/test_core_tool.py Updated test assertions to verify dev dependencies are present with pre-commit, added migration tests, and updated expected output messages
Comments suppressed due to low confidence (1)

tests/usethis/_core/test_core_tool.py:2118

  • Corrected spelling of 'codepsell' to 'codespell'.
        def test_codepsell_used(

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Dec 30, 2025

CodSpeed Performance Report

Merging #1251 will not alter performance

Comparing 1020-when-using-a-uv-backend-include-pre-commit-hooks-as-dev-deps-too (f066e98) with main (23af832)

Summary

✅ 2 untouched

@nathanjmcdougall nathanjmcdougall merged commit 3a06c95 into main Dec 30, 2025
19 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 1020-when-using-a-uv-backend-include-pre-commit-hooks-as-dev-deps-too branch December 30, 2025 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using a uv backend, include pre-commit hooks as dev deps too

2 participants