-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Documentation, Windows] Pipenv + Cmder Documentation #2150
Comments
I use Pipenv with Cmder a lot, and don’t seem to have your first issue. This could be a bug. |
Now that you mentioned, it will probably be fixed |
No, mine is in |
BTW I do this to prepend the virtualenv name to prompt during Clink startup. This is registered as a Clink prompt filter during startup. This might be of interest of some people. local function find_virtualenv_prompt()
local virtual_env = clink.get_env('VIRTUAL_ENV')
if virtual_env == nil then
return nil
end
local activate_bat = io.open(virtual_env..'\\Scripts\\activate.bat', 'r')
if activate_bat == nil then
return nil
end
local content = activate_bat:read('*a')
activate_bat:close()
return content:match('set "PROMPT=%((.+)%) %%PROMPT%%"')
end
local function set_prompt_filter()
local env = find_virtualenv_prompt()
clink.prompt.value = "format the prompt here..."
end |
Yes the space problem is a bug. There haven’t been a fix yet (the one I mentioned in #2115 does not work). For the second issue, yes I modified my clink.lua. This is probably not the best solution, but the most practical to me because BAT is way too limiting for this task. |
@gtalarico feel free to PR documentation updates or wiki updates at your discretion for this, I am not sure where you would prefer to direct people as you encounter more of this but I'm happy to expedite reviews (and you can find me on slack/irc if you have questions) |
Thanks @techalchemy ! I am going to be optimistic here... I am hoping I can help fix both of those issues instead of documenting my workarounds :) I have spent some time testing solutions and I have a fix for both issues listed above. |
Both of those seem appropriate and will just need to get worked into whatever the rewrite looks like too. No big deal there. And I always try to make sure we open relevant PRs upstream so the dependencies themselves reap the benefits. Granted I pew still hasn’t accepted my PR to remove psutil so some changes may not apply. |
This is largely resolved after |
There are 2 issues that make Pipenv difficult to use on Windows + Cmder (#2 affects win+cmd.exe as well). I am also assuming these are also applicable for ConEmu.
Cmder/ConEmu is used by a many Windows users so it would be great to improve
support/documentation for it.
(PS: I also use it on Mac, but my transition there was much smoother with no noticeable issues)
Below are the two main issues I encountered, and the solutions I found.
Could we add this to either the Wiki or the Docs?
1 - Pipenv Uses cmder by default when entering into a new shell
We need to pipenv to continue using cmder when entering into a shell, otherwise it will default to cmd.exe
Solution
Set
PIPENV_SHELL
to cmder's init fileEdit your environment Variables and add:
PIPENV_SHELL=C:\path\to\cmder\vendor\init.bat
Note:
If path to your
init.bat
contains space it will not work, so you will need to use a copy of cmder that is not in one of those files (issue #2115 )2 - Pipenv does not show the active env's in the prompt
This works fine out of the box with virtualenv + virtualenvwrapper.
For this feature to work on windows, the PROMPT variable which is normally set to
$P$G
need to be amended to (envname) $P$GMore details on #2116
Solution (Workaround; needs a PR for proper fix)
Make sure you have a
.env
file for your project, and in that file addPROMPT=(envnameYouWant) $P$G
This will force pipenv to overwrite the
%PROMPT%
variable when a pipenv shell is startedThe text was updated successfully, but these errors were encountered: