Giter Site home page Giter Site logo

leinardi / mypy-pycharm Goto Github PK

View Code? Open in Web Editor NEW
186.0 7.0 31.0 2.45 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.33% HTML 0.67%
mypy pycharm pycharm-plugin python

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 to enforce 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 thanks:

License

Copyright 2021 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

aviskase avatar fireundubh avatar intgr avatar jack-hegman avatar kotlinisland avatar leinardi avatar nullus avatar pwmarcz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mypy-pycharm's Issues

current version reports missing png file as exception

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.11.1
  • PyCharm/IDEA version: (see below)
  • Mypy version: 0.770
PyCharm 2020.1 (Professional Edition)
Build #PY-201.6668.115, built on April 7, 2020
(license info removed)
Runtime version: 11.0.6+8-b765.25 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Non-Bundled Plugins: ... com.leinardi.pycharm.mypy, com.leinardi.pycharm.pylint, ...

Step 3: Describe the problem:

Steps to reproduce:

  1. Install/Activate mypy plugin
  2. Load a python file
  3. See a flashing red icon in the lower left-hand corner

Observed Results:

  • Report of failure

Expected Results:

  • No report of failure

Relevant Code:

System.out.println("Hello, world!");
com.intellij.diagnostic.PluginException: Icon cannot be found in '/modules/modulesNode.png', action 'class com.leinardi.pycharm.mypy.actions.ScanModule' [Plugin: com.leinardi.pycharm.mypy]
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.reportActionError(ActionManagerImpl.java:394)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.reportActionError(ActionManagerImpl.java:389)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.access$000(ActionManagerImpl.java:75)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$1.compute(ActionManagerImpl.java:289)
	at com.intellij.openapi.util.IconLoader$LazyIcon.getOrComputeIcon(IconLoader.java:1097)
	at com.intellij.openapi.util.IconLoader$LazyIcon.getIconWidth(IconLoader.java:1079)
	at com.intellij.openapi.util.IconLoader.isGoodSize(IconLoader.java:413)
	at com.intellij.openapi.actionSystem.impl.ActionButton.updateIcon(ActionButton.java:334)
	at com.intellij.openapi.actionSystem.impl.ActionButton.update(ActionButton.java:243)
	at com.intellij.openapi.actionSystem.impl.ActionButton.addNotify(ActionButton.java:236)
	at java.desktop/java.awt.Container.addImpl(Container.java:1146)
	at java.desktop/java.awt.Container.add(Container.java:436)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.fillToolBar(ActionToolbarImpl.java:311)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.actionsUpdated(ActionToolbarImpl.java:1107)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsImpl(ActionToolbarImpl.java:1090)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.access$000(ActionToolbarImpl.java:53)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl$1.updateActionsImpl(ActionToolbarImpl.java:162)
	at com.intellij.openapi.actionSystem.impl.ToolbarUpdater$MyUpdateRunnable.run(ToolbarUpdater.java:157)
	at com.intellij.openapi.actionSystem.impl.ToolbarUpdater.updateActions(ToolbarUpdater.java:76)
	at com.intellij.openapi.actionSystem.impl.ToolbarUpdater.updateActions(ToolbarUpdater.java:69)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsImmediately(ActionToolbarImpl.java:1072)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.addNotify(ActionToolbarImpl.java:202)
	at java.desktop/java.awt.Container.addNotify(Container.java:2800)
	at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4791)
	at java.desktop/java.awt.Container.addNotify(Container.java:2800)
	at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4791)
	at java.desktop/java.awt.Container.addImpl(Container.java:1146)
	at java.desktop/java.awt.Container.add(Container.java:997)
	at com.intellij.openapi.wm.impl.content.ToolWindowContentUi.ensureSelectedContentVisible(ToolWindowContentUi.java:222)
	at com.intellij.openapi.wm.impl.content.ToolWindowContentUi.access$400(ToolWindowContentUi.java:46)
	at com.intellij.openapi.wm.impl.content.ToolWindowContentUi$1.selectionChanged(ToolWindowContentUi.java:120)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:127)
	at com.intellij.util.EventDispatcher.access$000(EventDispatcher.java:21)
	at com.intellij.util.EventDispatcher$1.invoke(EventDispatcher.java:85)
	at com.sun.proxy.$Proxy118.selectionChanged(Unknown Source)
	at com.intellij.ui.content.impl.ContentManagerImpl.fireSelectionChanged(ContentManagerImpl.java:579)
	at com.intellij.ui.content.impl.ContentManagerImpl.addSelectedContent(ContentManagerImpl.java:397)
	at com.intellij.ui.content.impl.ContentManagerImpl$1.run(ContentManagerImpl.java:487)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContent(ContentManagerImpl.java:503)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:454)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:443)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:521)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContent(ContentManagerImpl.java:526)
	at com.intellij.ui.content.impl.ContentManagerImpl.doAddContent(ContentManagerImpl.java:177)
	at com.intellij.ui.content.impl.ContentManagerImpl.addContent(ContentManagerImpl.java:159)
	at com.leinardi.pycharm.mypy.toolwindow.MypyToolWindowFactory.createToolWindowContent(MypyToolWindowFactory.java:35)
	at com.intellij.openapi.wm.impl.ToolWindowImpl.createContentIfNeeded$intellij_platform_ide_impl(ToolWindowImpl.kt:493)
	at com.intellij.openapi.wm.impl.ToolWindowImpl.scheduleContentInitializationIfNeeded$intellij_platform_ide_impl(ToolWindowImpl.kt:473)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.doShowWindow(ToolWindowManagerImpl.kt:918)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.showToolWindowImpl(ToolWindowManagerImpl.kt:864)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow(ToolWindowManagerImpl.kt:578)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow$default(ToolWindowManagerImpl.kt:561)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activated$intellij_platform_ide_impl(ToolWindowManagerImpl.kt:1769)
	at com.intellij.openapi.wm.impl.StripeButton$1.actionPerformed(StripeButton.java:62)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:401)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6651)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345)
	at com.intellij.openapi.wm.impl.StripeButton.processMouseEvent(StripeButton.java:312)
	at java.desktop/java.awt.Component.processEvent(Component.java:6416)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:912)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:844)
	at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:739)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Likely coming from

