v0.13.0
🚀 New Features
-
New high-level interfaces have been added:
usethis init
to initialize projects including recommended tools, andusethis lint
,usethis format
,usethis spellcheck
, andusethis test
to add sets of recommended tools for different purposes. For example,usethis lint
will add both Ruff and deptry. As recommended tooling changes in the long-term, these commands will remain the same but potentially change the specific tools they include. -
Error messages are now directed to stderr instead of stdout.
-
The
INP
code Ruff rules are now enabled when adding Import Linter, since Import Linter requires__init__.py
files to exist in the packages it analyzes. -
The
usethis docstyle
possible arguments (numpy
,google
, andpep257
) are now handled in a way that should lead to more readable error messages and--help
explanations.
🦾 Robustness
-
If
pre-commit install
does not run successfully (e.g. if there is not Git Repository for the project) then usethis will display a message for the user to ask them to run this command themselves, rather than the previous behaviour which was to stop with an error. -
Syntax errors in TOML and INI configuration files will be handled when trying to determine whether a given tool is being used. A warning is displayed but usethis will continue under the assumption that the invalid file does not contain relevant configuration for the tool.
🐞 Bug Fixes
-
Previously, when calling
usethis tool ruff --how
, any passed--linter
or--formatter
arguments would be ignored and instructions would be displayed for both the linter and the formatter regardless. This is no longer the case - now if either the--linter
or--formatter
argument is passed, just the specified arguments will be considered in terms of the messages displayed. -
Previously, when adding pre-commit hook definitions, it was possible to duplicate the added definition if there was a duplicate hook ID existing in the file. This has been fixed. Similarly, when adding pre-commit hooks definitions, the intended order of hooks was violated in some circumstances. The ordering logic has been reworked to ensure consistent hook ordering (based on the hook ID).
-
Previously, when adding
pre-commit
, ifpyproject-fmt
orcodespell
were present, the default configuration would be added for those tools too. This is no longer the case - addingpre-commit
will not touch the existing configuration for other tools except for the way in which they are installed and declared as dependencies. -
Previously, the
usethis rule
command did not handle some error messages properly, and would dump the full stack trace. This has been resolved.
📦 Packaging
- The
typer
dependency lower bound has been bumped from version 0.6.0 to 0.12.4 to provide support for union types of Enum withNone
.
📚 Documentation
-
More information has been added to the README in the Command Line Interface Table of Contents, giving a one-line summary of each command.
-
The GitHub Issue templates have been simplified down to make them more accessible.
🔧 Internal Changes
-
The test suite on CI now runs on the lowest supported version of uv (0.5.29), rather than just the latest version.
-
The
ARG
Ruff rules are now enabled for development of usethis. -
New
alert_only
global state has been added to allow the suppression of non-warning and non-error printing to the console. -
New global state has been added to set the project directory (versus the previous default of using the current working directory in all cases).
-
The
requests
package version for development was bumped from 2.23.3 to 2.23.4 to address CVE-2024-47081.
What's Changed
- Test pre-commit integrations more explicitly for Bitbucket pipelines by @nathanjmcdougall in #686
- Add INP rules when using Import Linter by @nathanjmcdougall in #685
- Simplify GitHub issue templates by @nathanjmcdougall in #689
- Use stderr for error output instead of stdout by @nathanjmcdougall in #687
- Implement
usethis lint
by @nathanjmcdougall in #691 - Cope with syntax errors in TOML and INI files in is_used with appropr… by @nathanjmcdougall in #688
- Implement
usethis format
by @nathanjmcdougall in #694 - Implement
usethis spellcheck
by @nathanjmcdougall in #697 - Implement
usethis test
by @nathanjmcdougall in #698 - Add higher-level toolset-adding commands to CLI index in README by @nathanjmcdougall in #700
- Add more detail to README.md by @nathanjmcdougall in #702
- Simplify whitespace in pre-commit JSON schema to sync with schema store by @nathanjmcdougall in #713
- Add toolset module for bundles of tools e.g. use_linters for Ruff and… by @nathanjmcdougall in #710
- Put the Manage Tooling command definitions in alphabetical order by @nathanjmcdougall in #711
- Handle failed pre-commit install via box message by @nathanjmcdougall in #714
- Ensure all interfaces are protected with try-except by @nathanjmcdougall in #709
- Use docstyle Enum at interface level by @nathanjmcdougall in #712
- Fix a bug where adding pre-commit would modify the config for some to… by @nathanjmcdougall in #715
- Fix bug where usethis spellcheck ignores --remove and --how by @nathanjmcdougall in #719
- Enable ARG Ruff rules for development by @nathanjmcdougall in #720
- Remove unused pytest fixtures and enable ARG002 for test suite by @nathanjmcdougall in #721
- Bump requests to address CVE-2024-47081 for dev by @nathanjmcdougall in #722
- Put uv version onto the CI matrix to test on earlier version of uv by @nathanjmcdougall in #724
- Use bullet-points consistently in changelog by @nathanjmcdougall in #725
- Respect
--linter
and--formatter
inusethis tool ruff --how
by @nathanjmcdougall in #727 - Correctly order pre-commit hooks when no precedents are added yet by @nathanjmcdougall in #731
- 732 insert repo will add duplicate repos if precedent ids are duplicated by @nathanjmcdougall in #734
- Add
alert_only
as a global state configuration by @nathanjmcdougall in #736 - Use global state to determine the project directory by @nathanjmcdougall in #739
- 307 implement usethis init by @nathanjmcdougall in #741
- Update CHANGELOG.md for version 0.13.0 by @nathanjmcdougall in #743
Full Changelog: v0.12.0...v0.13.0