GithubHelp home page GithubHelp logo

sidharthv96 / mypy-vscode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matangover/mypy-vscode

0.0 2.0 0.0 203 KB

VS Code extension that provides type checking and analysis for Python code using mypy.

Home Page: https://marketplace.visualstudio.com/items?itemName=matangover.mypy

License: Other

TypeScript 100.00%

mypy-vscode's Introduction

Mypy extension for VS Code

Runs mypy on Python code to provide type checking.

  • Runs on your entire workspace. (This is different from Microsoft's Python extension's mypy functionality which only lints each file separately, leading to incomplete type checking.)

  • Uses the mypy daemon to keep the analysis state in memory so that only changed files are rechecked.

  • Respects the active Python interpreter (set in the Python extension) and the mypy.ini configuration file.

  • Supports multi-root workspaces: will launch a separate mypy daemon for each workspace folder.

Installing mypy

This extension requires mypy to be installed on your system. To install mypy, run pip install mypy. There are other ways to install mypy, such as using pipx or your system's package manager.

By default, this extension relies on having the dmypy executable available on your PATH. This should be the case if you installed mypy globally. To use a different mypy installation, set the mypy.dmypyExecutable setting.

Some people prefer to have mypy installed in each project's virtual environment rather than in a global location. To do this, enable mypy.runUsingActiveInterpreter.

Configuration

To configure mypy, you can create a mypy.ini file in your workspace folder (or any of the default locations). See mypy configuration file. You can also specify a custom path to mypy.ini using the mypy.configFile setting.

To configure the mypy-vscode extension, use the following VS Code settings:

  • mypy.targets: specify a list of target files or folders for mypy to analyze. By default the entire workspace folder is checked. You may prefer to use the files option in mypy.ini to specify which files mypy should analyze. In that case, you should set mypy.targets to an empty array ([]).

  • mypy.dmypyExecutable: Path to dmypy (the mypy daemon). Either a full path or just a name (which must exist in your PATH). You can use substitutions: ${workspaceFolder} and ~ (home directory).

  • mypy.runUsingActiveInterpreter: Use the active Python interpreter (selected in the Python extension) to run dmypy itself, instead of the mypy.dmypyExecutable setting. Note: your code is always checked against the active interpreter โ€“ this setting only controls the interpreter used to run dmypy itself.

  • mypy.configFile: Mypy config file, relative to the workspace folder. If empty, search in the default locations. See https://mypy.readthedocs.io/en/latest/config_file.html.

Note for users upgrading from an older version

Previously, this extension used mypyls (the Mypy Language Server). However, this is no longer the case: the extension now uses the mypy daemon directly. See the change log for details. If you have previously installed mypyls, the extension will continue to use mypy from that same installation. If you want, you can uninstall mypyls and install mypy separately.

Also, in previous versions this extension automatically enabled mypy's check_untyped_defs setting by default (see documentatation). However, for consistency with mypy's defaults, the extension no longer does this. To re-enable this option, use the mypy config file.

License

This project is made available under the MIT License.

mypy-vscode's People

Contributors

matangover avatar gatesn avatar ferozco avatar st4lk avatar tonich-sh avatar andfoy avatar gwk avatar kashewnuts avatar lgeiger avatar worldsender avatar dependabot[bot] avatar d-kimuson avatar

Watchers

James Cloos avatar  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.