Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/lang/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ If you have installed `uv` (for example, with `mise use -g uv@latest`), `mise` w

Note that `uv` does not include `pip` by default (as `uv` provides `uv pip` instead). If you need the `pip` package, add the `uv_create_args = ['--seed']` option.

If you are still using the legacy `python.uv_venv_auto = true` setting (deprecated), mise will also export `UV_PYTHON`,
If you are still using the legacy `python.uv_venv_auto = true` value (deprecated in favor of `"source"` or `"create|source"`), mise will also export `UV_PYTHON`,
which forces `uv` to use `mise`'s selected python version.

See the [mise + uv Cookbook](/mise-cookbook/python.html#mise-uv) for more examples.
Expand Down
2 changes: 0 additions & 2 deletions e2e/cli/test_settings_ls
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ assert_contains "mise settings --json-extended" "{
}"

assert_contains "mise settings ls -T" "all_compile = false"
echo "settings.python.venv_auto_create = false" >>mise.toml
assert_contains "mise settings ls python" "venv_auto_create false"
10 changes: 0 additions & 10 deletions schema/mise.json
Original file line number Diff line number Diff line change
Expand Up @@ -1108,11 +1108,6 @@
"type": "string"
}
},
"venv_auto_create": {
"description": "Automatically create virtualenvs for python tools.",
"type": "boolean",
"deprecated": true
},
"venv_create_args": {
"description": "Arguments to pass to python when creating a venv. (not used for uv venv creation)",
"type": "array",
Expand Down Expand Up @@ -1161,11 +1156,6 @@
"type": "string",
"deprecated": true
},
"python_venv_auto_create": {
"description": "Automatically create virtualenvs for python tools.",
"type": "boolean",
"deprecated": true
},
"python_venv_stdlib": {
"description": "Prefer to use venv from Python's standard library.",
"type": "boolean",
Expand Down
14 changes: 0 additions & 14 deletions settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1408,13 +1408,6 @@ parse_env = "list_by_colon"
rust_type = "Vec<String>"
type = "ListString"

[python.venv_auto_create]
deprecated = "Use env._python.venv instead."
description = "Automatically create virtualenvs for python tools."
env = "MISE_PYTHON_VENV_AUTO_CREATE"
hide = true
type = "Bool"

[python.venv_create_args]
description = "Arguments to pass to python when creating a venv. (not used for uv venv creation)"
env = "MISE_PYTHON_VENV_CREATE_ARGS"
Expand Down Expand Up @@ -1477,13 +1470,6 @@ hide = true
optional = true
type = "String"

[python_venv_auto_create]
deprecated = "Use env._python.venv instead."
description = "Automatically create virtualenvs for python tools."
hide = true
optional = true
type = "Bool"

[python_venv_stdlib]
deprecated = "Use python.venv_stdlib instead."
description = "Prefer to use venv from Python's standard library."
Expand Down
17 changes: 2 additions & 15 deletions src/config/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,6 @@ impl Settings {
if let Some(python_venv_stdlib) = self.python_venv_stdlib {
self.python.venv_stdlib = python_venv_stdlib;
}
if let Some(python_venv_auto_create) = self.python_venv_auto_create {
self.python.venv_auto_create = python_venv_auto_create;
}
if self.npm.bun {
self.npm.package_manager = NpmPackageManager::Bun;
}
Expand Down Expand Up @@ -524,18 +521,8 @@ impl Settings {
}

pub fn hidden_configs() -> &'static HashSet<&'static str> {
static HIDDEN_CONFIGS: Lazy<HashSet<&'static str>> = Lazy::new(|| {
[
"ci",
"cd",
"debug",
"env_file",
"trace",
"log_level",
"python_venv_auto_create",
]
.into()
});
static HIDDEN_CONFIGS: Lazy<HashSet<&'static str>> =
Lazy::new(|| ["ci", "cd", "debug", "env_file", "trace", "log_level"].into());
&HIDDEN_CONFIGS
}

Expand Down
35 changes: 9 additions & 26 deletions src/plugins/core/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ impl PythonPlugin {
&self,
config: &Arc<Config>,
tv: &ToolVersion,
pr: Option<&dyn SingleReport>,
) -> eyre::Result<Option<PathBuf>> {
if let Some(virtualenv) = tv.request.options().get("virtualenv") {
if !Settings::get().experimental {
Expand All @@ -406,26 +405,13 @@ impl PythonPlugin {
}
}
if !virtualenv.exists() {
if Settings::get().python.venv_auto_create {
info!("setting up virtualenv at: {}", virtualenv.display());
let mut cmd = CmdLineRunner::new(python_path(tv))
.arg("-m")
.arg("venv")
.arg(&virtualenv)
.envs(config.env().await?);
if let Some(pr) = pr {
cmd = cmd.with_pr(pr);
}
cmd.execute()?;
} else {
warn!(
"no venv found at: {p}\n\n\
To create a virtualenv manually, run:\n\
python -m venv {p}",
p = display_path(&virtualenv)
);
return Ok(None);
}
warn!(
"no venv found at: {p}\n\n\
To create a virtualenv manually, run:\n\
python -m venv {p}",
p = display_path(&virtualenv)
);
return Ok(None);
}
// TODO: enable when it is more reliable
// self.check_venv_python(&virtualenv, tv)?;
Expand Down Expand Up @@ -565,10 +551,7 @@ impl Backend for PythonPlugin {
self.install_compiled(ctx, &tv).await?;
}
self.test_python(&ctx.config, &tv, ctx.pr.as_ref()).await?;
if let Err(e) = self
.get_virtualenv(&ctx.config, &tv, Some(ctx.pr.as_ref()))
.await
{
if let Err(e) = self.get_virtualenv(&ctx.config, &tv).await {
warn!("failed to get virtualenv: {e:#}");
}
if let Some(default_file) = &Settings::get().python.default_packages_file {
Expand Down Expand Up @@ -599,7 +582,7 @@ impl Backend for PythonPlugin {
tv: &ToolVersion,
) -> eyre::Result<BTreeMap<String, String>> {
let mut hm = BTreeMap::new();
match self.get_virtualenv(config, tv, None).await {
match self.get_virtualenv(config, tv).await {
Err(e) => warn!("failed to get virtualenv: {e}"),
Ok(Some(virtualenv)) => {
let bin = virtualenv.join("bin");
Expand Down
Loading