Skip to content
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

Irrelevant single character change in pyvenv.cfg changes the prompt displayed with the variable ($virtualenv) for Python #5935

Open
m-aherron opened this issue Apr 18, 2024 · 0 comments
Labels
🐛 bug Something isn't working as expected.

Comments

@m-aherron
Copy link

Current Behavior

Using virtual environment for Python.
The last two lines of pyvenv.cfg for this app are:

command = C:\Python\.pyenv\pyenv-win\versions\3.11.7\python.exe -m venv c:\Python\x\a
prompt = Warranties-venv

I get this prompt when the virtual environment is activated (without special chars):

Warranties on ? master via ? v3.11.7 (.venv)

but if the last two lines of pyvenv.cfg are:

command = C:\Python\.pyenv\pyenv-win\versions\3.11.7\python.exe -m venv c:\Python\X\a
prompt = Warranties-venv

With just the single character change I get this prompt when the virtual environment is activated(without special chars):

Warranties on ? master via ? v3.11.7 (Warranties-venv)

Please note that the two directories at the end of the "command" line:

c:\Python\x\a
c:\Python\X\a

do not exist.

Somehow I was able to find a way to change this behaviour with a single byte change.

Expected Behavior

The prompt I would like to appear should reflect the prompt setting in pyvenv.cfg
that is:
Warranties on ? master via ? v3.11.7 (Warranties-venv)

Additional context/Screenshots

Possible Solution

I suspect that fn get_prompt_from_venv in python.rs has a logical flaw but it was not obvious to me.

Environment

  • Starship version: 1.18.2
  • pwsh version: PowerShell 7.4.1
  • Operating system: Windows 10.0.19045
  • Terminal emulator:
  • Git Commit Hash:
  • Branch/Tag: master
  • Rust Version: rustc 1.77.1 (7cf61ebde 2024-03-27)
  • Rust channel: stable-x86_64-pc-windows-msvc release
  • Build Time: 2024-03-29 15:47:49 +00:00

Relevant Shell Configuration

$scripts = "$(split-path $PROFILE)\Scripts"
#$modules = "$(split-path $profile)\Modules"
$docs    =  $(resolve-path "$Env:userprofile\documents")
$desktop =  $(resolve-path "$Env:userprofile\desktop")

Invoke-Expression (&starship init powershell)
Import-Module -Name Terminal-Icons

Starship Configuration

# stored at C:\DevTools\Starship\starship.toml
# pointed to by STARSHIP_CONFIG

command_timeout	= 2000

[aws]
disabled = true
@m-aherron m-aherron added the 🐛 bug Something isn't working as expected. label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

1 participant