What's Changed
Highlights include:
- Autofix capabilities for rules like
flake8-import-conventions
, which require symbol renames across a file. - Significant decrease in Ruff's cache size (e.g., a ~50% decrease for FastAPI).
- Dozens and dozens of bug fixes + performance improvements.
Rules
- [
copyright
] Implement copyright notice detection by @Ryang20718 in #4701 - [
flake8-datetimez
] Enable UTC-import fordatetime-utc-alias
fix by @charliermarsh in #5100 - [
flake8-implicit-str-concat
] Add autofix forISC001
by @tkukushkin in #4853 - [
flake8-import-conventions
] Enable autofix for unconventional imports rule by @charliermarsh in #5152 - [
flake8-pyi
] Add autofix forSet
-to-AbstractSet
rewrite using reference tracking by @charliermarsh in #5074 - [
flake8-pyi
] Implement PYI044 by @Thomasdezeeuw in #5021 - [
flake8-return
] Extend revisedRET504
implementation towith
statements by @charliermarsh in #4998 - [
flake8-return
] Implement autofix for revisedRET504
rule by @charliermarsh in #4999 - [
flake8-return
] RefactorRET504
to only enforce assignment-then-return pattern by @charliermarsh in #4997 - [
flake8-slots
] Add plugin, addSLOT000
,SLOT001
andSLOT002
by @qdegraaf in #4909 - [
perflint
] Addperflint
plugin, add first rulePERF102
by @qdegraaf in #4821 - [
pylint
] Add Pylint rulecomparison-with-itself
(R0124
) by @tjkuson in #4957 - [
pyupgrade
] Add a rule to remove unnecessary parentheses in class definitions by @charliermarsh in #5032 - [
ruff
] Add a rule for static keys in dict comprehensions by @rodjunger in #4929 - [
ruff
] Add rule to disallow implicit optional with autofix by @dhruvmanila in #4831 - [
ruff
] Expand RUF008 to all classes, but to a new code (RUF012) by @adampauls in #4390 - [
ruff
] Remove unannotated attributes from RUF008 by @charliermarsh in #5049 - [
ruff
] Upgrade explicit-type-conversion rule (RUF010
) to remove unnecessarystr
calls by @charliermarsh in #4971
Settings
- Option (
-o
/--output-file
) to write output to a file by @dhruvmanila in #4950 - Add JSON Lines (NDJSON) message serialization by @akx in #5048
- Add rule documentation URL to JSON output by @charliermarsh in #5187
Caching
- Only use a single cache file per Python package by @Thomasdezeeuw in #5117
- Open cache files in parallel by @Thomasdezeeuw in #5120
Jupyter
- Add support for auto-fix in Jupyter notebooks by @dhruvmanila in #4665
- Add roundtrip support for Jupyter notebook by @dhruvmanila in #5028
Bug Fixes
- Handle decorators in class-parenthesis-modifying rules by @charliermarsh in #5034
- Allow re-assignments to
__all__
by @charliermarsh in #4967 - Handled dict and set inside f-string (#4249) by @DavideCanton in #4563
- Support concatenated string key removals by @charliermarsh in #4976
- Respect 'is not' operators split across newlines by @charliermarsh in #4977
- Parenthesize expressions prior to lexing in F632 by @charliermarsh in #5001
- Ignore pyproject.toml for adding noqa directives by @dhruvmanila in #5013
- Support 'reason' argument to
pytest.fail
by @charliermarsh in #5040 - Allow
async with
inredefined-loop-name
by @charliermarsh in #5125 - Skip
DJ008
enforcement in stub files by @charliermarsh in #5139 - Detect continuations at start-of-file by @charliermarsh in #5173
- Fix allowed-ellipsis detection by @charliermarsh in #5174
- Remove continuations before trailing semicolons by @charliermarsh in #5199
- Support parenthesized expressions when splitting compound assertions by @charliermarsh in #5219
- Use phf for confusables to reduce llvm lines by @konstin in #4926
- Allow private accesses within special dunder methods by @charliermarsh in #4968
- Support concatenated literals in format-literals by @charliermarsh in #4974
- Fix line numbers in source frames by @MichaReiser in #4984
- Suggest combining async with statements by @Thomasdezeeuw in #5022
- Improve
TypedDict
conversion logic for shadowed builtins and dunder methods by @charliermarsh in #5038 - Support glob patterns in pep8_naming ignore-names by @Thomasdezeeuw in #5024
- Respect all
__all__
definitions for docstring visibility by @charliermarsh in #5052 - Don't treat annotations as resolved in forward references by @charliermarsh in #5060
- Consider ignore-names in all pep8 naming rules by @Thomasdezeeuw in #5079
- Ignore
reimplemented-builtin
if usingawait
by @tjkuson in #5101 - Allow space in filename for powershell + windows + python module by @konstin in #5115
- Don't treat straight imports of future as
__future__
imports by @charliermarsh in #5128 - Remove continuations when deleting statements by @charliermarsh in #5198
- Fix corner case involving terminal backslash after fixing
W293
by @evanrittenhouse in #5172 - Fix subprocess.run on Windows Python 3.7 by @konstin in #5220
New Contributors
- @rodjunger made their first contribution in #4929
- @DavideCanton made their first contribution in #4563
- @Thomasdezeeuw made their first contribution in #5021
- @adampauls made their first contribution in #4390
- @tkukushkin made their first contribution in #4853
- @Taybou made their first contribution in #5088
- @davidszotten made their first contribution in #5158
- @dosisod made their first contribution in #5203
Full Changelog: v0.0.272...v0.0.273