Giter Site home page Giter Site logo

meravici / mypy-pycharm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leinardi/mypy-pycharm

0.0 1.0 0.0 2.29 MB

A plugin providing both real-time and on-demand scanning of Python files with Mypy from within PyCharm/IDEA.

License: Apache License 2.0

Java 99.65% HTML 0.35%

mypy-pycharm's Introduction

mypy-pycharm

GitHub (pre-)release Travis GitHub license Stars

This plugin provides both real-time and on-demand scanning of Python files with Mypy from within PyCharm/IDEA.

Mypy is a Python source code analyzer which looks for programming errors, helps enforcing a coding standard and sniffs for some code smells (as defined in Martin Fowler's Refactoring book).

mypy plugin screenshot

Installation steps

  1. In the Settings/Preferences dialog (CTRL+Alt+S), click Plugins. The Plugins page opens.
  2. Click Browse repositories.
  3. In the Browse Repositories dialog that opens, right-click on the plugin named Mypy and select Download and Install.
  4. Confirm your intention to download and install the selected plugin.
  5. Click Close.
  6. Click OK in the Settings dialog and restart PyCharm for the changes to take effect.

Configuration

The only configuration needed is to set the path to Mypy executable, and only if is not already inside the PATH environment variable.

To reach the Plugin configuration screen you can open Settings/Preferences dialog (CTRL+Alt+S), click Other Settings and then Mypy or simply click the gear icon from the side bar of the Mypy tool window.

To change the path to your Mypy executable you can either type the path directly or use the Browse button to open a file selection dialog.

Once you changed the path you should press the Test button to check if the plugin is able to run the executable.

plugin settings screenshot

Inspection severity

By default, Mypy message severity is set to Warning. It is possible to change the severity level by going to Settings/Preferences dialog (CTRL+Alt+S) -> Editor -> Inspections -> Mypy -> Severity:

plugin inspection severity screenshot

Usage

plugin actions screenshot plugin actions screenshot

FAQ

When I click "Check Project/Module/Changes" I only get one error for one file, why?

It is a know issue of mypy: if the validation encounters a blocking error it just bails out completely ignoring the rest of the files. The biggest problem for the plugin is that currently there is no way to know if the check ended normally or because it encountered a blocking error (in the issue ticket there was a suggestion of using --verbose but it does not work, for exampble, for duplicate module naned errors).

How can I prevent the code inspection to run on a specific folder?

The easiest way to ignore a specific folder is to mark it as Excluded from PyCharm/IDEA:

  1. Open PyCharm/IDEA Settings -> your project -> Project structure
  2. Select the directory you want to exclude
  3. Click the Excluded button (red folder icon)

More info here.

The name of the plugin is mypy-pycharm, can I use it also with IntelliJ IDEA?

This plugin officially supports only PyCharm, but it should work also on IntelliJ IDEA if you have the Python Community Edition plugin installed. If it does not work, feel free to open a bug on the issue tracker.

I like this plugin, how can I support it?

The best way to support this plugin is to rate it on the JetBrains Plugin Repository page and to star this project on GitHub. Feedback is always welcome: if you found a bug or would like to suggest a feature, feel free to open an issue on the issue tracker. If your feedback doesn't fall in the previous categories, you can always leave a comment on the Plugin Repository page.

Acknowledgements

If I have seen further it is by standing on the shoulders of Giants - Isaac Newton

A huge thank you to the project CheckStyle-IDEA, which code and architecture I have heavily used when developing this plugin.

License

Copyright 2018 Roberto Leinardi.

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements.  See the NOTICE file distributed with this work for
additional information regarding copyright ownership.  The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License.  You may obtain a copy of
the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
License for the specific language governing permissions and limitations under
the License.

mypy-pycharm's People

Contributors

leinardi avatar fireundubh avatar aviskase avatar nullus avatar

Watchers

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