{"id":4008,"library":"flake8-quotes","title":"Flake8 Quotes","description":"flake8-quotes is a Flake8 extension that lints Python code for consistent quote usage. It helps enforce a preferred quote style (single or double) for inline strings, multiline strings, and docstrings, and by default, encourages avoiding escaped quotes as per PEP 8. The current version is 3.4.0, with releases occurring periodically, the latest being in February 2024, indicating active maintenance.","status":"active","version":"3.4.0","language":"en","source_language":"en","source_url":"https://github.com/zheller/flake8-quotes/","tags":["flake8","linter","code-quality","formatting","quotes","pep8"],"install":[{"cmd":"pip install flake8-quotes","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"flake8-quotes is a plugin for the Flake8 linter and requires Flake8 to function.","package":"flake8"}],"imports":[{"note":"flake8-quotes integrates with Flake8 automatically upon installation and is configured via Flake8's configuration files (e.g., pyproject.toml, .flake8, setup.cfg).","symbol":"No direct import","correct":"This is a flake8 plugin and is not imported directly in Python code."}],"quickstart":{"code":"# 1. Create a Python file, e.g., 'bad_quotes.py'\n# bad_quotes.py\nmessage = 'Hello, world!' # Intended to be flagged if double quotes are preferred\n\n\"\"\"This is a docstring.\"\"\" # Intended to be flagged if single quotes are preferred\n\n# 2. Create a configuration file, e.g., 'pyproject.toml' or '.flake8'\n# pyproject.toml\n# [tool.flake8]\n# inline-quotes = \"double\"\n# multiline-quotes = \"single\"\n# docstring-quotes = \"single\"\n# select = [\"E\", \"F\", \"W\", \"Q0\"]\n# avoid-escape = true # This is the default behavior\n\n# .flake8 (alternative to pyproject.toml)\n# [flake8]\n# inline-quotes = double\n# multiline-quotes = single\n# docstring-quotes = single\n# select = E,F,W,Q0\n# avoid-escape = True\n\n# 3. Run flake8 from your terminal in the same directory\n# flake8 bad_quotes.py\n\n# Expected output (example, may vary based on exact config and content):\n# bad_quotes.py:3:11: Q000 Remove bad quotes\n# bad_quotes.py:5:1: Q002 Remove bad quotes from docstring","lang":"python","description":"After installing flake8-quotes, you need to configure Flake8 to enable its checks and specify your preferred quote styles. This is typically done in a `pyproject.toml` file (recommended), `.flake8` file, or `setup.cfg`."},"warnings":[{"fix":"Update your Flake8 configuration files and CLI commands to use `inline-quotes` instead of `quotes`.","message":"The `--quotes` CLI option and `quotes` configuration setting were renamed to `--inline-quotes` and `inline-quotes` respectively in version 0.3.0.","severity":"deprecated","affected_versions":"<=0.2.x"},{"fix":"If you relied on the previous behavior where escaping quotes was allowed by default, you must explicitly set `avoid-escape = False` in your configuration or use the `--no-avoid-escape` CLI option.","message":"In version 2.0.0, the default behavior changed to automatically encourage avoiding escaping quotes as per PEP 8. This means `avoid-escape` is now `True` by default.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Add `select = E,F,W,Q0` (or similar, including Q0) to your Flake8 configuration file (e.g., `pyproject.toml`, `.flake8`).","message":"Installing flake8-quotes does not automatically enable its checks. You must explicitly include the 'Q0' prefix in your Flake8 `select` configuration.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that string values for configuration options (e.g., `\"single\"`, `\"double\"`) are enclosed in quotes within your `pyproject.toml` under the `[tool.flake8]` section.","message":"When configuring flake8-quotes within `pyproject.toml` (especially with tools like `flakeheaven`), string values for options like `inline-quotes` must be explicitly quoted, e.g., `inline-quotes = \"double\"`.","severity":"gotcha","affected_versions":"All versions when using TOML configs with specific parsers."}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}