ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
535 stars 126 forks source link

Empty environment variables on IntelliJ IDEA 2022.2 (Community Edition) #185

Closed luiscoms closed 1 year ago

luiscoms commented 2 years ago

I am getting empty environment variables on Python projects even I set a value after IntelliJ Update

IntelliJ IDEA 2022.2 (Community Edition)
Build #IC-222.3345.118, built on July 26, 2022
Runtime version: 17.0.3+7-b469.32 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.0-41-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1960M
Cores: 8
Non-Bundled Plugins:
    Key Promoter X (2022.2)
    org.sonarlint.idea (6.8.0.50884)
    PythonCore (222.3345.118)
    ru.meanmail.plugin.requirements (2022.3-222-EAP-SNAPSHOT)
    net.ashald.envfile (3.2.2)
    ru.adelf.idea.dotenv (2022.2)
    izhangzhihao.rainbow.brackets (6.25)

Kotlin: 222-1.7.10-release-334-IJ3345.118
Current Desktop: ubuntu:GNOME
chrisbroome commented 2 years ago

Same issue is happening with IntelliJ IDEA 2022.2 (Ultimate Edition) as well.

IntelliJ IDEA 2022.2 (Ultimate Edition)
Build #IU-222.3345.118, built on July 26, 2022

Runtime version: 17.0.3+7-b469.32 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Metal Rendering is ON
Non-Bundled Plugins:
    org.rust.lang (0.4.175.4772-222)
    com.intellij.nativeDebug (222.3345.111)
    org.jetbrains.plugins.go (222.3345.118)
    com.jetbrains.lang.ejs (222.3345.108)
    com.intellij.plugins.html.instantEditing (222.3345.108)
    Pythonid (222.3345.118)
    net.ashald.envfile (3.2.2)
    com.leinardi.pycharm.pylint (0.14.0)
    org.intellij.scala (2022.2.10)
    com.cursiveclojure.cursive (1.12.4-2022.2)

Kotlin: 222-1.7.10-release-334-IJ3345.118
ghost commented 2 years ago

Same here.

PyCharm 2022.2 (Community Edition)
Build #PC-222.3345.131, built on July 27, 2022
Runtime version: 17.0.3+7-b469.32 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.8.0-63-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1994M
Cores: 12
Non-Bundled Plugins:
    org.jetbrains.intellij.scripting-javascript (1.0)
    org.intellij.plugins.hcl (222.3345.108)
    net.seesharpsoft.intellij.plugins.csv (2.19.0)
    name.kropp.intellij.makefile (222.3345.108)
    com.jetbrains.plugins.ini4idea (222.3345.108)
    com.intellij.ideolog (203.0.30.0)
    com.4lex4.intellij.solarized (2.4.0)
    mobi.hsz.idea.gitignore (4.4.2)
    net.ashald.envfile (3.2.2)
    com.y4kstudios.pytestimp (0.8.0)
    Docker (222.3345.118)
    ru.adelf.idea.dotenv (2022.2)
    Batch Scripts Support (1.0.13)

Current Desktop: ubuntu:GNOME
pivoshenko commented 2 years ago

Same for me.

PyCharm 2022.2 (Professional Edition)
Build #PY-222.3345.131, built on July 27, 2022
Licensed to Volodymyr Pivoshenko
Subscription is active until October 10, 2022.
Runtime version: 17.0.3+7-b469.32 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.6.7
GC: G1 Young Generation, G1 Old Generation
Memory: 3096M
Cores: 12
Metal Rendering is ON
Registry:
    debugger.watches.in.variables=false
    ide.balloon.shadow.size=0

