From 2e60c1d7340e68c6e42c3d4ef1c5919b83c589fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:09:53 -0600 Subject: [PATCH] Use the right marker for the `implementation` field of `pyvenv.cfg` (#1785) ## Summary The generated `pyvenv.cfg` file hardcodes `implementation = CPython` even for PyPy venvs, created with `uv venv venv --python pypy3.10`, for example. ```ini home = /path/to/.pyenv/versions/pypy3.10-7.3.15/bin implementation = CPython version_info = 3.10 gourgeist = 0.0.4 include-system-site-packages = false base-prefix = /path/to/.pyenv/versions/pypy3.10-7.3.15 base-exec-prefix = /path/to/.pyenv/versions/pypy3.10-7.3.15 base-executable = /path/to/.pyenv/versions/pypy3.10-7.3.15/bin/pypy3.10 ``` ## Test Plan Manually verified that `pyvenv.cfg` now contains `implementation = PyPy`. I can try refactoring `create_bare_venv` to make it more easily testable, though. --- crates/gourgeist/src/bare.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/gourgeist/src/bare.rs b/crates/gourgeist/src/bare.rs index 3914d58ca..9c368f460 100644 --- a/crates/gourgeist/src/bare.rs +++ b/crates/gourgeist/src/bare.rs @@ -220,7 +220,10 @@ pub fn create_bare_venv( }; let pyvenv_cfg_data = &[ ("home", python_home), - ("implementation", "CPython".to_string()), + ( + "implementation", + interpreter.markers().platform_python_implementation.clone(), + ), ( "version_info", interpreter.markers().python_version.string.clone(),