{"id":6639,"library":"flake8-simplify","title":"flake8-simplify","description":"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.","status":"active","version":"0.30.0","language":"en","source_language":"en","source_url":"https://github.com/MartinThoma/flake8-simplify","tags":["flake8","linter","code quality","simplification","static analysis"],"install":[{"cmd":"pip install flake8-simplify","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required as the base linter for this plugin to operate.","package":"flake8"}],"imports":[{"note":"Users install the package, and 'flake8' automatically discovers and runs the plugin's checks.","symbol":"flake8-simplify","correct":"Not directly imported by user code; it's a plugin for the 'flake8' command-line tool."}],"quickstart":{"code":"import os\n\n# SIM201: Use 'a != b' instead of 'not a == b'\ndef bad_comparison(a, b):\n    if not a == b:\n        return True\n    return False\n\n# SIM101: Multiple isinstance-calls which can be merged into a single call\ndef bad_instance(obj):\n    if isinstance(obj, int) or isinstance(obj, float):\n        return \"Number\"\n    return \"Other\"\n\n# To run flake8-simplify:\n# 1. Save the code above as example.py\n# 2. Open your terminal in the same directory\n# 3. Run: pip install flake8 flake8-simplify\n# 4. Run: flake8 example.py","lang":"python","description":"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."},"warnings":[{"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).","message":"The 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.","severity":"breaking","affected_versions":"<0.30.0 (for Python versions <3.9)"},{"fix":"Install `flake8-scream` in addition to `flake8-simplify` (e.g., `pip install flake8-scream`) to re-enable these checks.","message":"Several `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.","severity":"breaking","affected_versions":">=0.18.0 (rules started moving in earlier versions, but are definitively gone by this point)"},{"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.","message":"The `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.","severity":"deprecated","affected_versions":">=0.18.0 (removed sometime before this version was widely adopted)"},{"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.","message":"Rules 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.","severity":"gotcha","affected_versions":"All versions introducing SIM9xx rules"},{"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`.","message":"Versions 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]","severity":"gotcha","affected_versions":"<0.19.3"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}