--- id: flake8-pyi version: "26.5.0" license: MIT license_treatment: permissive maintenance: active --- # flake8-pyi — A plugin for flake8 to enable linting .pyi stub files. License: permissive · Maintenance: active · Downloads: 995.6K/mo ## What it is and what it does flake8-pyi is a Flake8 plugin designed specifically for linting Python type stub files (.pyi). It extends Flake8 to automatically include .pyi files in linting runs and modifies PyFlakes to handle forward references correctly—a feature essential for stub files where types are declared but never executed. The plugin enforces typeshed's style guide through a set of stub-specific lint rules (prefixed with Y0) that catch patterns inappropriate for stub files. The plugin is most useful in CI pipelines for projects that maintain type stubs, particularly typeshed itself. It runs on modern Python versions and has minimal dependencies. The documentation notes that running it in a dedicated CI environment is recommended to avoid conflicts with other Flake8 plugins that may flag issues irrelevant to stub files (like missing docstrings). Use it for: - Lint typeshed stub files in CI to enforce consistent style and catch type annotation errors before merging. - Validate custom .pyi stub files in a project's type stubs package without manual review of every file. - Catch forward-reference issues in stub files that would be missed by standard Flake8 and PyFlakes. - Enforce typeshed conventions in stub-heavy projects to maintain consistency across many .pyi files. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A Flake8 plugin that lints Python type stub files (.pyi) with stub-specific rules and forward-reference support, enforcing typeshed style conventions. Yes, if you maintain or contribute to type stub files (.pyi). The plugin is actively maintained, has no known vulnerabilities, and solves a real problem—standard linters are not designed for stub files. Install in a dedicated CI environment to avoid conflicts with other Flake8 plugins. Not necessary for projects that do not use stub files. ## Install pip install flake8-pyi uv add flake8-pyi poetry add flake8-pyi ## Installing flake8-pyi Before you install: Low friction install with just two runtime dependencies (flake8 and pyflakes). Repository is actively maintained with recent commits and a stable release history since 2016. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions—suitable for any project type. Quickstart: pip install flake8-pyi flake8 --filename='*.pyi' your_stubs/ Requires Python 3.10 or later; flake8 and pyflakes must be installed as runtime dependencies. Verify before relying: - Whether the Y0-prefixed error codes cover all common stub-file style issues or if some require manual review. - Performance impact when running flake8-pyi alongside other plugins in the same environment. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 995.6K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags flake8 stub file linting, pyi file type checking, typeshed style enforcement, stub file linter plugin, python type stub validation, pyi linting rules, flake8 type stubs, type-stubs, flake8-plugin, typeshed [View on SkillFed](https://skillfed.io/packages/flake8-pyi) · [View on PyPI](https://pypi.org/project/flake8-pyi/)