feat: add uv / PEP 723 support#67
Open
al-bashkir wants to merge 2 commits into
Open
Conversation
* feat: add PEP 723 inline script metadata for uv Allows running rename_session_windows.py via 'uv run --script' so libtmux is provisioned automatically. Block is a comment for plain python3, behaviour is unchanged on that path. Refs ofirgall#56 * feat: auto-detect uv in tmux entrypoint If 'uv' is on PATH, route all rename_session_windows.py invocations through 'uv run --script' so libtmux is resolved from PEP 723 metadata. Otherwise fall back to the existing python3 + libtmux import check. Zero config; existing users unaffected. Refs ofirgall#56 * docs: document uv auto-detect path in README Tell users uv is auto-detected and pip-install of libtmux is not required when uv is present. Refs ofirgall#56 * fix: route after-rename-window hook through uv launcher enable_user_rename_hook() registered a tmux hook with the bare script path, relying on the python3 shebang. Under the uv adoption path, that bypasses uv and tries system python3 + libtmux, which silently fails when libtmux is not installed system-wide. Pass the launcher through env var TMUX_WINDOW_NAME_LAUNCHER from the .tmux entrypoint, and prefix the hook's run-shell command with it. The pre-existing unbalanced quotes around run-shell's path also broke once the path contained spaces ("uv run --script /path"); use properly escaped \"...\" so tmux parses the run-shell argument as a single quoted token. Refs ofirgall#56 ---------
The nvim Lua autocmd, vim job_start, and zsh chpwd snippets all invoked the script via its python3 shebang, which fails when libtmux is not installed system-wide (the uv path skips that install). Add a parallel 'uv run --script' variant under each snippet so users on the uv path can pick the one that works for them. Original direct-shebang snippets are kept as-is. Refs ofirgall#56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
uv/ PEP 723 inline script metadata support so users can run the plugin without manually installinglibtmux. Existingpython3+ systemlibtmuxpath is unchanged.What changes
scripts/rename_session_windows.py— PEP 723 metadata block added after the shebang. The block is a Python comment so the file still runs as-is underpython3;uvparses it and provisions a cached venvwith
libtmux.tmux_window_name.tmux— auto-detectsuvonPATH. If found, all script invocations route throughuv run --script. Otherwise the originalpython3+ libtmux import check runs unchanged. Zero config;existing users see no behavior change.
enable_user_rename_hook— theafter-rename-windowhook value previously hardcoded the bare script path and relied on the python3 shebang. That bypassed the launcher under the uv path. Now it readsTMUX_WINDOW_NAME_LAUNCHER(exported from.tmux) and prefixes the hook'srun-shellcommand. Pre-existing unbalanced quotes around the run-shell argument are also fixed (they broke once the path stringcontained spaces from the
uv run --scriptprefix).README.md—### Recommended: install uvsection above the libtmux install instructions, explainingpip installis not needed when uv is present.job_start, and zshchpwdsnippets gain paralleluv run --scriptvariants below the originals (originals kept as-is).How to verify