Non-Bundled Plugins:
    uk.co.hadoopathome.intellij.avro.intellijavroviewer (3.0.0)
    socrates.tabshifter (0.30)
    org.rust.lang (0.4.175.4772-222)
    org.jetbrains.action-tracker (0.3.3)
    org.intellij.qodana (222.3345.108)
    org.ice1000.julia (0.4.2)
    net.sf.opk.avro-schema-support (213.1.0)
    net.seesharpsoft.intellij.plugins.csv (2.19.0)
    name.kropp.intellij.makefile (222.3345.108)
    lermitage.intellij.extratci (1.23.0.201)
    leetcode-editor (8.2)
    jms-messenger (2.0.1)
    indent-rainbow.indent-rainbow (2.0.2)
    idea.plugin.protoeditor (222.3345.108)
    de.docs_as_co.intellij.plugin.diagramsnet (0.1.12)
    com.wakatime.intellij.plugin (14.0.6)
    com.vecheslav.darculaDarkerTheme (1.2.0)
    com.mroche.JsonHelper (1.2.0)
    com.markskelton.one-dark-theme (5.6.0)
    org.intellij.plugins.hcl (222.3345.108)
    com.intellij.plugins.vscodekeymap (222.3345.111)
    com.intellij.plugins.macoskeymap (222.3345.108)
    com.intellij.javafx (1.0.4)
    com.intellij.ideolog (203.0.30.0)
    com.intellij.grpc (222.3345.108)
    com.intellij.apacheConfig (222.3345.108)
    com.github.patou.gitmoji (1.10.0)
    com.github.lppedd.idea-conventional-commit (0.21.0)
    com.github.balintrudas.avro-random-generator (1.0.2)
    com.4lex4.intellij.solarized (2.4.0)
    club.nutsoft.Github3Theme (1.1.9)
    appland.appmap (0.7.10)
    String Manipulation (9.5.0)
    Key Promoter X (2022.2)
    IdeaVIM (1.10.3)
    GrepConsole (12.14.211.6693.0)
    zielu.gittoolbox (212.9.7)
    mobi.hsz.idea.gitignore (4.4.2)
    com.mallowigi (65.1.0)
    PlantUML integration (5.16.1)
    com.intellij.lang.jsgraphql (3.2.1)
    com.intellij.queryComplexity (222.3345.108)
    org.asciidoctor.intellij.asciidoc (0.37.33)
    com.intellij.swagger (222.3345.108)
    ru.meanmail.plugins.prettify-python (2020.2-222-EAP-SNAPSHOT)
    ru.meanmail.plugin.requirements (2022.3-222-EAP-SNAPSHOT)
    org.jfrog.idea (1.16.0)
    net.ashald.envfile (3.2.2)
    izhangzhihao.rainbow.brackets (6.25)
    com.intellij.bigdatatools (222.3048.12)
    com.google.idea.bazel.ijwb (2022.07.25.0.1-api-version-222)
    com.github.copilot (1.1.28.1744)
    R4Intellij (222.3345.118)
    ru.adelf.idea.dotenv (2022.2)
    aws.toolkit (1.48-222)
wb7777 commented 2 years ago

@ashald

Same.

I have a stack trace:

image

stack trace ``` java.lang.Throwable: Assertion failed: dataContext has no component for new ListPopupStep at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:220) at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.createStep(PopupFactoryImpl.java:251) at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.(PopupFactoryImpl.java:209) at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.(PopupFactoryImpl.java:176) at com.intellij.ui.popup.PopupFactoryImpl.createActionGroupPopup(PopupFactoryImpl.java:341) at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel.doAddAction(EnvFileConfigurationPanel.java:244) at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel.access$600(EnvFileConfigurationPanel.java:38) at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel$4.run(EnvFileConfigurationPanel.java:109) at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel$4.run(EnvFileConfigurationPanel.java:106) at com.intellij.ui.ToolbarDecorator$3.doAdd(ToolbarDecorator.java:535) at com.intellij.ui.CommonActionsPanel$AddButton.actionPerformed(CommonActionsPanel.java:315) at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:190) at com.intellij.openapi.actionSystem.impl.ActionButton.lambda$performAction$0(ActionButton.java:166) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337) at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:166) at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:465) at java.desktop/java.awt.Component.processEvent(Component.java:6413) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:121) at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:191) at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:236) at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:234) at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:234) at java.desktop/java.awt.Dialog.show(Dialog.java:1080) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:712) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:453) at com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1672) at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1630) at com.intellij.execution.actions.EditRunConfigurationsAction.actionPerformed(EditRunConfigurationsAction.java:27) at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:315) at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:294) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:294) at com.intellij.openapi.actionSystem.ex.ActionUtil.invokeAction(ActionUtil.java:516) at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:232) at com.intellij.ui.popup.ActionPopupStep.lambda$onChosen$1(ActionPopupStep.java:220) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1543) at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:113) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:179) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:163) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1540) at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:162) at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:326) at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.dispose(PopupFactoryImpl.java:266) at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:126) at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:158) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:217) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:205) at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:266) at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:434) at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:406) at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:361) at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.handleSelect(PopupFactoryImpl.java:278) at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:618) at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6648) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392) at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:694) at java.desktop/java.awt.Component.processEvent(Component.java:6413) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) ```
leandrorebelo commented 2 years ago

