Giter VIP home page Giter VIP logo

pyvenvmanage's Introduction

PyVenvManage

NOTE: This project is moved to pyvenvmanage/PyVenvManage and maintained there. PR-s and Issues opened here will be ignored.

Introduction

PyVenvManage is a plugin for managing the Python interpreter of Pycharm Projects.

It is a general issue that Python projects may have several interpreters in different virtual environments for the various versions of the language. Managing these venvs is easily done with tox, but configuring the project in Pycharm is painful.

With PyVenvManage the selection and setup of the venv is a few clicks without dialog boxes.

Features

  • Popup menu item to set the project interpreter
  • Icon provider to indicate virtual environments in the project view

Install from the Official PyCharm repository

In PyCharm open Settings -> Plugins, and install PyVenv Manage.

The official plugin page is at https://plugins.jetbrains.com/plugin/10085-pyvenv-manage

Usage

usage video

License

This project is licensed under the BSD-3-Clause license - see the LICENSE.

pyvenvmanage's People

Contributors

andrask avatar csatarigergely avatar gaborbernat avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyvenvmanage's Issues

Indicate which venv is currently in use

Would be good to see which one is currently used. Maybe by bolding the label (if that's possible) or using a different icon.
Icon layering: com.intellij.ui.LayeredIcon#setIcon(javax.swing.Icon, int)

No menu option when right clicking `venv/bin/python`, which is inconsistent with native IDE setting

This is arguably a nitpick, but since this UX issue seems easy to solve, I'll bring it up here.

When I use the IDE settings to set a Python environment, it asks for me to select the python exe to use. It doesn't accept the select of a venv directory. But this extension doesn't work when I reference the exe, only the directory.

It would be nice to have them both handle a reference to the exe.

When will the 1.1 release turn up in the plugin repo?

Hey thanks for releasing the new version ๐Ÿพ

I already installed it from disk as it does not turn up as an update from the repo. Is that a manual step you need to do also? Maybe this could also be handled as part of #4?

Incompatiblity with Intellij Idea 2021.1.1

Happenned after upgrading to 2021.1.1 from 2021.1.0
Build info

IntelliJ IDEA 2021.1.1 (Ultimate Edition)
Build #IU-211.7142.45, built on April 30, 2021
Runtime version: 11.0.10+9-b1341.41 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Linux 5.4.0-72-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 4029M
Cores: 8
Registry: ide.max.recent.projects=30, ide.mac.file.chooser.native=false
Non-Bundled Plugins: com.github.nokia.pyvenv (1.3.1), YAML/Ansible support (0.11.2), com.jetbrains.plugins.ini4idea (211.6693.44), org.jetbrains.plugins.rest (211.6693.44), com.intellij.lang.puppet (211.6693.44), org.plugin.dot.id (1.2), org.toml.lang (0.2.146.3826-211), ru.meanmail.plugin.requirements (2021.4-211), com.dmarcotte.handlebars (211.6693.44), org.jetbrains.plugins.vue (211.7142.13), com.jetbrains.php (211.7142.45), com.jetbrains.php.behat (211.6693.65), com.jetbrains.php.codeception (211.6693.65), com.jetbrains.php.dql (211.6693.65), com.jetbrains.twig (211.6693.44), de.espend.idea.php.toolbox (5.1.1), de.espend.idea.php.annotation (8.0.0), fr.adrienbrault.idea.symfony2plugin (0.23.208), org.jetbrains.plugins.ruby (211.7142.36)
Kotlin: 211-1.4.32-release-IJ7142.27
Current Desktop: ubuntu:GNOME

With PyVenv Manage 1.3.1

com.intellij.diagnostic.PluginException: com/jetbrains/python/sdk/PythonSdkType [Plugin: com.github.nokia.pyvenv]
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.instantiate(ActionManagerImpl.java:250)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convertStub(ActionManagerImpl.java:220)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getActionImpl(ActionManagerImpl.java:551)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActions(ActionManagerImpl.java:1601)
	at com.intellij.openapi.actionSystem.impl.ActionPreloader.preload(ActionPreloader.java:14)
	at com.intellij.openapi.application.Preloader.lambda$preload$0(Preloader.java:84)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
	at com.intellij.openapi.application.Preloader.lambda$preload$1(Preloader.java:74)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
	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.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: com/jetbrains/python/sdk/PythonSdkType
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.instantiate(ActionManagerImpl.java:233)
	... 23 more
Caused by: java.lang.ClassNotFoundException: com.jetbrains.python.sdk.PythonSdkType PluginClassLoader(plugin=PluginDescriptor(name=PyVenv Manage, id=com.github.nokia.pyvenv, descriptorPath=plugin.xml, path=~/.local/share/JetBrains/IntelliJIdea2021.1/PyVenv Manage, version=1.3.1, package=null), packagePrefix=null, instanceId=1, state=active)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:215)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 26 more

