Registry / testing / flake8-simplify

flake8-simplify

JSON →
library0.30.0pypypiunverified

flake8-simplify is a plugin for the Flake8 linter that identifies and suggests simplifications for Python code. It helps developers improve code readability, reduce complexity, and catch common minor mistakes by checking for patterns that can be written more concisely. The current version is 0.30.0, and it maintains a consistent release cadence with regular updates introducing new rules and maintenance fixes.

pip install flake8-simplify
INSTALL
IMPORT
SIG · FLAKE8-SIMPLIFY
F
flake8-simplify
testingpythonv0.30.0
Install
1.8s avg
Import
—
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.30.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.5MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 1.8s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

flake8-simplify
✓ Not directly imported by user code; it's a plugin for the 'flake8' command-line tool.
Users install the package, and 'flake8' automatically discovers and runs the plugin's checks.

To quickly use flake8-simplify, first ensure you have `flake8` installed, then install `flake8-simplify`. Create a Python file with code that can be simplified, and then run the `flake8` command on that file. The output will show any identified simplifications with their respective SIM codes.

import os # SIM201: Use 'a != b' instead of 'not a == b' def bad_comparison(a, b): if not a == b: return True return False # SIM101: Multiple isinstance-calls which can be merged into a single call def bad_instance(obj): if isinstance(obj, int) or isinstance(obj, float): return "Number" return "Other" # To run flake8-simplify: # 1. Save the code above as example.py # 2. Open your terminal in the same directory # 3. Run: pip install flake8 flake8-simplify # 4. Run: flake8 example.py
Debug
Known issues
breakingThe minimum Python version required by `flake8-simplify` has increased. Version `0.30.0` and newer require Python `>=3.9.0`. Older versions (e.g., `0.2.0`) supported Python `3.6` to `3.8`. Users on older Python installations must upgrade their Python version or pin an older `flake8-simplify` version.
fix
Upgrade Python to `>=3.9.0` or pin `flake8-simplify` to an older compatible version (e.g., `pip install 'flake8-simplify<0.30.0'` for Python 3.8).
affects: <0.30.0 (for Python versions <3.9)
breakingSeveral `SIM` rules, including `SIM119`, `SIM204-207`, `SIM122`, and `SIM123`, have been moved to the separate `flake8-scream` plugin. If your project relied on these specific checks, they will no longer be performed by `flake8-simplify` alone.
fix
Install `flake8-scream` in addition to `flake8-simplify` (e.g., `pip install flake8-scream`) to re-enable these checks.
affects: >=0.18.0 (rules started moving in earlier versions, but are definitively gone by this point)
deprecatedThe `SIM106` rule ('Handle error-cases first') has been removed due to an excessive number of false positives. Code that previously triggered this warning will no longer do so, which might lead to a perceived gap in linting coverage if this rule was actively used.
fix
There is no direct fix within `flake8-simplify` for this specific rule's removal. Consider implementing a custom check or finding an alternative linter if this specific style check is critical for your codebase.
affects: >=0.18.0 (removed sometime before this version was widely adopted)
gotchaRules prefixed with `SIM9xx` are considered experimental. Their behavior, error codes, or even their inclusion might change significantly (or be promoted to a stable `SIMxxx` code) in future releases without adhering to standard breaking change protocols.
fix
Be aware that `SIM9xx` checks may be unstable. Avoid relying on their exact behavior or codes for strict enforcement in production CI/CD pipelines unless explicitly stable.
affects: All versions introducing SIM9xx rules
gotchaVersions prior to `0.19.3` of `flake8-simplify` had a known issue where the `SIM104` rule ('Use yield from iterable') could produce false positives, particularly in the context of `async` functions. This could lead to incorrect linting suggestions. [cite: '0.19.3' release notes]
fix
Upgrade to `flake8-simplify` version `0.19.3` or newer to resolve the false positives for `SIM104`. If upgrading is not possible, ignore `SIM104` for affected async code using `# noqa: SIM104`.
affects: <0.19.3
Upgrade
Version history
0.30.0latest on PyPI · released Jan 1, 2026
Audit
Dependencies
flake8requiredRequired as the base linter for this plugin to operate.
Agent activity
12 hits · last 30 days
node
12
Resources
flake8-simplify — pip install flake8-simplify · libregistry