Same error here

robertosegura commented 2 years ago

Having the same error.

sepbot commented 2 years ago

Existing feature request for making this a native feature of the IDE:

https://youtrack.jetbrains.com/issue/IDEA-137820 https://youtrack.jetbrains.com/issue/PY-5543

Cabalist commented 2 years ago

oof. ... Those feature requests are 11 and 7 years old respectively.

ebarti commented 1 year ago

@ashald

Same.

I have a stack trace:

image stack trace

This issue is fixed in the master branch of this repo (see https://github.com/ashald/EnvFile/pull/158 ), which has not yet been published. You can install it by building from source and adding the plugin from the generated zip file.

I have tried it and the issue of empty env vars persists, which means it unfortunately is not related to this exception and there is no fix available yet... 😞

sterwill commented 1 year ago

I'm not a user of the EnvFile plugin, but I'm subscribed to updates on PY-5543 and I saw a comment about the recent version incompatibility.

For EnvFile users with simple .env files, in key=value format, patch-env might be a good work-around until this plugin gets updated. pip install patch-env and set PATCH_ENV_COMMAND in your run config to a command whose output declares all the environment variables you want in your Python process's environment.

PATCH_ENV_COMMAND="cat first.env second.env"

patch-env doesn't do environment variable substitution or support or other input formats, but it will run any command you specify to get its input, so you can be creative with how the variable data gets assembled.

KhanMechAI commented 1 year ago

For those wanting to employ then patch_env solution with an env file local to your script/module path, you can use something like this:

PATCH_ENV_COMMAND=cat $(pwd)/.env

mousomer commented 1 year ago

@KhanMechAI Use: grep -Ev '(#|^$)' $env_file_name to skip comments and empty lines in the env file.

larrykooper commented 1 year ago

For me, installing Pycharm Professional 2021.3.3 fixed the issue. You can do it here https://www.jetbrains.com/pycharm/download/other.html I am running a Mac with Apple silicon

OlehChyhyryn commented 1 year ago

@larrykooper degrading of your PyCharm version is not the issue fix

SpudInNZ commented 1 year ago

@ashald Is this project being maintained? Is there a fix for this issue on the horizon?

OlehChyhyryn commented 1 year ago

@ashald previous time fix took a lot of time. So it's rarely supported

youssefmzouri commented 1 year ago

Same here :(

dehidehidehi commented 1 year ago

Same issue here

dehidehidehi commented 1 year ago

@KhanMechAI Use: grep -Ev '(#|^$)' $env_file_name to skip comments and empty lines in the env file.

Here's a bash script which would allow to easily concatenate the contents of multiple .env files. Just save this script and pass the .env file path (relative or absolute) as arguments.

#!/bin/bash
# Documentation here :
# https://gist.github.com/dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d
# Here's a bash script which would allow to easily concatenate the contents of multiple .env files.
# Just save this script and pass the .env file path (relative or absolute) as arguments.

ENV_VARS_LIST=""
for envFile in $@
do
  grep -Ev '(#|^$)' $envFile
done

# Credits:
# The base idea for this script is credited to 
# https://github.com/sterwill  
# Grep idea is credited to
# https://github.com/mousomer

Examples usage: patchEnvProvider.sh envfile1.sh envfile2.sh envfile3.sh

Here's the link to the gist in case I update the code. https://gist.github.com/dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d

Astro1247 commented 1 year ago

Got same issue in PyCharm 2022.2.1 Professional Edition.

Build #PY-222.3739.56, built on August 16, 2022

Runtime version: 17.0.3+7-b469.37 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

It worked before IDE update, but now I get empty env variables in any existing/new run configurations.

sherghan commented 1 year ago

Same issue, PyCharm 2022.2.1 Pro. I used to have shell automation for changing environment files and everything would run smoothly. Now I'm flooded with hand updated configuration profiles that constantly get out of date.

wizardion commented 1 year ago

@ashald Do you plan to fix this issue or is this project abandoned already?

Thorbenl commented 1 year ago

@ashald are u planning to fix this?

HassanAbouelela commented 1 year ago

I can't quite figure out why it's broken, but I managed to get the plugin working in pycharm using an experimental internal API. Releases here | Diff | CI for the release


Notes for developers: Using the EP above means it builds, and works for IDE version 2022.2, but it might break in the future. I pushed the changes to my fork and I'm trying to get it to work for the other IDEs. For those who'd like to debug, the EP used in the idea portion doesn't seem to exist anymore, but the people in the slack assured me it still does 🀷. For the other IDEs, they use a separate EP which is still accessible, but for some reason, the patchCommandLine method is no longer called. I brought up both of these issues in the slack here, but I'm still struggling to get help.

Small update: I managed to find from the Go EP that the patchCommandLine method is actually deprecated, though that isn't marked on the base class that all these EPs inherit from, nor is it marked on the python EP. No alternative is proposed. The most consistent thing about the intellij plugin platform is how terrible an experience it is.

RockyMM commented 1 year ago

@HassanAbouelela thank you so much for this. Really looking forward to a stable solution.

HassanAbouelela commented 1 year ago

Follow up: I have some bad news, and some good news. I asked on the slack again, and this time I got confirmation that this is in fact a bug! This most likely means that the plugin will not work in 2022.2 (unless we find other workarounds like the one for pycharm).

The good news is that this is a bug, and hopefully will be fixed or we'll get an alternative. I'll update this issue with a YouTrack issue later.

modernNeo commented 1 year ago

degrading of your PyCharm version is not the issue fix

@olegchigirin but it provides a very use-able workaround for the time-being though. and its pretty easy to change what version you are using with the toolbox

HassanAbouelela commented 1 year ago

Youtrack: https://youtrack.jetbrains.com/issue/PY-56172/RunConfigurationpatchCommandLine-Not-Called-In-20222

There's a lot of templates to choose from here, lets hope this was reported correctly, and to have a fix in the next version πŸ˜….

ghukill commented 1 year ago

FWIW, I'm using the following pycharm build:

PyCharm 2022.2.2 (Professional Edition)
Build #PY-222.4167.33, built on September 15, 2022
Runtime version: 17.0.4+7-b469.53 amd64
...
Non-Bundled Plugins:
    ...
    net.ashald.envfile (3.2.4)
    ...

And this v3.2.4 release of the plugin from @HassanAbouelela appears to work. Many thanks for this stopgap!

voneiden commented 1 year ago

FYI @HassanAbouelela 's 3.2.4 appears to work on Python modules with IDEA too, although I do get some noisy errors thrown presumably since the idea implementation is commented out in build.gradle

Caused by: java.lang.ClassNotFoundException: net.ashald.envfile.products.idea.IdeaRunConfigurationExtension PluginClassLoader(plugin=PluginDescriptor(name=EnvFile, id=net.ashald.envfile, descriptorPath=plugin.xml, path=~/.local/share/JetBrains/IntelliJIdea2022.2/EnvFile, version=3.2.4, package=null, isBundled=false), packagePrefix=null, instanceId=363, state=active)
Olegt0rr commented 1 year ago

@ashald, is this repo abandoned? Should I use @HassanAbouelela fork instead?

Vanderhoof commented 1 year ago

@HassanAbouelela 's 3.2.4 works on PyCharm 20222.2.2, but sadly it breaks Python Console tab : (

Screenshot 2022-09-20 at 16 46 09

java.lang.ClassCastException: class com.jetbrains.python.console.PydevConsoleRunnerImpl$PythonConsoleRunParams cannot be cast to class com.jetbrains.python.run.AbstractPythonRunConfiguration (com.jetbrains.python.console.PydevConsoleRunnerImpl$PythonConsoleRunParams and com.jetbrains.python.run.AbstractPythonRunConfiguration are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @77831d14)
    at net.ashald.envfile.products.pycharm.PythonProvider.extendTargetEnvironment(PythonProvider.java:21)
    at com.jetbrains.python.run.PythonCommandLineState.initEnvironment(PythonCommandLineState.java:648)
    at com.jetbrains.python.run.PythonCommandLineState.initEnvironment(PythonCommandLineState.java:616)
    at com.jetbrains.python.console.PydevConsoleRunnerImpl.doCreatePythonConsoleExecution(PydevConsoleRunnerImpl.java:455)
    at com.jetbrains.python.console.PydevConsoleRunnerImpl.createPythonConsoleExecution(PydevConsoleRunnerImpl.java:403)
    at com.jetbrains.python.console.PydevConsoleRunnerImpl.createProcessUsingTargetsAPI(PydevConsoleRunnerImpl.java:554)
    at com.jetbrains.python.console.PydevConsoleRunnerImpl.initAndRun(PydevConsoleRunnerImpl.java:758)
    at com.jetbrains.python.console.PydevConsoleRunnerImpl$1.run(PydevConsoleRunnerImpl.java:282)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)
HassanAbouelela commented 1 year ago

Thanks for the report @Vanderhoof, fixed in 3.2.5

bayangan1991 commented 1 year ago

Hey @HassanAbouelela, thanks so much for getting this working again.

I'm having issues with the Python Console not starting up in the project working directory or the one specified in the Python Console settings window.

I can add a os.chdir call to the start of the console start script to get around this but thought it was worth mentioning

HassanAbouelela commented 1 year ago

Hey, is this before or after the fix released yesterday (3.2.5)? Could you share the error message.

bayangan1991 commented 1 year ago

After the 3.2.5 fix as the console did not work at all before. Unfortunately there is no error message as the shell launches just fine. It just appears to be starting in the incorrect directory.

Edit: Also not ruling this out at a me issue as I can't replicate it in a new project window.

HassanAbouelela commented 1 year ago

Off the top of my head, I can't think of anything in the code that'd affect the directory, however let me know if you manage to reproduce in an empty project.

If you'd like to debug your other project, disable the plugin and see if it still causes the issue.

bayangan1991 commented 1 year ago

Looks like it's entirely unrelated and specific to the Django Console. Thanks for the help!

ashald commented 1 year ago

It's exciting to see how many people use the plugin judging from the number of complaints about it breaking. I wish it correlated with number of Github Sponsor donations to support plugin development. Or at least with a number of pull requests contributing fixes.

I personally don't have a need to use the latest version of IDE and been perfectly fine using older versions, though as I plan to add few extra features I'll look into fixing compatibility with the latest versions.

modernNeo commented 1 year ago

@ashald I can't speak for anyone else but I personally would be willing to support you financially with Paypal if you had one linked on your profile. πŸ˜„ Can't deny your plugin has been very helpful with my Pycharm usage

wooyek commented 1 year ago

Sponsor here > https://github.com/sponsors/ashald

PS. @ashald please setup One-time tiers :)

