flake8-ruff
A Flake8 plugin that implements miscellaneous checks from Ruff.
Specifically, this plugin implements checks that are under the RUF category
(the rules that do not have a direct equivalent in Flake8).
Requirements
Python 3.9 and newer is supported.
Installation
Install from PyPI. For example,
pip install flake8-ruff
Then follow the instructions on the Flake8 documentation to enable the plugin.
Checks
RUF010 Use explicit conversion flag
Checks for str(), repr(), and ascii() as explicit conversions within
f-strings.
For example, replace
f"{ascii(foo)}, {repr(bar)}, {str(baz)}"
with
f"{foo!a}, {bar!r}, {baz!s}"
or, often (such as where __str__ and __format__ are equivalent),
f"{foo!a}, {bar!r}, {baz}"
Derived from explicit-f-string-type-conversion (RUF010).
RUF018 Avoid assignment expressions in assert statements
Checks for named assignment expressions in assert statements. When Python is
run with the -O option, the assert statement is ignored, and the assignment
expression is not executed. This can lead to unexpected behavior.
For example, replace
assert (result := foo()) is not None
with
result = foo()
assert result is not None
Derived from assignment-in-assert (RUF018).
RUF020 typing.Never | T is equivalent to T
Checks for typing.Never and typing.NoReturn in union types, which is
redundant.
For example, replace
typing.Never | int | None
with
int | None
Derived from never-union (RUF020).
RUF025 Unnecessary dict comprehension for iterable; use dict.fromkeys instead
Checks for dict comprehensions that create a dictionary from an iterable with a
constant value. Instead, use dict.fromkeys, which is more efficient.
For example, replace
{key: 0 for key in keys}
with
dict.fromkeys(keys, 0)
and
{key: None for key in keys}
with
dict.fromkeys(keys)
Derived from unnecessary-dict-comprehension-for-iterable (RUF025).
Metadata
Release files for flake8-ruff 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8_ruff-0.3.1.tar.gz | 26.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_ruff-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.9 kB
Release files / flake8_ruff-0.3.1.tar.gz
| Download URL | flake8_ruff-0.3.1.tar.gz |
|---|---|
| Size | 26.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afa65ef8c84760593db76d9c5cec7d7a588b499792461f048924280ac89bb7b4
|
|
BLAKE2b-256 checksum How to use checksums |
e270892dc878ba2245aa62b34a3bb89405eeb6062dbe2e8b8af9e9f982d35d02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2025.
Transparency logRelease files / flake8_ruff-0.3.1-py3-none-any.whl
| Download URL | flake8_ruff-0.3.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0d71e066df562b7307cb2cb3a646a7b55018fdeebc5457167f3f1b652d8d2fe
|
|
BLAKE2b-256 checksum How to use checksums |
5597c6f1961927d9d4df147d8a84b5ad2cab8ae71ca3c424b326abc09049b172
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2025.
Transparency log