icon="/modules/modulesNode.png">

Pretty much identical to leinardi/pylint-pycharm#63

Make available to CLion

Even though CLion has a python plugin that supports most/all of what Pycharm does, this plugin isn't available for it. It is available for IntelliJ, I notice. Could the plugin be made installable on CLion as well?

PyCharm error report (java.lang.Throwable: Mypy path detect process.exitValue: 1)

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.6
  • PyCharm/IDEA version: 2019.2.3 (pro)
  • Mypy version: 0.720
  • Python version: 3.7.4, from Anaconda

Step 3: Describe the problem:

  1. I currently just started to use the plugin and mypy and did not do any special things.
  2. The plugin is work, however sometimes an error appears.
  3. Maybe, it is related to create a mypy cache (.mypy_cache folder)?

Description from event log:

java.lang.Throwable: Mypy path detect process.exitValue: 1
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.detectSystemMypyPath(MypyRunner.java:219)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.getMypyPath(MypyRunner.java:147)
	at com.leinardi.pycharm.mypy.ui.MypyConfigPanel.createUIComponents(MypyConfigPanel.java:98)
	at com.leinardi.pycharm.mypy.ui.MypyConfigPanel.$$$setupUI$$$(MypyConfigPanel.java)
	at com.leinardi.pycharm.mypy.ui.MypyConfigPanel.<init>(MypyConfigPanel.java:46)
	at com.leinardi.pycharm.mypy.MypyConfigurable.<init>(MypyConfigurable.java:38)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:88)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:66)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:48)
	at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:73)
	at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:67)
	at com.intellij.openapi.options.ConfigurableEP$ClassProducer.createElement(ConfigurableEP.java:369)
	at com.intellij.openapi.options.ConfigurableEP.createConfigurable(ConfigurableEP.java:278)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.createConfigurable(ConfigurableWrapper.java:43)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.getConfigurable(ConfigurableWrapper.java:108)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.cast(ConfigurableWrapper.java:83)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.getDisplayName(ConfigurableWrapper.java:129)
	at com.intellij.openapi.options.newEditor.SettingsTreeView$MyNode.<init>(SettingsTreeView.java:513)
	at com.intellij.openapi.options.newEditor.SettingsTreeView$MyNode.<init>(SettingsTreeView.java:501)
	at com.intellij.openapi.options.newEditor.SettingsTreeView$MyRoot.buildChildren(SettingsTreeView.java:494)
	at com.intellij.ui.treeStructure.CachingSimpleNode.getChildren(CachingSimpleNode.java:39)
	at com.intellij.ui.treeStructure.SimpleTreeStructure.getChildElements(SimpleTreeStructure.java:27)
	at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:66)
	at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.rebuild(FilteringTreeStructure.java:61)
	at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.<init>(FilteringTreeStructure.java:53)
	at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.<init>(FilteringTreeStructure.java:44)
	at com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder.<init>(FilteringTreeBuilder.java:49)
	at com.intellij.openapi.options.newEditor.SettingsTreeView$MyBuilder.<init>(SettingsTreeView.java:919)
	at com.intellij.openapi.options.newEditor.SettingsTreeView.<init>(SettingsTreeView.java:174)
	at com.intellij.openapi.options.newEditor.SettingsDialog.treeViewFactory(SettingsDialog.java:72)
	at com.intellij.openapi.options.newEditor.SettingsEditor.<init>(SettingsEditor.java:162)
	at com.intellij.openapi.options.newEditor.SettingsDialog.<init>(SettingsDialog.java:65)
	at com.intellij.openapi.options.newEditor.SettingsDialogFactory.create(SettingsDialogFactory.java:38)
	at com.intellij.ide.actions.ShowSettingsUtilImpl.getDialog(ShowSettingsUtilImpl.java:44)
	at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:84)
	at com.intellij.ide.actions.ShowSettingsAction.perform(ShowSettingsAction.java:54)
	at com.intellij.ui.mac.MacOSApplicationProvider$Worker.lambda$null$1(MacOSApplicationProvider.java:62)
	at com.intellij.ui.mac.MacOSApplicationProvider$Worker.lambda$submit$7(MacOSApplicationProvider.java:153)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:82)
	at com.intellij.openapi.application.TransactionGuardImpl.lambda$pollQueueLater$0(TransactionGuardImpl.java:67)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:824)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:773)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:412)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:411)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

java.lang.Throwable: Mypy path detect process.exitValue: 1

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: ?
  • PyCharm/IDEA version: ?
  • Mypy version: ?

Step 3: Describe the problem:

Steps to reproduce:




Observed Results:

Expected Results:

Relevant Code:

