Skip to content

Commit 0c86e52

Browse files
committed
Merge branch 'release/0.3.12'
2 parents c5b5a28 + f2db1e6 commit 0c86e52

File tree

9 files changed

+79
-26
lines changed

9 files changed

+79
-26
lines changed

NEWS.rst

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

5+
0.3.12
6+
======
7+
8+
Changed
9+
-------
10+
11+
- Use reverse-list layout for fzf/skim instead of reverse
12+
- pypc: don't add '.' to any dependency list
13+
- Add optional syntax highlighter backend: gat
14+
- Ensure to use ``python3`` instead of ``python`` for out-of-venv internal uses
15+
- Add mise auto-venv-activation instructions to docs
16+
- Update demo container base for Alpine
17+
- Install uv completion (which becomes part of zpy completion) in demo containers
18+
519
0.3.11
620
======
721

doc/mkdocs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ markupsafe==3.0.2 # via jinja2, mkdocs
1111
mergedeep==1.3.4 # via mkdocs, mkdocs-get-deps
1212
mkdocs==1.6.1 # via -r requirements.in, mkdocs-material
1313
mkdocs-get-deps==0.2.0 # via mkdocs
14-
mkdocs-material==9.5.44 # via -r requirements.in
14+
mkdocs-material==9.5.48 # via -r requirements.in
1515
mkdocs-material-extensions==1.3.1 # via mkdocs-material
1616
packaging==24.2 # via mkdocs
1717
paginate==0.5.7 # via mkdocs-material
@@ -24,6 +24,6 @@ pyyaml==6.0.2 # via mkdocs, mkdocs-get-deps, pymdown-extensions, pyy
2424
pyyaml-env-tag==0.1 # via mkdocs
2525
regex==2024.11.6 # via mkdocs-material
2626
requests==2.32.3 # via mkdocs-material
27-
six==1.16.0 # via python-dateutil
27+
six==1.17.0 # via python-dateutil
2828
urllib3==2.2.3 # via requests
2929
watchdog==6.0.0 # via mkdocs