Incompatible with PyCharm 2020.3 EAP 203.5600.33

Exception:

2020-11-10 03:05:57,520 [ 128583]  ERROR - rains.concurrency.AsyncPromise - PyCharm 2020.3 EAP  Build #PY-203.5600.33 
2020-11-10 03:05:57,520 [ 128583]  ERROR - rains.concurrency.AsyncPromise - JDK: 11.0.8; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o. 
2020-11-10 03:05:57,520 [ 128583]  ERROR - rains.concurrency.AsyncPromise - OS: Linux 
2020-11-10 03:05:57,520 [ 128583]  ERROR - rains.concurrency.AsyncPromise - Plugin to blame: PyVenv Manage version: 1.2 
2020-11-10 03:05:57,521 [ 128584]  ERROR - rains.concurrency.AsyncPromise - Last Action: ShowSettings 
2020-11-10 03:05:57,521 [ 128584]  ERROR - rains.concurrency.AsyncPromise - 'java.lang.String com.jetbrains.python.sdk.PythonSdkType.getPythonExecutable(java.lang.String)' 
java.lang.NoSuchMethodError: 'java.lang.String com.jetbrains.python.sdk.PythonSdkType.getPythonExecutable(java.lang.String)'
	at com.github.nokia.VenvIconProvider.getIcon(VenvIconProvider.java:28)
	at com.intellij.ide.projectView.impl.CompoundIconProvider.getIcon(CompoundIconProvider.java:32)
	at com.intellij.ide.projectView.impl.CompoundIconProvider.findIcon(CompoundIconProvider.java:55)
	at com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode.setupIcon(PsiDirectoryNode.java:169)
	at com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode.updateImpl(PsiDirectoryNode.java:119)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.lambda$doUpdate$1(AbstractPsiBasedNode.java:166)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:855)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.doUpdate(AbstractPsiBasedNode.java:141)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.lambda$update$0(AbstractPsiBasedNode.java:137)
	at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:169)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:127)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:116)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:111)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.update(AbstractPsiBasedNode.java:137)
	at com.intellij.ide.util.treeView.PresentableNodeDescriptor.getUpdatedPresentation(PresentableNodeDescriptor.java:76)
	at com.intellij.ide.util.treeView.PresentableNodeDescriptor.update(PresentableNodeDescriptor.java:29)
	at com.intellij.ui.tree.StructureTreeModel$Node.update(StructureTreeModel.java:453)
	at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:435)
	at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:427)
	at com.intellij.ui.tree.StructureTreeModel.getValidChildren(StructureTreeModel.java:389)
	at com.intellij.ui.tree.StructureTreeModel.validateChildren(StructureTreeModel.java:298)
	at com.intellij.ui.tree.StructureTreeModel.getNode(StructureTreeModel.java:292)
	at com.intellij.ui.tree.StructureTreeModel.getChildren(StructureTreeModel.java:312)
	at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.getNode(AsyncTreeModel.java:561)
	at com.intellij.ui.tree.AsyncTreeModel$Command.get(AsyncTreeModel.java:456)
	at com.intellij.ui.tree.AsyncTreeModel$Command.get(AsyncTreeModel.java:422)
	at com.intellij.util.concurrency.Invoker$Task.run(Invoker.java:316)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1137)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:76)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:152)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:113)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:59)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:110)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:76)
	at com.intellij.util.concurrency.Invoker.invokeSafely(Invoker.java:205)
	at com.intellij.util.concurrency.Invoker.lambda$offerSafely$0(Invoker.java:183)
	at com.intellij.util.concurrency.Invoker$Background.lambda$offer$0(Invoker.java:541)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
	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.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)

Feature request: Auto activation

Hello, I finally got a solution to solve really tedious task to set python intepreters for every project. Many thanks!

Since every virtualenv directories has specific format just as project_dir/.venv or home/.venv, I think automatically activation can be added for those directories.

How do you think about these feature? I found the solutions using shell script, but it seems to be kind a workaround for me.

Thanks in advance.

Provide compatibility with CLion

Is there a general show-stopper for providing this really helpful plugin also for CLion?
If not so, please add CLion to the list of supported IDEs.

NoSuchMethodError crash report

Using PyVenvManage 1.2, with the following IntelliJ build -

IntelliJ IDEA 2019.3 EAP (Ultimate Edition)
Build #IU-193.3793.14, built on September 25, 2019
IntelliJ IDEA EAP User
Expiration date: October 25, 2019
Runtime version: 11.0.4+10-b485.1 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 16
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: Groovy Console Plugin, Lombook Plugin, Pythonid, com.github.nokia.pyvenv, com.paperetto.dash, detekt, dk.demus.idea.CodeNarc, org.intellij.plugins.hcl, org.intellij.scala, org.jetbrains.plugins.vue
java.lang.NoSuchMethodError: 'java.lang.String com.jetbrains.python.sdk.PythonSdkType.getPythonExecutable(java.lang.String)'
	at com.github.nokia.VenvIconProvider.getLayerIcon(VenvIconProvider.java:40)
	at com.intellij.ui.CoreIconManager.createLayeredIcon(CoreIconManager.java:72)
	at com.intellij.ui.CoreIconManager.createLayeredIcon(CoreIconManager.java:19)
	at com.intellij.psi.impl.JavaDirectoryIconProvider.getIcon(JavaDirectoryIconProvider.java:65)
	at com.intellij.ide.projectView.impl.CompoundIconProvider.getIcon(CompoundIconProvider.java:34)
	at com.intellij.ide.projectView.impl.CompoundIconProvider.findIcon(CompoundIconProvider.java:60)
	at com.intellij.ide.scopeView.ScopeViewTreeModel$Node.getFolderIcon(ScopeViewTreeModel.java:496)
	at com.intellij.ide.scopeView.ScopeViewTreeModel$ProjectNode.lambda$createChildren$2(ScopeViewTreeModel.java:562)
	at com.intellij.util.SmartList.forEach(SmartList.java:348)
	at com.intellij.ide.scopeView.ScopeViewTreeModel$ProjectNode.createChildren(ScopeViewTreeModel.java:559)
	at com.intellij.ide.scopeView.ScopeViewTreeModel$FileNode.createChildren(ScopeViewTreeModel.java:697)
	at com.intellij.ide.scopeView.ScopeViewTreeModel$Node.getChildren(ScopeViewTreeModel.java:466)
	at com.intellij.ide.scopeView.ScopeViewTreeModel$GroupNode.createChildren(ScopeViewTreeModel.java:916)
	at com.intellij.ide.scopeView.ScopeViewTreeModel$Node.getChildren(ScopeViewTreeModel.java:466)
	at com.intellij.ide.scopeView.ScopeViewTreeModel.getChildCount(ScopeViewTreeModel.java:352)
	at com.intellij.ui.tree.BaseTreeModel.isLeaf(BaseTreeModel.java:12)
	at com.intellij.ide.scopeView.ScopeViewTreeModel.isLeaf(ScopeViewTreeModel.java:345)
	at com.intellij.ui.tree.AsyncTreeModel.getLeafState(AsyncTreeModel.java:443)
	at com.intellij.ui.tree.AsyncTreeModel.access$1800(AsyncTreeModel.java:42)
	at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.load(AsyncTreeModel.java:614)
	at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.getNode(AsyncTreeModel.java:587)
	at com.intellij.ui.tree.AsyncTreeModel$ObsolescentCommand.get(AsyncTreeModel.java:480)
	at com.intellij.ui.tree.AsyncTreeModel$ObsolescentCommand.get(AsyncTreeModel.java:446)
	at com.intellij.util.concurrency.Command$Processor.lambda$process$1(Command.java:48)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:986)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:70)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:124)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:170)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:592)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:538)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:113)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:70)
	at com.intellij.util.concurrency.Invoker.invokeSafely(Invoker.java:171)
	at com.intellij.util.concurrency.Invoker.lambda$invokeLater$0(Invoker.java:106)
	at com.intellij.util.concurrency.Invoker$Background.lambda$offer$0(Invoker.java:448)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
	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)

Settings do need a bit to catch up

Hi, I really enjoy using that plugin, thank you very much

One thing that is a bit confusing is that when you have set the interpreter and then go into the "Project interpreter" settings it's tells you that there is no interpreter set. If you close the modal and open it up again, the interpreter is displayed correctly, so it must be some kind of minor information propagation glitch.

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.