System.out.println("Hello, world!");
java.lang.RuntimeException: This is an example Exception log
    at com.leinardi.HelloWorld
    at com.leinardi.HelloWorld$ThisIsNotARealLog
    at bigcorporate.app.Instrumentation.callActivityOnResume(Instrumentation.kt)

Argument list too long

Step 1: Are you in the right place?

  • [x ] I have verified there are no duplicate active or recent bugs, questions, or requests
  • [ x] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.4
  • PyCharm/IDEA version: 2019.2
  • Mypy version: 0.720

Step 3: Describe the problem:

Steps to reproduce:

  1. Run mypy check project when our private source code proect is open

Observed Results:

Plugins prints:
The scan failed due to an error - please see the event log for more information

Expected Results:

Get a list of mypy errors.

Relevant Code:

Sorry I cant share the project/code.

15:24	Unexpected Exception Caught
			The scan failed due to an exception: Error creating Mypy process
			Root cause:
			error=7, Argument list too long
			java.io.IOException: error=7, Argument list too long
			at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
			at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
			at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
			at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
			at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
			at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:443)
			at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:408)
			at com.leinardi.pycharm.mypy.mpapi.MypyRunner.runMypy(MypyRunner.java:304)
			at com.leinardi.pycharm.mypy.mpapi.MypyRunner.scan(MypyRunner.java... (show balloon)

Schermafbeelding 2019-08-28 om 15 31 16

Ability to see the command line being passed to mypy

Is your feature request related to a problem? Please describe.

I'm having issues where your PyCharm mypy plugin fails to report some errors that are successfully reported by the running mypy on the command line (issue #21).

Describe the solution you'd like

I'd like it if there was a way to see the command line that's being passed to mypy, to make sure that I understand what it is doing compared with running mypy manually on the command line. There are several different options in the plugin (running on file vs module vs project) and it's not clear how those all work or why they might give different output than running directly on the command line.

degrade better

Once installing this plugin it assumes all projects use mypy, which may not be the case. In such cases the plugin crashes instead should disable itself perhaps:

java.lang.Throwable: Error while checking Mypy path: Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/mypy", line 6, in <module>
    from mypy.__main__ import console_entry
ModuleNotFoundError: No module named 'mypy'
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:102)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:176)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:152)
	at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
	at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:339)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Following exceptions happened soon after this one, most probably they are induced.


2019-05-09T08:50:52.271
java.lang.Throwable: Error while checking Mypy path: Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/mypy", line 6, in <module>
    from mypy.__main__ import console_entry
ModuleNotFoundError: No module named 'mypy'
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:102)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:176)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:152)
	at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
	at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:339)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)


2019-05-09T08:50:52.273
java.lang.Throwable: Mypy path check process.exitValue: 1
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:111)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:176)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:152)
	at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
	at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:339)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Honour noinspection comments

Is your feature request related to a problem? Please describe.
Perhaps this is a bug, but I'm not sure... Basically, it would be nice if the plugin's scan results honoured # noinspection Mypy

Describe the solution you'd like
Any lines of code which are preceded by # noinspection Mypy should be ignored by the plugin and therefore any errors/warnings mypy finds in those lines should not appear in the results panel.

Additional context
It seems that either PyCharm or this plugin does correctly suppress warnings within the editor window. See attached screenshots for an unsuppressed warning in the editor, the suppression of that warning, and the warning persisting in the scan panel (after re-running a scan)

screen shot 2018-09-03 at 13 53 42
screen shot 2018-09-03 at 13 53 52
screen shot 2018-09-03 at 13 54 00

"Check Project" Only Scans One File

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.7.0
  • PyCharm/IDEA version: PyCharm 2018.2.2
  • Mypy version: mypy 0.620

Step 3: Describe the problem:

Steps to reproduce:

  1. Click "Check Project"

Observed Results:

  • The scan runs, but only one file - which happens to be the first python file in the project's first module - is scanned.
  • Clicking "Check Current File" results in the currently active python file (which is not the same file as that which is scanned when clicking "Check Project") being scanned as expected.

Expected Results:

  • I expected that the scan would run against all python files - recursively - in all modules underneath the project root, as defined in PyCharm's Project Structure settings

Use pycharms type information in addition to type hints

Is your feature request related to a problem? Please describe.
A project I'm working on doesn't like type hints in the code, so I used the doc string format :param type name: description and :rtype: type to get pycharms own type checker to function.
Mypy does not understand/aims to support this, however.

Describe the solution you'd like
Since this is a pycharm plugin, it would be nice if it could access the pycharm-specific type information and add it into what mypy is using.

Describe alternatives you've considered
Remove the mypy plugin since it can not add significant value in my case, but a lot of CPU load.

Remote Interpreter

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.11.2
  • PyCharm/IDEA version: 2020.1.1
  • Mypy version: 0.782

Step 3: Describe the problem:

Steps to reproduce:

  1. Run 'Check current file'


Observed Results:

  • Error message:

No Python interpreter configured for this project
The project is configured with a remote interpreter, but I have mypy installed locally

Expected Results:

  • mypy output

Any way to disable realtime scanning?

Hi,
I've tries to use plugin with PyCharm but it eats a lot of CPU with realtime scanning.
I prefer to call extra inspections manually so disabled plugin and switched to common mypy.
Would you like to implement such an option?
Thank you.

Inspection does not work on attached projects

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.6
  • PyCharm/IDEA version: 2019.2.3
  • Mypy version: 0.740

Step 3: Describe the problem:

Steps to reproduce:

I'm using an attached project in pycharm. The mypy inspection works on the first project, but when I hit 'Check Project' only this project is checked. Furthermore the imports used from the second project (which is also marked as source code folder in pycharm) are not found. It seems that the second project is not added to the MYPYPATH

Also when I open a file in the second project (with a mypy violation) and I press 'Check current file', it says "Mypy found no problems".

After pressing the 'Check project' Button the imported module of the second project is not found:

module_not_found

Scanning project_file2 with 'Check current file'
scanning_file_two

Thank you

mypy config file is not valid

Step 1: Are you in the right place?

  • [X ] I have verified there are no duplicate active or recent bugs, questions, or requests
  • [X ] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.11.2
  • PyCharm/IDEA version: Professional 2020.2
  • Mypy version: 0.790

Step 3: Describe the problem:

Steps to reproduce:

  1. Install plugin and restart PyCharm
  2. Test mypy executable in settings (working)
  3. Confirm config file setting automatically set to setup.cfg in my git working directory (i.e. C:/Projects/DragenEngineering/trip_runner2/setup.cfg)
  4. Open mypy tool window and run scan

Observed Results:

  • The scan failed due to an error -please see the event log for more information

Expected Results:

  • successfully report any mypy issues

Event Log

9:55 AM	Unexpected Exception Caught
				The scan failed due to an exception: mypy config file is not valid. File does not exist or can't be read.
				com.leinardi.pycharm.mypy.exception.MypyPluginException: mypy config file is not valid. File does not exist or can't be read.

				at com.leinardi.pycharm.mypy.mpapi.MypyRunner.getMypyConfigFile(MypyRunner.java:197)

				at com.leinardi.pycharm.mypy.mpapi.MypyRunner.scan(MypyRunner.java:249)

				at com.leinardi.pycharm.mypy.checker.ScanFiles.scan(ScanFiles.java:109)

				at com.leinardi.pycharm.mypy.checker.ScanFiles.checkFiles(ScanFiles.java:100)

				at com.leinardi.pycharm.mypy.checker.ScanFiles.call(ScanFiles.java:74)

				at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:88)

				at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)

				at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:2... (show balloon)

Setup,cfg

[mypy]
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
disallow_subclassing_any = True
warn_no_return = True
strict_optional = True
strict_equality = True
no_implicit_optional = True
disallow_any_generics = True
disallow_any_unimported = False
warn_redundant_casts = True
warn_unused_ignores = True
warn_unused_configs = True
show_traceback = True
show_error_codes = True
always_false = MYPYC
python_version = 3.7
namespace_packages = True

Mypy found no issues.

Hi. I'll try configure plugin for PyCharm. Always I get this notification: "Mypy found no issues".
It doesn't matter if I choose to check for a file or project.

When I type in terminal:
mypy .
I correctly got errors.

This is my config: https://pastebin.com/HrkTPL5Z

Config in PyCham:
Path to mypy executable: /usr/local/bin/mypy
Path to config file: /Users/michal/Projekty/project_name/setup.cfg

The test gives the correct result.

OS: macOS Catalina
PyCharm 2019.3.4

Auto detect mypy bin in virtual env

Is your feature request related to a problem? Please describe.
After installing the plugin I was surprised to see an exception raised because of mypy not found in the project even though it is available in the virtual env.

Describe the solution you'd like
I'd like the auto detect to look for the mypy bin in the virtual env.

Additional context
It's best practice to install mypy as a dev dependency inside a virtual env

Giving warning "cannot find implementation or library stub for module" when source code in a sub folder

It warns cannot find implementation or library stub for module when I put my source code in a sub folder, while running directly mypy pacro will show no warnings.

$ tree
├── mypy.ini
├── pacro
│   ├── ast_nodes.py
│   ├── basic_interpreter.py
│   ├── basic_lexer.py
│   ├── basic_parser.py
│   ├── lexer_config.py
│   ├── lexer_token.py
│   ├── main.py
│   ├── pacro.py
│   ├── token_types.py
│   └── utils.py
└── README.md
$ cat mypy.ini
[mypy]
mypy_path = 'pacro'

$ mypy pacro
Success: no issues found in 10 source files

typing.Literal does not work correctly in idea

Step 1: Are you in the right place?

  • [ x] I have verified there are no duplicate active or recent bugs, questions, or requests
  • [ x] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.11.1
  • PyCharm/IDEA version: IDEA 2019.2.3(Ultimate Edition)
  • Mypy version: 0.761
  • Python: 3.8.2

Step 3: Describe the problem:

My code is:

test.py

from typing import Literal

T = Literal[1, 2]


def test(v: T) -> int:
    print(v)
    return v


if __name__ == '__main__':
    test(4)

Observed Results:

line 6: It prompts me Mypy: Variable "test.T" is not valid as a type .
line 12: It does not prompt me that the parameter can only be 1 or 2.

2020-02-29_01-18.png

Expected Results:

line6: there should be no hint

line12: expect a warning said the parameter can only be 1 or 2 .

Relevant Code:

Make the mypy plugin work with mypy installed under WSL when using Windows.

