-
Notifications
You must be signed in to change notification settings - Fork 1
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
poetry shell
doesn't work with mise
and fish
shell, venv python is behind mise in path
#7
Comments
Don't use --init-command when starting a fish venv subshell, instead treat it as other shells. The --init--command doesn't work well with python managed by mise. Ref: python-poetry/poetry#9463
Is your mise from brew or somewhere that installs a conf.d activation script? What happens with |
Thank you for the comment and the link to the mise docs. Yes, mise is from homebrew. The fish trace is incredibly long. I see I was wrong though, the mise activation does happen first and then later the |
OK I may have gotten mixed up with testing or still kept
everything works as expected. The mise python is not even on PATH inside the venv because it's never activated. I'm running |
poetry shell will add the venv python to the path but it'll be behind mise python(s) so we tell the subshell not to auto-activate mise ref: python-poetry/poetry#9463
hello, maybe another issue related with |
@hailcar argggh aye lmao... this is why i hate env mutation based tool managers. going back to asdf. |
Description
I appear to have hit some kind of frustrating edge case with poetry, mise, and fish shell. If I run
poetry shell
, the venv python isn't the one used, instead the global mise python is, so all commands using venv packages fail, etc. Here's a small demo:This occurs whether the venv is inside the project directory or under ~/.local. But if I
source
the activation script, the pythons are ordered as expected:Apologies if you view this more as an issue somewhere with mise or fish but the fact that the
source
command works tells me that poetry should be able to do this. I looked at your shell code, it runsfish -i --init-command "source .venv/bin/activate.fish"
and after some experiments I couldn't find a way to make that work.Fish says it reads configuration before executing the
--init-command
so I expect mise to activate first, then the source, but that doesn't happen. If I print as each happens, I see that thesource
goes first and then themise activate fish
in my config.fish. I see for some other shells you send a command to the terminal after launching a subshell and that approach also works for fish (instead of using --init-command).Workarounds
I can replace
poety shell
withsource (poetry env info -p)/bin/activate.fish
but that has the downside of not starting a subshell.The issue does not occur in bash, so I can use bash with
SHELL=bash poetry shell
, but then I'm not using my favored shell in the venv.Poetry Installation Method
pipx
Operating System
macOS 14.5
Poetry Version
Poetry (version 1.8.3)
Poetry Configuration
Python Sysconfig
Example pyproject.toml
Not relevant, happens regardless of pyproject.toml structure.
Poetry Runtime Logs
> poetry -vvv shell Loading configuration file /Users/ephetteplace/Library/Application Support/pypoetry/config.toml Using virtualenv: /Users/ephetteplace/project/.venv Spawning shell within /Users/ephetteplace/project/.venv
The text was updated successfully, but these errors were encountered: