{"id":2504,"library":"flake8-pyproject","title":"Flake8-pyproject","description":"Flake8-pyproject is a Flake8 plugin that enables Flake8 to load its configuration from `pyproject.toml` files, a feature not natively supported by Flake8. It registers itself as a plugin, allowing the standard `flake8` command to seamlessly use `pyproject.toml` when present in the current directory. The library also provides an alternative `flake8p` command. It is currently at version 1.2.4 and receives updates primarily for Flake8 compatibility and new configuration options.","status":"active","version":"1.2.4","language":"python","source_language":"en","source_url":"https://github.com/john-hen/Flake8-pyproject","tags":["flake8","linting","configuration","pyproject.toml","linter"],"install":[{"cmd":"pip install Flake8-pyproject","lang":"bash","label":"Install stable version"},{"cmd":"pip install flake8 'Flake8-pyproject<1.0.0' # For Flake8 4.x\npip install flake8 'Flake8-pyproject>=1.0.0' # For Flake8 5.x and later","lang":"bash","label":"Install with specific Flake8 compatibility"}],"dependencies":[{"reason":"This is a plugin for Flake8 and requires Flake8 to function. Specific versions of Flake8-pyproject are compatible with specific major versions of Flake8.","package":"flake8"},{"reason":"Required for parsing TOML files on Python versions older than 3.11. Python 3.11+ uses the built-in `tomllib` module.","package":"tomli","optional":true}],"imports":[],"quickstart":{"code":"mkdir my_project\ncd my_project\npip install flake8 Flake8-pyproject\n\n# Create pyproject.toml\ncat <<EOF > pyproject.toml\n[tool.flake8]\nignore = [\"E203\", \"W503\"]\nmax-line-length = 88\nper-file-ignores = [\n    \"__init__.py:F401\",\n]\nEOF\n\n# Create a Python file with a linter error\ncat <<EOF > my_module.py\nimport os\n\ndef my_func (  arg1, arg2 ):\n    return arg1 + arg2\n\nEOF\n\n# Run flake8 (will use pyproject.toml config)\nflake8 my_module.py\n\n# Alternatively, use the provided flake8p command\n# flake8p my_module.py\n","lang":"bash","description":"This quickstart demonstrates how to install `flake8-pyproject`, configure Flake8 via `pyproject.toml`, and then run the `flake8` command to apply those configurations. The `flake8` command will automatically pick up the `[tool.flake8]` section from your `pyproject.toml`."},"warnings":[{"fix":"Check the release notes for `Flake8-pyproject` to determine the compatible `flake8` version. Downgrade/upgrade `flake8-pyproject` or `flake8` accordingly (e.g., `pip install 'Flake8-pyproject<1.0.0'` for Flake8 4.x, or `pip install 'Flake8-pyproject>=1.0.0'` for Flake8 5.x+).","message":"Flake8-pyproject versions have specific compatibility with Flake8 major versions. Version 1.0.0 dropped support for Flake8 4.x (requiring Flake8 5.0+), while earlier versions (e.g., 0.9.1) explicitly pinned to Flake8 4.x or earlier. Ensure your `flake8-pyproject` version matches your `flake8` installation.","severity":"breaking","affected_versions":"<1.0.0, >=1.0.0"},{"fix":"Place `pyproject.toml` in the project root, or use `flake8 --toml-config /path/to/my_config.toml`.","message":"The `pyproject.toml` file containing the `[tool.flake8]` configuration must typically be located in the current working directory where `flake8` is executed. If it's in a different location or named differently, you must explicitly specify its path using the `--toml-config` command-line option.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Convert INI-style lists and comma-separated values to TOML arrays and lists, respectively. Example: `ignore = E231, E241` becomes `ignore = ['E231', 'E241']`.","message":"The `[tool.flake8]` section within `pyproject.toml` must adhere to TOML's syntax for arrays and dictionaries (e.g., `ignore = [\"E203\", \"W503\"]`, `per-file-ignores = [\"__init__.py:F401\"]`). This differs from the INI format used in `.flake8` or `setup.cfg`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `tomli` is installed for Python < 3.11. No action needed for Python 3.11+.","message":"For Python versions older than 3.11, the `tomli` package is a required dependency for parsing TOML files. Python 3.11 and later include `tomllib` in the standard library, making `tomli` unnecessary.","severity":"gotcha","affected_versions":"<1.0.1"},{"fix":"Review any custom scripts or tools that call `flake8` with `flake8-pyproject` installed and ensure they only pass `--toml-config` for custom `pyproject.toml` paths, or other arguments directly handled by Flake8 itself.","message":"As of version 1.2.3, the plugin specifically parses command-line arguments as passed down from Flake8 and explicitly ignores arguments other than `--toml-config`. This change might affect custom integrations or scripts that rely on specific command-line argument handling by `flake8-pyproject`.","severity":"gotcha","affected_versions":">=1.2.3"},{"fix":"Be aware that major updates to Flake8 or Python might require corresponding updates to `flake8-pyproject` for continued compatibility.","message":"Flake8-pyproject works by 'monkey-patching' Flake8 and Python's `configparser` library. This approach, while effective, means the plugin's stability can be sensitive to significant restructuring in future versions of Python or Flake8.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.2.4':62 'allow':34 'also':51 'altern':54 'command':38,56 'compat':69 'configur':17,72,76 'current':47,59 'directori':48 'enabl':12 'featur':22 'file':20 'flake8':2,5,9,13,27,37,68,74 'flake8-pyproject':1,4 'flake8p':55 'librari':50 'lint':75 'linter':78 'load':15 'nativ':24 'new':71 'option':73 'plugin':10,33 'present':44 'primarili':66 'provid':52 'pyproject':3,6 'pyproject.toml':19,42,77 'receiv':64 'regist':29 'seamless':40 'standard':36 'support':25 'updat':65 'use':41 'version':61","created_at":"2026-04-11T01:30:55.121508+00:00","updated_at":"2026-04-16T15:04:55.023439+00:00","problems":[{"fix":"Ensure your Flake8 configuration is under the `[tool.flake8]` section in `pyproject.toml` and formatted correctly. Verify `flake8-pyproject` is installed in the same environment as `flake8` and run `flake8` directly (or `flake8p`). If the `pyproject.toml` is not in the current directory, use `flake8 --toml-config /path/to/pyproject.toml`.","cause":"The `pyproject.toml` file's Flake8 configuration might be incorrectly placed, formatted, or `flake8-pyproject` may not be properly recognized by Flake8, leading to the configuration being ignored.","error":"flake8 not loading pyproject.toml configuration"},{"fix":"Ensure that the directory containing Python scripts for your environment (e.g., `.venv/bin` on Linux/macOS or `Scripts` in a virtual environment on Windows) is added to your system's PATH. You may need to reinstall `flake8-pyproject` or activate your virtual environment.","cause":"The `pflake8` executable, provided by `flake8-pyproject`, is not located in any directory listed in your system's PATH environment variable, or the package installation was incomplete.","error":"pflake8: command not found"},{"fix":"Change the format of list-based configuration options in `pyproject.toml` from a comma-separated string to a TOML array. For example, `per-file-ignores = ['__init__.py:F401', 'setup.py:E402']` instead of `per-file-ignores = '__init__.py:F401,setup.py:E402'`.","cause":"Configuration options that expect a list (like `per-file-ignores` or `ignore`) are defined using a comma-separated string, but `flake8-pyproject` requires them to be specified as a TOML array in `pyproject.toml`.","error":"flake8 per-file-ignores in pyproject.toml not working"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"flake8p","cli_version":"7.3.0 (Flake8-pyproject: 1.2.4, mccabe: 0.7.0, pycodestyle: 2.14.0, pyflakes:","type":"library","homepage":null,"github":"https://github.com/john-hen/Flake8-pyproject","docs":null,"changelog":"https://github.com/john-hen/Flake8-pyproject/releases","pypi":"https://pypi.org/project/flake8-pyproject/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-10","next_check":"2026-07-09","install_tag":null}}