Is your feature request related to a problem? Please describe.
I use this plugin on IntelliJ and Pycharm under Windows. My python interpreter and virtual environments are all on WSL, a linux environment that runs under Windows 10. This plugin (and the pylint plugin cannot use a mypy installed in WSL. I give it the right path but I get an error that it cannot execute.

Describe the solution you'd like
Enable the use of mypy installed under WSL when running in Windows (and ideally using a remote interpreter)

Describe alternatives you've considered

  1. Install python 3.8.1 on windows, the windows version of pipx and then mypy.exe in windows using pipx. This sort of works but then mypy cannot find the packages I'm using in each project. So I have to manually activate the virtual environment pipx has created for mypy and then install the packages I need under that.

  2. 1 is no better than creating a windows based virtual environment and installing mypy in that so I'm not doing this anymore. I now create a linux virtual environment under WSL and a regular Windows virtual environment only for pylint and mypy which includes the other packages the project uses. Still not great because there are some python packages that I use that cannot be installed under Windows and mypy (and pylint) will complain due to them being missing.

Additional context
Ideally you would come up with a general solution that will work with remote python interpreters. Basically I would like to be able to install mypy (and pylint) under a python interpreter on a remote machine and have this plugin use that pylint and mypy when I'm working with a python interpreter on a remote machine.

Thanks for the great mypy and pylint plugins.

failed on python 2.7 virtualenv

Step 1: Are you in the right place?

  • [ x] I have verified there are no duplicate active or recent bugs, questions, or requests
  • [ x] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.2
  • PyCharm/IDEA version: 2017.3
  • Mypy version: mypy 0.630

Step 3: Describe the problem:

Error in Event Log of Pycharm after click on Test button in Settings > Mypy

10:03 AM	Mypy Plugin: Failure: executable "/usr/local/bin/python3.7 -m mypy" not found
10:03 AM	Mypy Plugin: Failure: executable "mypy" not found

Steps to reproduce:

  1. Setup project's virtualenv using python 2.7. My project requires it
  2. Set Path to mypy executable as: mypy or /usr/local/bin/python3.7 -m mypy
  3. Click Test button
  4. Found error in Event Log

According to Mypy's document, it needs python 3 to run but able to verify both python 2.7 and 3 source code.

Unable to configure mypy binary on Linux

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.2
  • PyCharm/IDEA version: 2018.2.4 (CE)
  • Mypy version: 0.641

Step 3: Describe the problem:

Steps to reproduce:

  1. I am using Ubuntu/Debian based distro
  2. I have both python2 and python3 installed
  3. Installed python3-pip
  4. installed mypy using pip3 install mypy
  5. Properly installed in /usr/local/bin/mypy
  6. above path is in $PATH
  7. mypy runs when started from shell
  8. Attempt to configure your plugin with either mypy or /usr/local/bin/mypy as mypy binary does not work (test fails) with Mypy Plugin: Failure: executable "mypy" not found.

This looks similar to #12

WSL interpreter report No Python interpreter configured for the project

Step 1: Are you in the right place?

  • [x ] I have verified there are no duplicate active or recent bugs, questions, or requests
  • [x ] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 1.0.6
  • PyCharm/IDEA version: pycharm 2019.3
  • Mypy version: 0.761

MacOS: Error while checking Mypy path

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.2
  • PyCharm/IDEA version: 2018.3.4 Build #PY-183.5429.31
  • Mypy version: 0.620

Step 3: Describe the problem:

Steps to reproduce:

  1. Install mypy using brew install mypy
  2. Restart pycharm

Observed Results:

  • Pycharm indicates a fatal error "Error while checking Mypy path"

Expected Results:

  • Pycharm should load without complaining

Relevant Code:

I think the plugin is throwing an error when executing the /usr/local/bin/mypy file as installed by brew but I can't see why. This file contains:

#!/bin/bash
PYTHONPATH="/usr/local/Cellar/mypy/0.620/libexec/lib/python3.7/site-packages:/usr/local/Cellar/mypy/0.620/libexec/vendor/lib/python3.7/site-packages" exec "/usr/local/Cellar/mypy/0.620/libexec/bin/mypy" "$@"
java.lang.Throwable: Error while checking Mypy path:   File "/usr/local/bin/mypy", line 2
    PYTHONPATH="/usr/local/Cellar/mypy/0.620/libexec/lib/python3.7/site-packages:/usr/local/Cellar/mypy/0.620/libexec/vendor/lib/python3.7/site-packages" exec "/usr/local/Cellar/mypy/0.620/libexec/bin/mypy" "$@"
                                                                                                                                                             ^
SyntaxError: invalid syntax
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:134)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:102)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:176)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:152)
	at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
	at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:337)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

image

PyCharm error report

java.lang.Throwable: Mypy path detect process.exitValue: 1
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.detectSystemMypyPath(MypyRunner.java:219)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.getMypyPath(MypyRunner.java:147)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.getMypyPath(MypyRunner.java:125)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:179)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:153)
at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: ?
  • PyCharm/IDEA version: ?
  • Mypy version: ?

Step 3: Describe the problem:

Steps to reproduce:




Observed Results:

Expected Results:

Relevant Code:

System.out.println("Hello, world!");
java.lang.RuntimeException: This is an example Exception log
    at com.leinardi.HelloWorld
    at com.leinardi.HelloWorld$ThisIsNotARealLog
    at bigcorporate.app.Instrumentation.callActivityOnResume(Instrumentation.kt)

configuring myPy in IntelliJ Ultimate in Linux

23:15 Mypy Plugin: Failure: executable "/usr/bin/mypy" not found

while:

