Skip to content

Commit 15527a9

Browse files
committed
Small important fix for Python interpreter choice when uv backend is used
See astral-sh/uv#16444 for explanation
1 parent e0897a6 commit 15527a9

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

NEWS.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
News
33
====
44

5+
0.3.15
6+
======
7+
8+
Fixed
9+
-----
10+
11+
- Due to a misunderstanding of uv's ``--python`` flag,
12+
a surprising and wrong Python interpreter could be used.
13+
14+
515
0.3.14
616
======
717

doc/src/help_all.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Full Reference
22

33
```shell
4-
# Optional launcher for all zpy functions as subcommands
4+
# Optional launcher for all zpy functions as subcommands (try: zpy help)
55
zpy <function> [<function-arg>...]
66

77
# Print description and arguments for all or specified functions.
@@ -16,7 +16,7 @@ zpy help [<zpy-function>...]
1616
# Activate the venv (creating if needed) for the current folder, and sync
1717
# its installed package set according to all found or specified requirements.txt files.
1818
# In other words: [create, ]activate, sync.
19-
# The interpreter will be whatever 'python3' refers to at time of venv creation, by default.
19+
# The interpreter will be whatever 'python' refers to at time of venv creation, by default.
2020
# Pass --py to use another interpreter and named venv.
2121
envin [--py pypy|current] [<reqs-txt>...]
2222
```

doc/src/new_proj/pips_envin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ activate [--py pypy|current] [-i|<proj-dir>]
8787
# Activate the venv (creating if needed) for the current folder, and sync
8888
# its installed package set according to all found or specified requirements.txt files.
8989
# In other words: [create, ]activate, sync.
90-
# The interpreter will be whatever 'python3' refers to at time of venv creation, by default.
90+
# The interpreter will be whatever 'python' refers to at time of venv creation, by default.
9191
# Pass --py to use another interpreter and named venv.
9292
envin [--py pypy|current] [<reqs-txt>...]
9393
```

zpy.plugin.zsh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -916,15 +916,15 @@ ZPY_PROCS=${${$(nproc 2>/dev/null):-$(sysctl -n hw.logicalcpu 2>/dev/null)}:-4}
916916
# Activate the venv (creating if needed) for the current folder, and sync
917917
# its installed package set according to all found or specified requirements.txt files.
918918
# In other words: [create, ]activate, sync.
919-
# The interpreter will be whatever 'python3' refers to at time of venv creation, by default.
919+
# The interpreter will be whatever 'python' refers to at time of venv creation, by default.
920920
# Pass --py to use another interpreter and named venv.
921921
.zpy_ui_envin () { # [--py pypy|current] [<reqs-txt>...]
922922
emulate -L zsh
923923
if [[ $1 == --help ]] { .zpy_ui_help ${0[9,-1]}; return }
924924
rehash
925925

926-
local venv_name=venv venv_cmd=(python3 -m venv)
927-
if (( $+commands[uv] )) venv_cmd=(uv venv -q -p python3)
926+
local venv_name=venv venv_cmd=(python -m venv)
927+
if (( $+commands[uv] )) venv_cmd=(uv venv -q -p python)
928928
if [[ $1 == --py ]] {
929929
local reply
930930
if ! { .zpy_argvenv $2 } { .zpy_ui_help ${0[9,-1]}; return 1 }
@@ -1525,7 +1525,7 @@ Path('''${newtoml}''').write_text(tomlkit.dumps(toml_data))
15251525
jq --argjson val "$value" "${keypath}=\$val" "$jsonfile"
15261526
)" >$jsonfile
15271527
} else {
1528-
python3 -c "
1528+
python -c "
15291529
from collections import defaultdict
15301530
from json import loads, dumps
15311531
from pathlib import Path
@@ -2265,9 +2265,9 @@ for pkg in pkgs:
22652265
if ! [[ -d $venv ]] {
22662266
rehash
22672267
if (( $+commands[uv] )) {
2268-
uv venv -q -p python3 $venv
2268+
uv venv -q -p python $venv
22692269
} else {
2270-
python3 -m venv $venv
2270+
python -m venv $venv
22712271
}
22722272
}
22732273
zf_ln -sfn $projdir ${vpath}/project
@@ -2954,7 +2954,7 @@ _.zpy_ui_pipz () {
29542954
)
29552955
wheezy.template =(<<<${(F)template}) $json >$txt
29562956
} else {
2957-
python3 -c "
2957+
python -c "
29582958
from pathlib import Path
29592959
from json import loads
29602960

0 commit comments

Comments
 (0)