mise: drop global python, add venv auto-activation + idiomatic version files#17
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the dotfiles’ mise + fish integration to avoid globally shadowing the system Python (fixing GUI apps that expect /usr/bin/python3 + system gi), while improving per-project Python workflow via idiomatic version files and automatic .venv activation in interactive fish sessions.
Changes:
- Remove global mise
python = "latest"and document the rationale to ensure system Python is the default outside projects. - Enable mise idiomatic version files for common runtimes and auto-source uv venvs when applicable.
- Add a fish
cd-driven.venvauto-activation function and wire it into interactive startup.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| dot_config/mise/config.toml.tmpl | Drops global Python and configures idiomatic version files + uv venv auto-sourcing. |
| dot_config/fish/functions/__auto_venv.fish | Implements .venv discovery/activation on directory changes in fish. |
| dot_config/fish/conf.d/zz_03_interactive.fish | Loads/registers the auto-venv behavior for interactive shells. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Autoloaded: zz_03_interactive.fish calls __auto_venv once, which loads this | ||
| # file (registering the --on-variable PWD handler) and activates the start dir. | ||
| set -l found | ||
| set -l dir $PWD |
| break | ||
| end | ||
| test "$dir" = / ; and break | ||
| set dir (path dirname $dir) |
Comment on lines
+24
to
+28
| if test -z "$VIRTUAL_ENV"; or set -q __auto_venv_dir | ||
| functions -q deactivate; and deactivate # swap out our previous one | ||
| source "$found/bin/activate.fish" | ||
| set -g __auto_venv_dir "$found" | ||
| end |
Comment on lines
+29
to
+32
| else if set -q __auto_venv_dir | ||
| functions -q deactivate; and deactivate | ||
| set -e __auto_venv_dir | ||
| end |
| {{ if contains "dev" .tags -}} | ||
| # NOTE: python intentionally NOT a global tool. mise shims fall through to the | ||
| # next binary on PATH when a tool isn't configured, so leaving python out here | ||
| # makes `python3`/`pip` resolve to /usr/bin/python3 everywhere by default — |
e18c769 to
8c1d10e
Compare
…n files Stops python being a global mise tool so the python shim falls through to /usr/bin/python3 — system "#!/usr/bin/env python3" apps (paru/pacman, e.g. virt-manager needing PyGObject/gi) work again, while terminals and projects still get mise tools. Keeps mise on shims. - mise/config.toml.tmpl: remove `python = "latest"`; add idiomatic_version_file_enable_tools = [node, python, go, ruby, java, rust] so cd-ing into a repo that pins a toolchain via its native file (.nvmrc/.node-version, .python-version, .go-version, .ruby-version, .java-version, rust-toolchain.toml) selects it through the shims - fish: new __auto_venv autoload function + call in zz_03_interactive to auto-activate the nearest .venv on cd. Shims don't run mise's cd hook, so this owns all interactive venv activation (uv and non-uv repos alike) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8c1d10e to
b45f755
Compare
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.
What
Captures the mise + fish changes from a debugging session on the CachyOS desktop.
Why
Global
python = "latest"in mise put the shims dir's python ahead of/usr/bin, so GUI apps with#!/usr/bin/env python3(e.g. virt-manager) loaded mise's python and crashed withModuleNotFoundError: No module named 'gi'. Key insight: mise shims fall through to the next binary on PATH when a tool isn't configured, so simply dropping global python makespython3resolve to/usr/bin/python3everywhere by default — no need to abandon shims.Changes
mise/config.toml.tmplpython→ system/packaged apps get/usr/bin/python3(withgi); projects opt in via.mise.toml/ idiomatic version files.idiomatic_version_file_enable_tools = [node, python, go, ruby, java, rust]→ cd-ing into a repo that pins a toolchain via its native version file auto-selects it through the shims, nomise.tomlneeded:.nvmrc/.node-version, python.python-version, go.go-version, ruby.ruby-version, java.java-version, rustrust-toolchain.toml.go.mod,package.jsonengines,Cargo.toml, orpyproject.toml.)fish/functions/__auto_venv.fish(new) + call infish/conf.d/zz_03_interactive.fish.venvoncd, deactivate on leaving its tree; respects manually-activated venvs.--shims, which don't fire mise'scdhook — so this owns all interactive venv activation (uv and non-uv repos). Adds ~0.1 ms startup / <0.2 ms percd(measured) vs ~6 ms/cdfor the hook approach.Verification
~/.config/mise/config.toml.python3→/usr/bin/python3outside projects (import giworks);virt-managerlaunches..venvrepos auto-activate (uv and non-uv); leaving deactivates..nvmrc→node,.java-version→java 21,rust-toolchain.toml→rust 1.75.0) while$HOMEstays on the global version.🤖 Generated with Claude Code