zbyszek@Predator /usr/bin $ mypy
usage: mypy [-h] [-v] [-V] [more options; see below]
[-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.

I'm also getting an exception, please take a look that it points out to directory instead of file:

Error while checking Mypy path

com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "/opt/jdk1.8.0_211": error=13, Brak dostępu
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:416)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:96)
at com.leinardi.pycharm.mypy.ui.MypyConfigPanel$TestAction.actionPerformed(MypyConfigPanel.java:115)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6550)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at java.awt.Component.processEvent(Component.java:6315)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4899)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4721)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4721)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:739)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:741)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:686)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:385)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.awt.Dialog.show(Dialog.java:1077)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:688)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:427)
at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1682)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1631)
at com.intellij.openapi.options.newEditor.SettingsDialog.lambda$show$0(SettingsDialog.java:73)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:153)
at com.intellij.openapi.options.newEditor.SettingsDialog.show(SettingsDialog.java:73)
at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:84)
at com.intellij.ide.actions.ShowSettingsAction.perform(ShowSettingsAction.java:54)
at com.intellij.ide.actions.ShowSettingsAction.actionPerformed(ShowSettingsAction.java:41)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:261)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:278)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:616)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$2(IdeKeyEventDispatcher.java:665)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:664)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:512)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:467)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:217)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:665)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:385)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.io.IOException: Cannot run program "/opt/jdk1.8.0_211": error=13, Brak dostępu
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:444)
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:412)
... 72 more
Caused by: java.io.IOException: error=13, Brak dostępu
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 74 more

Traceback when opening PyCharm project

Step 2: Describe your environment

  • Plugin version: 0.10.2
  • PyCharm/IDEA version: 2018.2.4
  • Mypy version: None

Step 3: Describe the problem:

Steps to reproduce:

  1. Install mypy plugin without mypy package
  2. Open another project
  • IDE Fatal Error notification.

Expected Results:

  • mypy plugin disabled

Relevant Code:

None

java.lang.Throwable: Error while detecting Mypy path: INFO: Could not find files for the given pattern(s).
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:123)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.detectSystemMypyPath(MypyRunner.java:212)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.getMypyPath(MypyRunner.java:146)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.getMypyPath(MypyRunner.java:124)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:176)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:152)
	at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
	at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:337)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)#### Observed Results:

ide error

Windows: Failure: executable "mypy.exe" not found

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.0
  • PyCharm/IDEA version: 2018.2.2 Community
  • Mypy version: 0.630
  • OS: Windows 10

Step 3: Describe the problem:

image

When you hit the test button:

10:48 AM    Mypy Plugin: Failure: executable "H:\Miniconda3\envs\dev36\Scripts\mypy.exe" not found

From a cmd window I can prove the mypy executable exists (via installing mypy via pip) and runs:

H:\Miniconda3\envs\dev36\Scripts>.\mypy.exe
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.

The above directory is on the path, and I can run mypy from any directory on a command window and it will give the same output as above.

(original issue reported on stackoverflow)

Comparisson to PyCharm's checker

Description of related problem

I would like to decide if I want to use mypy in general and this project in particular.
PyCharm already has a static checker for Python.
Apparently they developed it themselves without using mypy.
I would like to know how to decide if I want to stick with PyCharm's checker or move to mypy / this plugin.

Solution I'd like

I would like to have a comparision of the advantages / disadvantages of either solution.
Is there already one?

Use mypy within docker

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • [] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: ?
  • PyCharm/IDEA version: PyCharm 2018.3.5 (Professional Edition)
    Build #PY-183.5912.18, built on February 26, 2019
    JRE: 1.8.0_152-release-1343-b28 amd64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Windows 10 10.0
  • Mypy version: ?

Step 3: Describe the problem:

Steps to reproduce:

  1. When using project interpreter in docker compose, it is impossible to specify mypy executable path, and I am constantly getting popups saying that mypy is missing. I have set up it to use my host system mypy, and even installed it in the docker interpreter, but the pop ups continue.

Expected Results:

it should be possible to use mypy within docker.

10:55	Packages installed successfully: Installed packages: 'mypy'

10:58	Mypy Plugin (Mypy missing)
			The project interpreter is missing Mypy, which is needed to properly check the imports.
			Install Mypy

Plugin fails to report errors which are reported by running mypy on command line

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.2
  • PyCharm/IDEA version: Community Edition 2018.2
  • Mypy version: 0.630 (installed in venv folder automatically by plugin)

Step 3: Describe the problem:

I'm encountering cases where the plugin is failing to list mypy errors in the error list window, but running mypy on the command line shows the errors.

I'm getting this in a large and complex proprietary project that I cannot paste the source of, but I have reproduced similar behaviour in a small test project

Steps to reproduce:

  1. Make a new project File->New Project
  2. Make two new python files in the project, File1.py and File2.py
  3. Add the following contents to the files

in File1.py:

class MyClass:

    x:int
    y:str

in File2.py:

import File1

from typing import List

def SomeFunction( stuffs : List[File1.MyClass] ) -> None:

    a = File1.MyClass()
    a.foo = "bar"

    b = 1
    b = "2"

    for stuff in stuffs:
        stuff.foo = "bar"
        stuff["hello"] = "goodbye"
  • With File2.py open, press the "Check Current File" button in in the mypy plugin window
  • On the command line,

Observed Results:

On the command line, I get the following errors from the same mypy executable that the plugin installed for me automatically:

