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

Add python option to _.python.venv #1721

Closed
sbidoul opened this issue Mar 1, 2024 · 2 comments · Fixed by #3489
Closed

Add python option to _.python.venv #1721

sbidoul opened this issue Mar 1, 2024 · 2 comments · Fixed by #3489

Comments

@sbidoul
Copy link

sbidoul commented Mar 1, 2024

When working in a virtual environment, it is sometimes useful to have the other global pythons to remain available.

For instance, when in a project directory with, say, a python 3.12 venv active, I sometimes need to run tox -e py310 to run tests with another version.

When the global pythons are managed with mise and tools.python is set, the other global pythons are not available.

A possible solution would be to have python as an option of _.python.venv that would be used over tools.python which could then be absent.

Assuming that makes sense and fits with the path you are following, of course.

@jdx
Copy link
Owner

jdx commented Nov 30, 2024

wait is this accurate?

When the global pythons are managed with mise and tools.python is set, the other global pythons are not available.

assuming you did mise u -g python@3.12 then you should still have /usr/bin/python310 on PATH so they should be there for tox

@sbidoul
Copy link
Author

sbidoul commented Dec 1, 2024

@jdx This is what I observe with 2024.11.37 so yes it seems a local tool.python disables all global pythons, where I would naively expect it to take precedence over globally defined ones.

$ mise use -g python@3.13 python@3.12 python@3.11 python@3.10 python@3.9 python@3.8 python@3.7 python@3.6 python@2.7
$ mise list
Tool        Version  Config Source              Requested
python      2.7.18   ~/.config/mise/config.toml 2.7      
python      3.6.15   ~/.config/mise/config.toml 3.6      
python      3.7.17   ~/.config/mise/config.toml 3.7      
python      3.8.20   ~/.config/mise/config.toml 3.8      
python      3.9.20   ~/.config/mise/config.toml 3.9      
python      3.10.15  ~/.config/mise/config.toml 3.10     
python      3.11.10  ~/.config/mise/config.toml 3.11     
python      3.12.7   ~/.config/mise/config.toml 3.12     
python      3.13.0   ~/.config/mise/config.toml 3.13     
$ cd /tmp/misetest
$ cat mise.toml
[tools]
python = "3.10"

[env]
_.python.venv = { path = ".venv", create = true }

$ mise list
Tool        Version  Config Source              Requested
python      2.7.18                                       
python      3.6.15                                       
python      3.7.17                                       
python      3.8.20                                       
python      3.9.20                                       
python      3.10.15  /tmp/misetest/mise.toml    3.10     
python      3.11.10                                      
python      3.12.7             
$ which python3.10
/tmp/misetest/.venv/bin/python3.10
$ python3.11
Command 'python3.11' not found,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants