A simple plugin that allows running mypy from PyCharm and navigate between errors

Overview

mypy logo

mypy-PyCharm-plugin

The plugin provides a simple terminal to run fast mypy daemon from PyCharm with a single click or hotkey and easily navigate through type checking results. The idea of the mypy terminal is different from the normal PyCharm type checking that highlights the errors in a current file. The mypy terminal shows errors in all files in your project (even in those not currently open). Also mypy provides a bit stricter type checking and is tunable by various flags and config settings.

mypy plugin screenshot

Installation

The plugin can be installed directly from JetBrains plugin repository

Installing developer build

Requirements for building the plugin:

  • Oracle JDK 8
    • Either javac should be available on your PATH or JAVA_HOME environment variable should contain your JDK installation path

Requirements for running the plugin:

  • Mypy
    • The plugin runs the mypy executable to check types

Installation steps:

  1. Clone the GitHub repository.

  2. Open the cloned directory in your terminal and build it using this shell command:

    ./gradlew clean buildPlugin
    

    or on Windows:

    gradlew clean buildPlugin
    

    The plugin file mypy-PyCharm-plugin.zip will be built in build/distributions.

  3. In PyCharm go to Preferences -> Plugins -> Install plugins from disk -> Select the plugin file -> Restart PyCharm when prompted.

  4. After restart you should find the plugin in View -> Tool windows -> Mypy terminal.

Configuration

Normally, plugin should not require any configuration steps. However, sometimes plugin cannot find dmypy command because it doesn't have the full environment. If the plugin says something like dmypy command not found when you try to run mypy, then this is likely the cause. In this case right click in mypy terminal in PyCharm -> Configure plugin. Then enter the path where mypy is installed as PATH suffix. If you are using a virtual environment, this will look like /my/project/bin (or C:\my\project\Scripts if you are on Windows). If necessary, you can also configure mypy command to use your custom .ini file and flags.

Usage

You can pin the terminal to either side of PyCharm window: click on window toolbar → Move. The current default is bottom, which works best if you typically have only a few errors. If you are working on legacy code with many mypy errors, you may want to use the ‘left’ or ‘right’ setting. Finally, if you have multiple monitors you might find the floating mode convenient.

Currently supported features and keyboard shortcuts:

  • Show/hide mypy terminal: Ctrl + Shift + X
  • Run mypy type checking: Ctrl + Shift + M or click Run
  • Go to error: click on error line, or use Ctrl + Shift + <arrows> to navigate between errors
  • Copy current error: right click → Copy error text, or Ctrl + Shift + C
  • Collapse/expand errors: click on file name in the mypy terminal, or Ctrl + Shift + Enter when a file name is selected
  • Sometimes mypy shows links to online documentation; to follow links use Alt + <click>

Contributing

External contributions to the project should be subject to Dropbox Contributor License Agreement (CLA).

  1. Open the repository in IntelliJ 2019.1 or newer via File -> Open. IntelliJ will import it as a Gradle project.

  2. Set up a project JDK via File -> Project Structure -> Project -> Project SDK. JDK 8 or newer is required.

  3. Build and run the plugin via a Gradle task runIde available as View -> Tool Windows -> Gradle -> Tasks -> intellij -> runIde.


Copyright (c) 2018 Dropbox, Inc.

Owner
Dropbox
Dropbox
A python documentation linter which checks that the docstring description matches the definition.

Darglint A functional docstring linter which checks whether a docstring's description matches the actual function/method implementation. Darglint expe

Terrence Reilly 463 Dec 31, 2022
A Python Parser

parso - A Python Parser Parso is a Python parser that supports error recovery and round-trip parsing for different Python versions (in multiple Python

Dave Halter 520 Dec 26, 2022
Rust like Option and Result types in Python

Option Rust-like Option and Result types in Python, slotted and fully typed. An Option type represents an optional value, every Option is either Some

45 Dec 13, 2022
🦆 Better duck-typing with mypy-compatible extensions to Protocol

🦆 Quacks If it walks like a duck and it quacks like a duck, then it must be a duck Thanks to PEP544, Python now has protocols: a way to define duck t

Arie Bovenberg 9 Nov 14, 2022
Custom Python linting through AST expressions

bellybutton bellybutton is a customizable, easy-to-configure linting engine for Python. What is this good for? Tools like pylint and flake8 provide, o

H. Chase Stevens 249 Dec 31, 2022
Simple Python style checker in one Python file

pycodestyle (formerly called pep8) - Python style guide checker pycodestyle is a tool to check your Python code against some of the style conventions

Python Code Quality Authority 4.7k Jan 01, 2023
The official GitHub mirror of https://gitlab.com/pycqa/flake8

Flake8 Flake8 is a wrapper around these tools: PyFlakes pycodestyle Ned Batchelder's McCabe script Flake8 runs all the tools by launching the single f

Python Code Quality Authority 2.6k Jan 03, 2023
Backport Python 3.8+ typing utils & add issubtype & more

typing-utils Backport Python3.8+ typing utils & issubtype & more Install API issubtype get_origin get_args get_type_hints Install pip install typi

10 Nov 09, 2022
Flake8 extension to provide force-check option

flake8-force Flake8 extension to provide force-check option. When this option is enabled, flake8 performs all checks even if the target file cannot be

Kenichi Maehashi 9 Oct 29, 2022
Flake8 plugin to find commented out or dead code

flake8-eradicate flake8 plugin to find commented out (or so called "dead") code. This is quite important for the project in a long run. Based on eradi

wemake.services 277 Dec 27, 2022
Pylint plugin for improving code analysis for when using Django

pylint-django About pylint-django is a Pylint plugin for improving code analysis when analysing code using Django. It is also used by the Prospector t

Python Code Quality Authority 544 Jan 06, 2023
MonkeyType as a pytest plugin.

MonkeyType as a pytest plugin.

Marius van Niekerk 36 Nov 24, 2022
A static-analysis bot for Github

Imhotep, the peaceful builder. What is it? Imhotep is a tool which will comment on commits coming into your repository and check for syntactic errors

Justin Abrahms 221 Nov 10, 2022
flake8 plugin that integrates isort

Flake8 meet isort Use isort to check if the imports on your python files are sorted the way you expect. Add an .isort.cfg to define how you want your

Gil Forcada Codinachs 139 Nov 08, 2022
OpenStack Hacking Style Checks. Mirror of code maintained at opendev.org.

Introduction hacking is a set of flake8 plugins that test and enforce the OpenStack StyleGuide Hacking pins its dependencies, as a new release of some

Mirrors of opendev.org/openstack 224 Jan 05, 2023
flake8 plugin which checks that typing imports are properly guarded

flake8-typing-imports flake8 plugin which checks that typing imports are properly guarded installation pip install flake8-typing-imports flake8 codes

Anthony Sottile 50 Nov 01, 2022
Typed interface stubs for Pythonista iOS

Pythonista Stubs Stubs for the Pythonista iOS API. This allows for better error detection and IDE / editor autocomplete. Installation and Usage pip in

Harold Martin 12 Jul 14, 2020
A framework for detecting, highlighting and correcting grammatical errors on natural language text.

Gramformer Human and machine generated text often suffer from grammatical and/or typographical errors. It can be spelling, punctuation, grammatical or

Prithivida 1.3k Jan 08, 2023
A static type analyzer for Python code

pytype - 🦆 ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Python classes with types validation at runtime.

typedclasses Python classes with types validation at runtime. (Experimental & Under Development) Installation You can install this library using Pytho

Izhar Ahmad 8 Feb 06, 2022