doc/src/completions.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@ somewhere before loading zpy:
1010
autoload -Uz compinit && compinit
1111
```
1212

13+
I'll also recommend:
14+
15+
```shell
16+
zstyle ':completion:*' menu select
17+
```
18+
1319
Some functions allow you to pass arguments through to other tools,
1420
like `pip`, `pip-compile`, and `uv`.
1521
Completion will work for those if you install their own completion definitions.
1622

1723
If using `uv`, neither `pip` nor `pip-compile` will be relevant.
1824

19-
`uv` completion can be installed with something like the following,
20-
depending on your `$fpath`:
25+
`uv` completion is installed by creating a `_uv` file
26+
in one of your `$fpath` folders (usually `~/.local/share/zsh/site-functions`):
2127

2228
```console
2329
% uv generate-shell-completion zsh >~/.local/share/zsh/site-functions/_uv
2430
```
2531

26-
You can check for appropriate folders with:
27-
28-
```console
29-
% print -rl -- $fpath
30-
```
31-
32-
Filter to .../username/... paths for the most likely candidates:
32+
You can check for appropriate `$fpath` folders with:
3333

3434
```console
3535
% print -rl -- ${(M)fpath:#*/$USER/*}

doc/src/deps.md

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

33
The primary requirements are Zsh, Python, and
4-
[`fzf`](https://github.com/junegunn/fzf) *or* [`sk` (skim)](https://github.com/lotabout/skim),
4+
[`fzf`](https://github.com/junegunn/fzf) *or* [`sk` (skim)](https://github.com/skim-rs/skim),
55
with optional additions for more colorful output, alternative json parsers, and faster performance.
66

77
## Suggested Dependencies by Platform
@@ -48,13 +48,14 @@ with optional additions for more colorful output, alternative json parsers, and
4848

4949
- [Zsh](https://repology.org/project/zsh/versions)
5050
- [Python](https://repology.org/project/python/versions)
51-
- [`fzf`](https://github.com/junegunn/fzf) *or* [`sk` (skim)](https://github.com/lotabout/skim)
51+
- [`fzf`](https://github.com/junegunn/fzf) *or* [`sk` (skim)](https://github.com/skim-rs/skim)
5252

5353
=== "The optional ones"
5454

5555
- [uv](https://github.com/astral-sh/uv/)
5656
-- for faster performance, leaner venvs, and more operational feedback
5757
- [highlight](https://repology.org/project/highlight/versions)
58+
*or* [gat](https://github.com/koki-develop/gat/)
5859
*or* [bat](https://repology.org/project/bat/versions)
5960
*or* [rich-cli](https://github.com/Textualize/rich-cli)
6061
-- for pretty syntax highlighting; rich-cli adds fancy tables

doc/src/direnv.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,35 @@ please open an issue or discussion on GitHub.
3232
This ensures the proper project folder is used,
3333
even if you're activating the script by entering a deeper subdirectory.
3434

35+
=== "mise"
36+
37+
[mise](https://mise.jdx.dev/) supports
38+
[automatic venv activation](https://mise.jdx.dev/lang/python.html#automatic-virtualenv-activation),
39+
so we can configure the venv location to match zpy's.
40+
41+
Let's create a self-contained script for `venvs_path`,
42+
so that we can easily call it from Bash.
43+
44+
Assuming `~/.local/bin` is in your `PATH`, run
45+
46+
```console
47+
$ zpy mkbin venvs_path ~/.local/bin/
48+
```
49+
50+
Now you can add the following to your project's `mise.local.toml`:
51+
52+
```toml
53+
[env._.python]
54+
venv = "{{exec(command='venvs_path')}}/venv"
55+
```
56+
57+
This can also be done with commands:
58+
59+
```console
60+
$ touch mise.local.toml
61+
$ mise config set -f mise.local.toml env._.python.venv "{{exec(command='venvs_path')}}/venv"
62+
```
63+
3564
=== "direnv"
3665

3766
[direnv](https://github.com/direnv/direnv/)

doc/src/start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Install locally
88

99
Aside from Zsh and Python, the only dependency you're likely to *need* is
10-
[`fzf`](https://github.com/junegunn/fzf) *or* [`sk` (skim)](https://github.com/lotabout/skim).
10+
[`fzf`](https://github.com/junegunn/fzf) *or* [`sk` (skim)](https://github.com/skim-rs/skim).
1111
For more details and recommended package manager commands, see [Dependencies](deps.md).
1212

1313
To install `zpy` itself, you only need to source the file `zpy.plugin.zsh`

mk/ctnr/zcomet.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ case $distro in
3232
alias ctnr_mkuser="ctnr_run useradd -m -s /bin/zsh"
3333
;;
3434
alpine)
35-
basetag=${2:-3.20}
35+
basetag=${2:-3.21}
3636
pkgs="$pkgs git sudo"
3737
fat="$fat /var/cache/apk/*"
3838
alias ctnr_pkg="ctnr_run apk -q --no-progress"
@@ -87,6 +87,7 @@ ctnr_run -u git clone -q --depth 1 https://github.com/agkozak/zcomet /home/$user
8787
# Add settings and plugins to .zshrc:
8888
ctnr_run -u rm -f /home/$user/.zshrc
8989
<<EOF ctnr_append -u /home/$user/.zshrc
90+
typeset -U fpath=(~/.local/share/zsh/site-functions \$fpath)
9091
typeset -U path=(~/.local/bin \$path)
9192
precmd () { rehash }
9293
zstyle ':completion:*:*:*:*:*' menu select

mk/ctnr/zpy.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ fi
108108
printf 'zpy_branch: %s\n' "$zpy_branch"
109109
printf 'zpy_version: %s\n' "$zpy_version"
110110

111+
# Install uv, rich-cli
111112
ctnr_run -u zsh -ic 'pipz install --cmd uv uv; pipz install --cmd rich rich-cli'
113+
ctnr_run -u mkdir -p /home/${user}/.local/share/zsh/site-functions
114+
# shellcheck disable=SC2088
115+
ctnr_run -u sh -c '~/.local/bin/uv generate-shell-completion zsh >~/.local/share/zsh/site-functions/_uv'
112116

113117
# Install standalone vpy script, for simpler shebangs
114-
ctnr_run -u mkdir -p /home/${user}/.local/bin
115118
ctnr_run -u zsh -ic 'zpy mkbin vpy ~/.local/bin/vpy'
116119

117120
# Set aliases

zpy.plugin.zsh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,16 @@ ZPY_PROCS=${${$(nproc 2>/dev/null):-$(sysctl -n hw.logicalcpu 2>/dev/null)}:-4}
108108
# the first of the next. This is true of at least highlight 3.58.
109109

110110
# The method below bypasses both issues consistently
111-
# across all known versions of highlight, and still outperforms bat:
111+
# across all known versions of highlight, and still outperforms the rest:
112112
local content=$(<&0)
113113
if [[ $content ]] {
114114
local themes=(aiseered blacknblue bluegreen ekvoli navy)
115115
HIGHLIGHT_OPTIONS=${HIGHLIGHT_OPTIONS:-"-s $themes[RANDOM % $#themes + 1]"} \
116116
highlight -O truecolor --stdout --force -S $1 <<<$content
117117
}
118+
} elif (( $+commands[gat] )) { # recommended themes: base16-snazzy, doom-one, gruvbox, onedark, vulcan
119+
GAT_THEME=${GAT_THEME:-doom-one} \
120+
gat --force-color -l $1
118121
} elif (( $+commands[bat] )) { # recommended themes: ansi, zenburn
119122
BAT_THEME=${BAT_THEME:-ansi} \
120123
bat --color always --paging never -p -l $1
@@ -299,7 +302,7 @@ ZPY_PROCS=${${$(nproc 2>/dev/null):-$(sysctl -n hw.logicalcpu 2>/dev/null)}:-4}
299302
.zpy_fzf_cmd || return
300303
local fzf_cmd=$REPLY
301304

302-
local multi fzf_args=(--reverse -0 --preview='<{}/*.in')
305+
local multi fzf_args=(--layout=reverse-list -0 --preview='<{}/*.in')
303306
if [[ $1 == --multi ]] {
304307
unset reply
305308
fzf_args+=(-m)
@@ -1232,17 +1235,19 @@ ZPY_PROCS=${${$(nproc 2>/dev/null):-$(sysctl -n hw.logicalcpu 2>/dev/null)}:-4}
12321235

12331236
rehash
12341237

1238+
local blocklist=(setuptools six pip pip-tools wheel)
1239+
12351240
local cells=()
12361241
if (( $+commands[jq] )) {
12371242
cells=($(
12381243
.zpy_ui_vrun $vrun_args $list_outdated 2>/dev/null \
1239-
| jq -r '.[] | select(.name|test("^(setuptools|six|pip|pip-tools|wheel)$")|not) | .name,.version,.latest_version'
1244+
| jq -r '.[] | select(.name|test("^('${(j:|:)blocklist}')$")|not) | .name,.version,.latest_version'
12401245
))
12411246
} elif (( $+commands[wheezy.template] )) {
12421247
local template=(
12431248
'@require(__args__)'
12441249
'@for pkg in __args__[0]:'
1245-
'@if pkg["name"] not in ("setuptools", "six", "pip", "pip-tools", "wheel"):'
1250+
'@if pkg["name"] not in ("'${(j:", ":)blocklist}'"):'
12461251
'@pkg["name"]'
12471252
'@pkg["version"]'
12481253
'@pkg["latest_version"]'
@@ -1261,7 +1266,7 @@ import sys
12611266
from json import load
12621267
pkgs = load(sys.stdin)
12631268
for pkg in pkgs:
1264-
if pkg["name"] not in ("setuptools", "six", "pip", "pip-tools", "wheel"):
1269+
if pkg["name"] not in ("'${(j:", ":)blocklist}'"):
12651270
print(pkg["name"], pkg["version"], pkg["latest_version"], sep="\n")
12661271
'
12671272
))
@@ -1435,7 +1440,7 @@ def reqs_from_reqsin(reqsin):
14351440
reqs.append(
14361441
re.search(r'^(-\S+\s+)*([^#]+)', line).group(2).rstrip()
14371442
)
1438-
return sorted(set(r for r in reqs if r.strip()))
1443+
return sorted(set(r for r in reqs if r.strip() and r not in ('.',)))
14391444

14401445

14411446
suffix = 'requirements.in'
@@ -1520,7 +1525,7 @@ Path('''${newtoml}''').write_text(tomlkit.dumps(toml_data))
15201525
jq --argjson val "$value" "${keypath}=\$val" "$jsonfile"
15211526
)" >$jsonfile
15221527
} else {
1523-
python -c "
1528+
python3 -c "
15241529
from collections import defaultdict
15251530
from json import loads, dumps
15261531
from pathlib import Path
@@ -1830,7 +1835,7 @@ for pkg in pkgs:
18301835
local fzf_cmd=$REPLY
18311836

18321837
local fzf_args=() fzf_header fzf_prompt multi
1833-
fzf_args=(--reverse -0)
1838+
fzf_args=(--layout=reverse-list -0)
18341839
fzf_header='Packages:'
18351840
fzf_prompt='Which package? '
18361841
while [[ $1 == --(header|multi) ]] {
@@ -1908,7 +1913,7 @@ for pkg in pkgs:
19081913
projects_home=$1; shift
19091914
bins_home=$1; shift
19101915

1911-
local bins_showlist=() bins_hidelist=() linkonly=1 fzf_args=(--reverse -m -0) fzf_header=Installing
1916+
local bins_showlist=() bins_hidelist=() linkonly=1 fzf_args=(--layout=reverse-list -m -0) fzf_header=Installing
19121917
while [[ $1 == --(cmd|activate|no-cmd|auto1|header) ]] {
19131918
if [[ $1 == --cmd ]] { bins_showlist=(${(s:,:)2}); shift 2 }
19141919
if [[ $1 == --no-cmd ]] { bins_hidelist=(${(s:,:)2}); shift 2 }
@@ -2949,7 +2954,7 @@ _.zpy_ui_pipz () {
29492954
)
29502955
wheezy.template =(<<<${(F)template}) $json >$txt
29512956
} else {
2952-
python -c "
2957+
python3 -c "
29532958
from pathlib import Path
29542959
from json import loads
29552960

0 commit comments

Comments
 (0)