Elizaveta239 commented 1 year ago

Hi @ashald! Thank you for creating such a popular plugin! I work at JetBrains and we'll be happy to provide a pull request to fix 2022.2 compatibility! (we had a huge refactoring in the 2022.2 release and most likely that was the reason of the broken plugin). Unfortunately, we didn't notice it earlier.

Would you be interested in such pull request? (asking just to make sure you're not working on it at the moment, so we won't do the same job twice)

RockyMM commented 1 year ago

@ashald I am sorry, but it looked like you abandoned the repo. I am using @HassanAbouelela's fork at the moment.

ALERTua commented 1 year ago

@Elizaveta239 , ΠΌΠΎΠΆΠ΅Ρ‚ Π²Ρ‹ Π² JetBrains ΠΈΠΌΠΏΠ»Π΅ΠΌΠ΅Π½Ρ‚ΠΈΡ€ΡƒΠ΅Ρ‚Π΅ Π½Π°ΡΡ‚ΠΎΠ»ΡŒΠΊΠΎ Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡƒΡŽ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½ΠΎΡΡ‚ΡŒ Π½Π°ΠΏΡ€ΡΠΌΡƒΡŽ Π² ΠΏΡ€ΠΎΠ΄ΡƒΠΊΡ‚Π°Ρ… Idea Π±Π΅Π· надобности ΠΏΠ»Π°Π³ΠΈΠ½ΠΎΠ²? ΠΊΠ°ΠΊ Ρ€Π°Π·, послС отпуска с Π½ΠΎΠ²Ρ‹ΠΌΠΈ силами. ΠΌ? стыдно ΠΊΠΎΠΏΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ ΠΈΠ· Run Configuration Π² Run Configuration ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½Ρ‹Π΅ срСды Ρ€Π°Π· Π·Π° Ρ€Π°Π·ΠΎΠΌ ΠΈΠ·-Π·Π° Π±Ρ€ΠΎΡˆΠ΅Π½Π½ΠΎΠ³ΠΎ рСпозитория ΠΏΠ»Π°Π³ΠΈΠ½Π°. спасибо.

