From ff91a4e16e0088c7e8a3c7a846a45d94054bb02c Mon Sep 17 00:00:00 2001 From: Hanashiko Date: Sat, 24 May 2025 19:31:11 +0300 Subject: [PATCH] feat(python): add function for show version of python, pip, venv --- plugins/python/README.md | 1 + plugins/python/python.plugin.zsh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/plugins/python/README.md b/plugins/python/README.md index ca424ea55..c4b719961 100644 --- a/plugins/python/README.md +++ b/plugins/python/README.md @@ -18,6 +18,7 @@ plugins=(... python) | `pygrep ` | Looks for `text` in `*.py` files in the current directory, recursively | | `pyuserpaths` | Add user site-packages folders to `PYTHONPATH`, for Python 2 and 3 | | `pyserver` | Starts an HTTP server on the current directory (use `--directory` for a different one) | +| `pyver` | Shows the current Python version, pip version, and active virtual environment (if any) | ## Virtual environments diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 2b139ddf0..e40aa1903 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -120,3 +120,9 @@ if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then add-zsh-hook chpwd auto_vrun auto_vrun fi + +function pyver() { + echo "Python: $(python3 --version 2>&1)" + echo "pip: $(pip --version 2>&1)" + echo "Venv: ${VIRTUAL_ENV:-none}" +}