{"id":8535,"library":"pytest-pep8","title":"pytest-pep8","description":"pytest-pep8 is a pytest plugin designed to check PEP8 compliance in Python code. It integrates directly with the pytest testing framework to efficiently discover and check `.py` files for style guide violations. The plugin allows for flexible configuration to ignore specific errors or warnings on a per-project or per-file basis. Its last release was in April 2014, and it is largely unmaintained now.","status":"abandoned","version":"1.0.6","language":"en","source_language":"en","source_url":"https://github.com/davidraleigh/pytest-pep8","tags":["pytest","pep8","linter","code quality","style guide"],"install":[{"cmd":"pip install pytest-pep8","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core testing framework required for plugin functionality.","package":"pytest","optional":false},{"reason":"Used by pytest-pep8 for caching results.","package":"pytest-cache","optional":false},{"reason":"The underlying style checker (formerly 'pep8' library) is implicitly required for functionality.","package":"pycodestyle","optional":false}],"imports":[],"quickstart":{"code":"# content of myproject/myfile.py\ndef somefunc( arg1,  arg2):\n    pass\n\n# Terminal\n# Install the plugin\n# pip install pytest-pep8\n\n# Run pytest with the --pep8 flag\n# pytest --pep8","lang":"python","description":"Install the plugin via pip, then run pytest with the `--pep8` flag. The plugin will automatically discover and check Python files for PEP8 violations. Configuration for ignoring specific errors can be done in `pytest.ini` or `setup.cfg`."},"warnings":[{"fix":"This project is unmaintained. Migrate to actively maintained alternatives like `pytest-flake8` or `pytest-pycodestyle`. Downgrading `pytest` is not recommended.","message":"The `pytest-pep8` plugin is incompatible with `pytest` versions 6.0.1 and newer due to significant internal API changes within pytest, specifically regarding node construction.","severity":"breaking","affected_versions":"pytest >= 6.0.1"},{"fix":"Users are strongly advised to migrate to actively maintained PEP8/Flake8 checking plugins for pytest, such as `pytest-flake8` or `pytest-pycodestyle`, for better compatibility and continued support.","message":"The `pytest-pep8` project is largely unmaintained since its last release in April 2014. The underlying 'pep8' library it relies on has also been renamed to `pycodestyle`.","severity":"deprecated","affected_versions":"All versions"},{"fix":"It is recommended to configure `pep8ignore = * ALL` in your `pytest.ini` or `setup.cfg` to initially ignore all errors, then gradually re-enable specific checks or add specific ignore codes as you clean up your code. You can also configure `pep8maxlinelength` for custom line limits.","message":"Running `pytest --pep8` on an existing codebase may initially report a large number of PEP8 violations, potentially overwhelming.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To force a full re-check and clear the plugin's cache, run pytest with both the `--pep8` and `--clearcache` options: `pytest --pep8 --clearcache`.","message":"The plugin uses caching to improve performance, which can sometimes lead to stale results where changes in files are not immediately reflected in subsequent PEP8 checks.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"The `pytest-pep8` plugin is abandoned. You should migrate to a modern, actively maintained linter plugin such as `pytest-flake8` or `pytest-pycodestyle`.","cause":"This error occurs because `pytest-pep8` uses an older internal API for constructing test items that has been deprecated and removed in recent versions of `pytest` (>= 6.0.1).","error":"PytestDeprecationWarning: Direct construction of Pep8Item has been deprecated, please use Pep8Item.from_parent."},{"fix":"Start by adding `pep8ignore = * ALL` under the `[pytest]` section in your `pytest.ini` or `setup.cfg` file to ignore all errors. Then, gradually remove `ALL` or specify individual error codes to ignore (e.g., `pep8ignore = E201 E231`) as you refactor your code.","cause":"Most older or unlinted Python projects will have numerous violations of the PEP8 style guide, and `pytest-pep8` checks all discovered `.py` files by default.","error":"Running `pytest --pep8` reports an overwhelming number of PEP8 errors on my existing Python project."},{"fix":"To explicitly clear the cache and force `pytest-pep8` to re-evaluate all files, run `pytest` with the `--pep8` and `--clearcache` command-line options: `pytest --pep8 --clearcache`.","cause":"The `pytest-pep8` plugin implements caching to speed up repeated runs. This cache might prevent checks from re-running on files it believes haven't changed.","error":"PEP8 checks are not updating or re-running after I modify and save a Python file."}]}