PS C:\Users\admin\PycharmProjects\Test> C:\Users\admin\PycharmProjects\Test\venv\Scripts\mypy.exe .\File2.py
File2.py:9: error: "MyClass" has no attribute "foo"
File2.py:12: error: Incompatible types in assignment (expression has type "str", variable has type "int")
File2.py:15: error: "MyClass" has no attribute "foo"
File2.py:16: error: Unsupported target for indexed assignment

but in the mypy plugin window I only get one of the errors, only the one about the variable b

image

None of the errors related to the MyClass defined in File1.py appear.

When I run using the "Check Module" button in the plugin I do successfully get all four errors in this case

image

However, I'm unsatisfied with this for two reasons:

  • The command line above is only checking the single file, and is still able to detect errors related to the MyClass type even though it is defined externally, so why should the plugin not be able to?
  • It's hard to know what the plugin is doing when I press the "Check Current File" button that's different from what I'm doing on the command line (see Issue #20 )
  • In my larger, more complicated project, I'm getting errors that command-line mypy detects but neither the "Check Current File" operation nor the "Check Module" operation in the plugin list, and it's not clear why.

macOS this plugin leaks memory badly

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: ``
  • PyCharm/IDEA version: 2019.2
  • Mypy version: 0.10.4

Step 3: Describe the problem:

Steps to reproduce:

  1. install in pycharm, run pycharm. Works.
  2. MacOS start "activity monitor". Look at all the "python" process names started. If you run "ps -Af" you can see that they are orphaned mypy PIDs. Someone (ie pycharm mypy) started a mypy session and lost control of the PID. Never cleans up.
  3. I have to run kill PID or kill with the activity monitor. If I don't it will eventually kill the Apple OS.

Observed Results:

Expected Results:

Relevant Code:

System.out.println("Hello, world!");
java.lang.RuntimeException: This is an example Exception log
    at com.leinardi.HelloWorld
    at com.leinardi.HelloWorld$ThisIsNotARealLog
    at bigcorporate.app.Instrumentation.callActivityOnResume(Instrumentation.kt)

Mypy plugin 0.10.6 resulted in IDE error after creating a .adoc file in PyCharm 2019.2.3

Error while checking Mypy path

com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "D:\BetterPython": CreateProcess error=5, Zugriff verweigert
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:412)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:97)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:179)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:153)
at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: Cannot run program "D:\BetterPython": CreateProcess error=5, Zugriff verweigert
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:443)
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:408)
... 10 more
Caused by: java.io.IOException: CreateProcess error=5, Zugriff verweigert
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.(ProcessImpl.java:420)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:151)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 13 more

Major performance issues with background scanning

Hi so I have been having major issues with the plugin in pycharm in windows. When enabled the ide becomes incredibly unresponsive, especially when running autocompletes and suggestions.

What makes the issue more difficult is that there is no way to use the widget separately, with all the type inspections disabled the performance issues persist, but if I modify the file location for mypy so its broken I get no issues.

So at the moment I am going into mypy plugin settings removing the mypy file when working and then when I want to use the widget going back in and adding the mypy file to the plugin.

While these performance issues do need to be addressed I would also like the option to just use the widget, I opened up issue #40 to request this but the advice did not solve my issue and my follow up questions has been left unanswered.

Any advice would be greatly appreciated,

(I have attached my settings repository for pycharm if that helps to diagnose the issue, happening on both my laptop and desktop)

ide-pycharm-master.zip

thanks,
Simon

Static methods missing a type definition are highlighted incorrectly

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.2
  • PyCharm/IDEA version: PyCharm 2018.2
  • Mypy version: 0.620

Step 3: Describe the problem:

Steps to reproduce:

  1. Write a method annotated with @staticmethod.
  2. Run the mypy checker.

Observed Results:

The highlight exposing a missing type definition starts immediately after the staticmethod annotation and ends right before def.

screen shot 2018-09-27 at 9 44 07 am

screenshot 2018-09-27 09 45 05

Expected Results:

def should be highlighted.

Relevant Code:

    @staticmethod
    def email_sent_on(obj):
        return obj.created_on

Availibility to run realtime checking for the whole project, not for one file

If the project has a package with classes, and that classes are imported, typecheck doesn't work for that imported classes properties when running 'check current file'. Realtime checking seems to run this option and doesn't show project errors in the editor.

It would be much more convenient if real-time typechecking worked like 'check project' option with setting it in plugin options.

java.lang.NullPointerException

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.2
  • PyCharm/IDEA version: 2018.2.4
  • Mypy version: 0.630

Step 3: Describe the problem:

Received following Java error message when starting up PyCharm after restarting after installing this plugin via PyCharm's repository..

Steps to reproduce:

  1. Installed mypy into my Miniconda environment via conda install mypy
  2. Installed mypy-pycharm via PyCharm's plugin repository
  3. Restarted PyCharm which then opened up my prior opened PyCharm projects.

Observed Results:

  • Popup message with following Java stack trace:
java.lang.Throwable: Error while checking Mypy path: Traceback (most recent call last):
  File "/Users/JDFagan/miniconda3/bin/mypy", line 7, in <module>
    from mypy.__main__ import console_entry
ModuleNotFoundError: No module named 'mypy'
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:123)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:102)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:176)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:152)
	at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
	at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:337)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Expected Results:

  • No stacktrace

Relevant Code:

Not sure yet if it's caused by specific code in my project.

N/A

Forgot to snap screenshot. Will update this issue if I can reproduce it.

Failure: executable "[...]mypy.exe" not found

This is the exact same issue as #12 which supposedly was fixed but apparently not for me.

Step 1: Are you in the right place?

  • [x ] I have verified there are no duplicate active or recent bugs, questions, or requests
  • [ x] I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.4
  • PyCharm/IDEA version: PyCharm 2019.1.3 Pro
  • Mypy version: 0.711
  • OS: Windows 10

Step 3: Describe the problem:

Steps to reproduce:

  1. In 'Settings -> Mypy', set path to mypy.exe in current environment.
  2. Click 'test'.

Error message: "Failure: executable "[...]mypy.exe" not found".

The path is correct and mypy.exe runs properly from the Anaconda prompt.

stacktrace.txt:

java.lang.Throwable: Error while checking Mypy path: Traceback (most recent call last):
  File "C:\Users\nasos\Anaconda3\envs\myenv\Scripts\mypy-script.py", line 5, in <module>
    from mypy.__main__ import console_entry
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\__main__.py", line 4, in <module>
    from mypy.main import main
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\main.py", line 11, in <module>
    from mypy import build
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\build.py", line 62, in <module>
    from mypy.metastore import MetadataStore, FilesystemMetadataStore, SqliteMetadataStore
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\metastore.py", line 12, in <module>
    import sqlite3
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\sqlite3\__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\sqlite3\dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:103)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:177)
	at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:153)
	at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
	at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:339)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Workaround

Adding '%USERPROFILE% \Anaconda3\envs[ENVIRONMENT NAME]\Library\bin' to the path resolved the issue.

Modifying the display, delaying or disabling "Mypy: unexpected EOF while parsing"

PyCharm shows the error "Mypy: unexpected EOF while parsing" in a strip that it inserts at the top of the current editor window. If real-time Mypy checking is enabled (definitely a good thing), typing in new code necessarily breaks syntax until the statement being entered is completed. So the EOF error report strip keeps appearing and disappearing, jolting the text up and down.

The problem is not the error report itself (perfectly valid), just the way PyCharm displays it. I couldn't find any way to configure handling this error separately.

How could this be addressed? Perhaps by pre-allocating the space for errors and warnings at top of the window (and blanking it when there are none), so that the rest of the window is not disturbed. Or by delaying this report for, say, 30 seconds after the last keystroke (resetting the time window on new typing).

Provide more accurate type information from mypy

Is your feature request related to a problem? Please describe.
PyCharm is one of the more mature python IDEs out there in terms of static type analysis, but sometimes it fails to infer types on some circumstances, generic descriptors for example, get resolved to their generic typevar T instead of the value it generalizes, amongst other things.
MyPy will correctly handle more complex type inference cases (including generic descriptors), and given that at the end, MyPy will decide if your project passes the test suites or not (assuming you use it as a linter), it would make sense to gather type information from mypy instead of having a different logic doing the same job twice.

Describe the solution you'd like
If possible, type information could be gathered from mypy cache files, and then presented to the user similar to how the Python Community Edition for idea does it.

Plans to utilize dmypy (the daemon)?

Is your feature request related to a problem? Please describe.
Currently the scanning is quite slow. It can take 5-10 seconds for IntelliJ to perform the scan once you save a file.

Describe the solution you'd like
If dmypy were to be utilized the scans should be incredibly more efficient and faster. It could take less than a second most of the time.

Describe alternatives you've considered
The Dropbox team has a Mypy plugin (https://github.com/dropbox/mypy-PyCharm-plugin) but it's terrible in every single way except for performance. The configuration lives in a weird place, not many configuration options, and no real-time scan/showing errors in the editor. However, maybe their code for running the daemon could be used?

I know this issue has sorta been mentioned before, but no answer was ever given with regards to what the plans are for this.

Projects without configured python interpreter cause tool to not run

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.6
  • PyCharm/IDEA version: 2019.3.1
  • Mypy version: 0.730

Step 3: Describe the problem:

Steps to reproduce:

  1. Create new PyCharm project, and choose python interpreter/virtualenv for it. Install mypy into the interpreter.

  2. Attach 1-2 more projects to same window but don't configure python interpreters for them.

  3. Configure mypy of project 1's interpreter in Other Settings > Mypy. Ensure binary is found by clicking Test. It works.

  4. Open a file in project 1 (the one that has python interpreter configured) and click Run in Mypy terminal.

  5. An error pops up:

    image

  6. The error has link to Configure Python interpreter. Click it, settings open. Ensure your project has python interpreter configured correctly.

  7. Add interpreters for the other 1-2 projects. Don't install mypy into them.

  8. Run Mypy plugin, an error pops up:

    image

It's somewhat random, I have several projects open in same window, and some of those don't have python interpreter attached (because they are configuration repositories, with no code). Some of these trigger the errors, some don't.

Expected Results:

Shouldn't nag about python interpreter as it's already correctly configured. Shouldn't nag about missing mypy, as it's in the virtualenv selected for the project.

Support for .pyi files

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.10.6
  • PyCharm/IDEA version: 2019.2.4
  • Mypy version: 0.740

Step 3: Describe the problem:

Steps to reproduce:

  1. create new package
  2. add foo.py with no annotations
  3. add foo.py with annotations

Observed Results:

  • When running mypy from terminal with -p flag all of the package passes
  • When running from mypy-pycharm missing annotation errors are thrown.

Expected Results:

  • Stub files should be used when running the type check.

I'm fairly new to mypy and to the plugin. This might just be something that I'm doing inccorectly

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.