-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Allow to force virtualenv creation by default #1726
Comments
I tried to put Having global config for env vars works correctly. E.g. |
In #1438 (comment) I noticed existence of https://github.com/mise-plugins/mise-poetry, which solves my problem. |
Yes, I tried before submitting this issue 😉 For the |
I've been using this short alias for a while to quickly select a python version and setup a venv : But it has the huge disadvantage of destroying the current .mise.toml file, which isn't much fun. I'll rework my alias until it's discussed, something to append the right lined if not already present, and rely on mise for inserting the python version in the conf file.. 🙃 |
We could have a setting for this, seems there is plenty of appetite for it. That said, if it were me I'd use a utility like this: https://github.com/gnprice/toml-cli We do have |
2 years updatelesss.. 😱 #!/bin/bash
set -uo pipefail
IFS=$'\n\t'
version="$(mise list python | grep -F python | awk "{ print \$2 }" | fzf)"
rm -rf .venv
mise use python@${version}
grep -F '[env]' .mise.toml || echo -e '[env]' >> .mise.toml
grep -F '_.python.venv = { path = ".venv", create = true }' .mise.toml || echo '_.python.venv = { path = ".venv", create = true }' >> .mise.toml
mise trust 2>/dev/null
bat -P .mise.toml |
Get outta here with your fake news 😜 |
oh I thought you were talking about this ticket, I was confused since mise hasn't been around 2 years 😂 in any case, weren't we just having a conversation where I said I often forget about what is actually in mise? mise/src/plugins/core/python.rs Lines 262 to 263 in 3aa5f57
seems I added this setting already but forgot to add it to the docs |
I know the issue is closed, but I have this "simple" alias that works pretty well (and does not destroy the existing mise use python@<version> && mise config set env._.python.venv.path .venv && mise config set env._.python.venv.create true And if you need a brand new virtualenv, such as in @laluka alias, just prepend rm -rf .venv && mise use python@<version> && mise config set env._.python.venv.path .venv && mise config set env._.python.venv.create true |
Thanks pal, I'll replace my script by your alias in a few, makes way more sense to not modify the file by hand, it was a dirty workaround 😅 |
Instead of an alias, another option is to create a preset task like #!/usr/bin/env bash
#MISE dir="{{cwd}}"
#USAGE arg "<version>"
mise use python@$usage_version
mise config set env._.python.venv.path .venv
mise config set --type bool env._.python.venv.create true
mise config set --type list env._.python.venv.uv_create_args -- --seed With this, you can simply create a venv by running |
Nvm I'm a moron, missing chmod +x, I assumed it was sourced, not exec'd, sorry for the ping 🙏 |
To enable virtualenv creation, we need to add this to the
.mise.toml
:This form prevent from applying it globally and doing it with a single command line
mise use python@<version>
.It would be nice to have a way to say "I always want a virtualenv created in
.venv
" so when I runmise use python@<version>
it automatically creates the.venv
whatever the directory I am into.(If there is already a way of doing this, I might have missed it, links are welcome)
The text was updated successfully, but these errors were encountered: