GithubHelp home page GithubHelp logo

alexwaygood / flake8-pyi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pycqa/flake8-pyi

1.0 0.0 0.0 726 KB

A plugin for Flake8 that provides specializations for type hinting stub files

License: MIT License

Python 100.00%

flake8-pyi's Introduction

flake8-pyi

A plugin for Flake8 that provides specializations for type hinting stub files, especially interesting for linting typeshed.

Refer to this documentation for more details on stub files.

Functionality

  1. Adds the .pyi extension to the default value of the --filename command-line argument to Flake8. This means stubs are linted by default with this plugin enabled, without needing to explicitly list every file.

  2. Modifies PyFlakes runs for .pyi files to defer checking type annotation expressions after the entire file has been read. This enables support for first-class forward references that stub files use.

  3. Provides a number of .pyi-specific warnings that enforce typeshed's style guide.

Note: Be careful when using this plugin in the same environment as other flake8 plugins, as they might generate errors that are inappropriate for .pyi files (e.g., about missing docstrings). We recommend running flake8-pyi in a dedicated environment in your CI.

Lints provided

This plugin reserves codes starting with Y0. For a full list of lints currently provided by flake8-pyi, see the list of error codes.

Note that several error codes recommend using types from typing_extensions or _typeshed. Strictly speaking, these packages are not part of the standard library. However, these packages are included in typeshed's stdlib/ directory, meaning that type checkers believe them to be part of the standard library even if this does not reflect the reality at runtime. As such, since stubs are never executed at runtime, types from typing_extensions and _typeshed can be used freely in a stubs package, even if the package does not have an explicit dependency on either typing_extensions or typeshed.

Flake8-pyi's checks may produce false positives on stubs that aim to support Python 2.

License

MIT

Authors

Originally created by Łukasz Langa and now maintained by Jelle Zijlstra, Alex Waygood, Sebastian Rittau, Akuli, and Shantanu.

See also

flake8-pyi's People

Contributors

akuli avatar alexwaygood avatar ambv avatar avasam avatar bryanforbes avatar daverball avatar hauntsaninja avatar jayvdb avatar jellezijlstra avatar kennyballou avatar kkirsche avatar kotlinisland avatar pre-commit-ci[bot] avatar srittau avatar tomasr8 avatar twoertwein avatar xuehaipan avatar ymyzk avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.