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
Stubs with type annotations for ordered-set Python library

ordered-set-stubs - stubs with type annotations for ordered-set Python library Archived - now type annotations are the part of the ordered-set library

Roman Inflianskas 2 Feb 06, 2020
mypy plugin to type check Kubernetes resources

kubernetes-typed mypy plugin to dynamically define types for Kubernetes objects. Features Type checking for Custom Resources Type checking forkubernet

Artem Yarmoliuk 16 Oct 10, 2022
open source tools to generate mypy stubs from protobufs

mypy-protobuf: Generate mypy stub files from protobuf specs We just released a new major release mypy-protobuf 2. on 02/02/2021! It includes some back

Dropbox 527 Jan 03, 2023
Collection of awesome Python types, stubs, plugins, and tools to work with them.

Awesome Python Typing Collection of awesome Python types, stubs, plugins, and tools to work with them. Contents Static type checkers Dynamic type chec

TypedDjango 1.2k Jan 04, 2023
PEP-484 typing stubs for SQLAlchemy 1.4 and SQLAlchemy 2.0

SQLAlchemy 2 Stubs These are PEP-484 typing stubs for SQLAlchemy 1.4 and 2.0. They are released concurrently along with a Mypy extension which is desi

SQLAlchemy 139 Dec 30, 2022
Reference implementation of sentinels for the Python stdlib

Sentinels This is a reference implementation of a utility for the definition of sentinel values in Python. This also includes a draft PEP for the incl

Tal Einat 22 Aug 27, 2022
docstring style checker

pydocstyle - docstring style checker pydocstyle is a static analysis tool for checking compliance with Python docstring conventions. pydocstyle suppor

Python Code Quality Authority 982 Jan 03, 2023
Flashcards - A flash card application with 2 optional command line arguments

Flashcards A flash card application with 2 optional command line arguments impor

Özgür Yildirim 2 Jul 15, 2022
Pylint plugin to enforce some secure coding standards for Python.

Pylint Secure Coding Standard Plugin pylint plugin that enforces some secure coding standards. Installation pip install pylint-secure-coding-standard

Nguyen Damien 2 Jan 04, 2022
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
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
An enhanced version of the Python typing library.

typingplus An enhanced version of the Python typing library that always uses the latest version of typing available, regardless of which version of Py

Contains 6 Mar 26, 2021
Pymxs, the 3DsMax bindings of Maxscript to Python doesn't come with any stubs

PyMXS Stubs generator What Pymxs, the 3DsMax bindings of Maxscript to Python doe

Frieder Erdmann 19 Dec 27, 2022
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 967 Jan 07, 2023
flake8 plugin to catch useless `assert` statements

flake8-useless-assert flake8 plugin to catch useless assert statements Download or install on the PyPI page Violations Code Description Example ULA001

1 Feb 12, 2022
Flake8 plugin for managing type-checking imports & forward references

flake8-type-checking Lets you know which imports to put in type-checking blocks. For the imports you've already defined inside type-checking blocks, i

snok 67 Dec 16, 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
Plugin for mypy to support zope.interface

Plugin for mypy to support zope.interface The goal is to be able to make zope interfaces to be treated as types in mypy sense. Usage Install both mypy

Shoobx 36 Oct 29, 2022
Utilities for refactoring imports in python-like syntax.

aspy.refactor_imports Utilities for refactoring imports in python-like syntax. Installation pip install aspy.refactor_imports Examples aspy.refactor_i

Anthony Sottile 20 Nov 01, 2022
Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.

mypy_boto3_builder Type annotations builder for boto3-stubs project. Compatible with VSCode, PyCharm, Emacs, Sublime Text, mypy, pyright and other too

Vlad Emelianov 2 Dec 05, 2022