question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update prompt environment variable when opening shell

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

When running poetry shell you have no idea your in the virtualenv or not. Please add the virtualenv’s name to the $PROMPT or $PS1 variable.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
yelled1commented, Apr 28, 2020

This is for Cmder on Windows 10

This is supposed to be an automatic feature on Cmder in the next release. https://github.com/cmderdev/cmder/blob/master/vendor/clink.lua#L30-L36 But it has not still hit the scoop yet. Other issue is that obviously what’s mentioned by @rfkortekaas I attempted to go around by an alias poet λ alias poet=poetry shell $t %ConEmuDir%\..\init.bat This did & did not ~ work

C:\Prj\FinmartDelta  
λ alias poet=poetry shell $t %ConEmuDir%\..\init.bat
C:\Prj\FinmartDelta  
λ poet
Spawning shell within C:\Users\ny11559\AppData\Local\pypoetry\Cache\virtualenvs\finmartdelta-rJ3Qparu-py3.7
name=cmd        path=cmd.exe  {i attempted to put this directly in to shell.py, but failed}
Microsoft Windows [Version 10.0.18363.778]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Prj\FinmartDelta>                         {darn same thing}
C:\Prj\FinmartDelta>                         {hit return to see if I can activate it / not}
C:\Prj\FinmartDelta>poet                  {try again}
Virtual environment already activated: C:\Users\ny11559\AppData\Local\pypoetry\Cache\virtualenvs\finmartdelta-rJ3Qparu-py3.7

C:\Prj\FinmartDelta>                         {darn same thing}
C:\Prj\FinmartDelta                           {hit return again}
[finmartdelta-rJ3Qparu-py3.7] λ           {finally got what I needed}
C:\Prj\FinmartDelta  
[finmartdelta-rJ3Qparu-py3.7] λ 

Obviously, I need to do something here C:\Users\myUser.poetry\lib\poetry\utils

 shell.py                                                                                                       buffers  
42         if cls._shell is not None:                                                                                   
43             return cls._shell                                                                                        
44                                                                                                                      
45         try:                                                                                                         
46             name, path = detect_shell(os.getpid())                                                                   
47         except (RuntimeError, ShellDetectionFailure):                                                                
48             raise RuntimeError("Unable to detect the current shell.")                                                
49                                                                                                                      
50         cls._shell = cls(name, path)                                                                                 
51                                                                                                                      
52         return cls._shell                                                                                            
53                                                                                                                      
54     def activate(self, env):  # type: (VirtualEnv) -> None                                                           
55         if WINDOWS:                                                                                                  
56             return env.execute(self.path)   

{tried adding pull path to init.bat but got another error.}

2reactions
clintonroycommented, Nov 28, 2019

Please try the latest pre-release (Poetry version 1.0.0b8) that has this feature, in a working state.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update prompt environment variable when opening shell #1642
When running poetry shell you have no idea your in the virtualenv or not. Please add the virtualenv's name to the $PROMPT or...
Read more >
How can I update cygwin shell environment variables set in ...
variable, 2) type cmd => Command Prompt is opened, 3) type my_app (which is in the my_dir ), 4) my_app: command not found...
Read more >
Updating your environment variables script - IBM
Open your existing environment variable shell script in a text editor. Locate the VERSION entry and specify the version of Cloud Pak for...
Read more >
cmd - Is there a command to refresh environment variables ...
The easiest way to add a variable to the path without rebooting for the current session is to open the command prompt ......
Read more >
Environment Variables in Windows/macOS/Linux
To set (or change) a environment variable, use command " set varname=value ". There shall be no spaces before and after the '='...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found