From 38f7c89b01975f3cd0ab7d319d20149713172d04 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Sat, 28 Feb 2026 11:16:22 +0000 Subject: [PATCH] fix(python): remove deprecated venv_auto_create setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the long-deprecated `python.venv_auto_create` and `python_venv_auto_create` settings. Users should use `_.python.venv = { path = ".venv", create = true }` instead. Also clarify docs for `python.uv_venv_auto` — only the `= true` boolean value is deprecated, not the setting itself. Closes #8376 Co-Authored-By: Claude Opus 4.6 --- docs/lang/python.md | 2 +- e2e/cli/test_settings_ls | 2 -- schema/mise.json | 10 ---------- settings.toml | 14 -------------- src/config/settings.rs | 17 ++--------------- src/plugins/core/python.rs | 35 +++++++++-------------------------- 6 files changed, 12 insertions(+), 68 deletions(-) diff --git a/docs/lang/python.md b/docs/lang/python.md index 1ed69e9df5..67976b1c10 100644 --- a/docs/lang/python.md +++ b/docs/lang/python.md @@ -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. diff --git a/e2e/cli/test_settings_ls b/e2e/cli/test_settings_ls index 0081018b01..963229e0c0 100644 --- a/e2e/cli/test_settings_ls +++ b/e2e/cli/test_settings_ls @@ -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" diff --git a/schema/mise.json b/schema/mise.json index 616fcdbeb5..3900df4099 100644 --- a/schema/mise.json +++ b/schema/mise.json @@ -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", @@ -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", diff --git a/settings.toml b/settings.toml index 51cb2bb0d2..962f4f1854 100644 --- a/settings.toml +++ b/settings.toml @@ -1408,13 +1408,6 @@ parse_env = "list_by_colon" rust_type = "Vec" 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" @@ -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." diff --git a/src/config/settings.rs b/src/config/settings.rs index d306395f33..0e97b9ac58 100644 --- a/src/config/settings.rs +++ b/src/config/settings.rs @@ -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; } @@ -524,18 +521,8 @@ impl Settings { } pub fn hidden_configs() -> &'static HashSet<&'static str> { - static HIDDEN_CONFIGS: Lazy> = Lazy::new(|| { - [ - "ci", - "cd", - "debug", - "env_file", - "trace", - "log_level", - "python_venv_auto_create", - ] - .into() - }); + static HIDDEN_CONFIGS: Lazy> = + Lazy::new(|| ["ci", "cd", "debug", "env_file", "trace", "log_level"].into()); &HIDDEN_CONFIGS } diff --git a/src/plugins/core/python.rs b/src/plugins/core/python.rs index c50eb1d3f4..4e42c7703c 100644 --- a/src/plugins/core/python.rs +++ b/src/plugins/core/python.rs @@ -389,7 +389,6 @@ impl PythonPlugin { &self, config: &Arc, tv: &ToolVersion, - pr: Option<&dyn SingleReport>, ) -> eyre::Result> { if let Some(virtualenv) = tv.request.options().get("virtualenv") { if !Settings::get().experimental { @@ -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)?; @@ -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 { @@ -599,7 +582,7 @@ impl Backend for PythonPlugin { tv: &ToolVersion, ) -> eyre::Result> { 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");