thelfensdrfer commented 1 year ago

can you in JetBrains implement much-needed functionality directly in Idea products without the need for plugins? as times, after holiday with new forces. m? it's a shame to copy environment variables from Run Configuration to Run Configuration over and over again because of the abandoned plugin repository. Thanks.

Elizaveta239 commented 1 year ago

We have plans to implement this functionality as part of the product but later. Implementing a fix for the existing popular plugin is the fastest solution we can provide at the moment. Sorry for the inconvenience!

wooyek commented 1 year ago

Maybe you could just pay the authors to support the plugins and keep them in the loop for breaking changes.

The practice of using community contributors for free to discover what features are in demand, and them discarding their work in favor of internal implementations is questionable.

I guess you are the ones that should setup a sponsorship on @ashald account ;P

HassanAbouelela commented 1 year ago

I think this change would've been apparent in early builds of 2022.2 but there definitely could've been more done to communicate any of this.

The refactoring was not documented anywhere to my knowledge, and not listed in the breaking changes list. The APIs are still accessible and documented, despite being unable to access them for some IDEs (IntelliJ). They are also inconsistently documented, with some of the APIs marking certain methods as deprecated (Go deprecated the function this plugin uses, but none of the other EPs nor the base EP have the same deprecation). I also heard about a new run API in the slack community, but I'm honestly not sure where that is.

(This is more feedback for plugins and documentation in general, not for plugin developers).

modernNeo commented 1 year ago

We have plans to implement this functionality as part of the product but later. Implementing a fix for the existing popular plugin is the fastest solution we can provide at the moment. Sorry for the inconvenience!

@Elizaveta239 just to clarify, you mean essentially make this plugin unnecessary?

ashald commented 1 year ago

@modernNeo thanks, noted - will update profile/readme to include links just in case you or anyone else would be feeling like doing so. 😊

@wooyek done!

@Elizaveta239 would appreciate a contribution! Please note I pushed some changes to update some of the dependencies. Also, would appreciate if you could clarify if the changes are only required for PyCharm, or if we should migrate to some new API for other platforms such as Goland/RubyMine.

And of course if such functionality would make make its way into JetBrains IDEs natively, I'd be more than happy to deprecate this plugin. Thought, IMHO, the best thing JetBrains could do is address https://youtrack.jetbrains.com/issue/IDEA-288756 so that not any developer willing to implement a plugin to add extra environment variables would have a cross-platform way to do so.

@RockyMM glad you found something that works for you! That being said, looking at your profile, you seem to have quite a few Java repos... which makes me wonder what stops people like you from contributing fixes rather than just commenting on issues like this, It's OSS after all.

@HassanAbouelela agree! the most challenging part of developing this plugin was to reverse-engineer ambiguous parts of plugin interface for run configurations.