diff --git a/.vscode/settings.json b/.vscode/settings.json index 596ece9..3f88395 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -31,7 +31,7 @@ // Set with vspy "python.defaultInterpreterPath": "/Users/walshca/.cache/uv/environments-v2/withings-d2cbc496ab033b71/bin/python3", "python.analysis.extraPaths": [ - // Add entries as needed from pipx run -v + // Add entries as needed from uv ... like pipx run -v "/Users/walshca/.local/pipx/.cache/e86142977f3b020/lib/python3.13/site-packages" ], "editor.tabSize": 2, diff --git a/Microsoft.PowerShell_profile.ps1 b/Microsoft.PowerShell_profile.ps1 index 120e89a..420ea88 100755 --- a/Microsoft.PowerShell_profile.ps1 +++ b/Microsoft.PowerShell_profile.ps1 @@ -23,23 +23,20 @@ function pushtmp { Set-Alias py python3 Set-Alias python python3 Set-Alias pester Invoke-Pester -# Windows pyenv doesn't shim `python3` ...so that's unsupported # TODO loop over PY files with '# /// script' and create the functions? # Can't use Set-Alias because aliases in pwsh don't support arguments! # see https://web.archive.org/web/20120213013609/http://huddledmasses.org:80/powershell-power-user-tips-bash-style-alias-command/ function gpx { uv run (Join-Path $PSScriptRoot gpx.py) @args } -function stravart { pipx run (Join-Path $PSScriptRoot stravart.py) @args } +function stravart { uv run (Join-Path $PSScriptRoot stravart.py) @args } function vspy { py (Join-Path $PSScriptRoot vscode_python_interpreter.py) @args } -Set-Alias pipdeptree pytree # pipx complains if it finds `pipdeptree` in the PATH +Set-Alias pytree pipdeptree # For legacy pipx reasons, used to need something else on the PATH function ipy { py -m IPython @args } -$ENV:PYENV_SHELL = "pwsh" - function wh($ex, [switch]$mine) { # -mine filters to things in $HOME diff --git a/README.md b/README.md index 96e0ed2..08ff3cd 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ Some scripts like [gpx.py](./gpx.py) use [`/// script; dependencies=` inline scr Then format and lint with ``` -pipx run ruff check --fix && pipx run ruff format +uvx ruff check --fix && uvx ruff format ``` *When fixing, Ruff's lint hook must be placed before formatter* diff --git a/apps/Brewfile b/apps/Brewfile index 0d485d6..80f0e3c 100644 --- a/apps/Brewfile +++ b/apps/Brewfile @@ -101,8 +101,6 @@ brew "openjdk" brew "p7zip" # Swiss-army knife of markup format conversion brew "pandoc" -# Python dependency management tool -brew "pipenv" # Package compiler and linker metadata toolkit brew "pkgconf" # Standalone binary that can run anything @@ -119,10 +117,6 @@ brew "powershell", link: false brew "protobuf" # Show ps output as a tree brew "pstree" -# Python version management -brew "pyenv" -# Pyenv plugin to manage virtualenv -brew "pyenv-virtualenv" # Cross-platform application and UI framework brew "qt" # Safe, concurrent, practical language diff --git a/apps/keep.md b/apps/keep.md index cb457bc..19536ed 100644 --- a/apps/keep.md +++ b/apps/keep.md @@ -28,7 +28,7 @@ For now unsure what to do about [[obsidian.archive|Archived notes]] -- for now I 7. Cleanup symlinks created above ### Making word cloud To keep it interesting, grouped notes by topic based on a wordcloud -`gci -file | % { printkeep $_ } | pipx run wordcloud --imagefile /tmp/output.png --stopwords ~/stopwords.txt --min_word_length 3 --width 1000 --height 800` +`gci -file | % { printkeep $_ } | uvx wordcloud --imagefile /tmp/output.png --stopwords ~/stopwords.txt --min_word_length 3 --width 1000 --height 800` ### Feature Requests for obsidian-importer - [ ] Make an issue on https://github.com/obsidianmd/obsidian-importer/issues ⏫ #### Note annotation URL not included diff --git a/apps/markdown.formatter.md b/apps/markdown.formatter.md index 5ccb700..f849309 100644 --- a/apps/markdown.formatter.md +++ b/apps/markdown.formatter.md @@ -37,4 +37,4 @@ URLs that are links: `[https://example.com](https://example.com)` should just be Most important: end of file ## Redundant H1 -Just remove the H1 if it matches the file name \ No newline at end of file +Just remove the H1 if it matches the file name diff --git a/apps/python.RelativePathShebang.md b/apps/python.RelativePathShebang.md index 6b5adfb..4c50859 100755 --- a/apps/python.RelativePathShebang.md +++ b/apps/python.RelativePathShebang.md @@ -93,7 +93,7 @@ Instead of creating my own custom REQUIREMENTS format, there's a standard for th Instead of writing my own wrapper tool that parses inline script metadata, I came across http://chriswarrick.com/blog/2023/01/15/how-to-improve-python-packaging and found several well-supported tools. ## Pipx and uv support script dependencies -[pipx](https://pipx.pypa.io/stable/) or [uv](https://docs.astral.sh/uv/) are very well supported -- installed through [[brew]] or [[scoop]]. +[pipx](https://pipx.pypa.io/stable/) or [uv](https://docs.astral.sh/uv/) are very well supported -- installed through [[package manager]]. (There's also [pdm](https://pdm-project.org/en/latest/usage/scripts/#single-file-scripts) or [many others](https://pipx.pypa.io/stable/comparisons)) [Example of how to use inline script metadata](https://pipx.pypa.io/stable/examples/#pipx-run-examples) @@ -115,11 +115,11 @@ You invoke `pipx run test.py pipx` which does the complicated part of creating a - [ ] create global pre-commit rule that avoids used pinned version in scripts? https://chatgpt.com/s/t_68c6070560d08191b624715772a4e7d0 - [ ] later, upgrade `stravaCook.ps1` to use `/// script` and delete ps1, then update links to github blob ### Creating nice aliases -I want to be able to run `stravacook` from the CLI like the wrapper enables, instead of typing `pipx run ~/code/bin/strava_cook.py` like a caveman. +I want to be able to run `stravacook` from the CLI like the wrapper enables, instead of typing `uv run ~/code/bin/strava_cook.py` like a caveman. Creating the alias is easy by hardcoding a function in [shell profile](../Microsoft.PowerShell_profile.ps1) ```powershell -function stravacook { pipx run (Join-Path $PSScriptRoot strava_cook.py) @args } +function stravacook { uv run (Join-Path $PSScriptRoot strava_cook.py) @args } ``` (Why a powershell `function`? See [[shell.alias#pwsh]].) diff --git a/apps/python.md b/apps/python.md index ecf3315..448f864 100644 --- a/apps/python.md +++ b/apps/python.md @@ -2,11 +2,8 @@ - [ ] Deep inspection of Python objects https://igrek51.github.io/wat/ ## Installation System package manager should install python that is easy to upgrade. -### pyenv shim for each project -Respects CWD `.python-version` when used. - -On macOS: `brew install pyenv` -On Windows, use [pyenv-win fork](https://github.com/pyenv-win/pyenv-win) : `scoop install pyenv` +### mise shim for each project +[[mise]] respects CWD `.python-version` / `.mise.toml` when used. ### Install global python using uv Ok if no system fallback, but [doesn't create](https://github.com/astral-sh/uv/issues/6265) a dynamic shim using CWD `.python-version`. diff --git a/apps/python.xkcd-install-meme.md b/apps/python.xkcd-install-meme.md index 82c1266..14a2ab8 100644 --- a/apps/python.xkcd-install-meme.md +++ b/apps/python.xkcd-install-meme.md @@ -50,30 +50,36 @@ Installed tools via `uv tool install`: `ruff` (at `~/.local/share/uv/tools/`) ## De-bloat steps (in order) - 1. [ ] **Uninstall pyenv + pyenv-virtualenv via brew** - - [ ] Remove `eval "$(pyenv init -)"` and similar from shell profile + 1. [x] **Uninstall pyenv + pyenv-virtualenv via brew** + - [x] Remove `eval "$(pyenv init -)"` and `prependPATH ~/.pyenv/shims` and similar from shell profile - `brew uninstall pyenv-virtualenv pyenv` - Delete `~/.pyenv/versions/` (frees **2.1 GB**) - Delete `~/.pyenv/version`, `~/.pyenv/shims/` - mise already handles `.python-version` files, so per-project switching still works - 2. [ ] **Remove standalone uv Python installs** - - [ ] Remove the `~/.local/bin/python3` symlinks that uv created (`ls -la ~/.local/bin/python*` to check) - - `uv python uninstall --all` (frees **323 MB**) + - [ ] Left behind `~/.pyenv.gar` to delete later + - [ ] #windows TRUTH: no pyenv installed (scoop), but remove the pyenv warning + `python`→`py` alias in [win/Microsoft.PowerShell_profile.ps1](../win/Microsoft.PowerShell_profile.ps1) + 2. [x] **Remove standalone uv Python installs** + - [x] `uv python uninstall --all` (frees **323 MB**) + - [x] Remove the `~/.local/bin/python3` symlinks that uv created (`ls -la ~/.local/bin/python*` to check) - uv installed via mise will still _use_ pythons (from mise) -- it just won't manage its own copies - 3. [ ] **Don't install Python through brew directly** - - `brew uninstall python@3.14` will likely fail because other formulae depend on it (awscli, azure-cli, etc.) -- that's fine, let brew keep its own copies as deps. Just don't rely on `/opt/homebrew/bin/python3` as your working Python - 4. [ ] **Remove pipenv from brew** + - [x] Rerun `uv tool install` so tools are installed to mise uv + 3. [-] **Don't install Python through brew directly** ❌ 2026-07-13 + - `brew uninstall python@3.14` will likely fail because other formulae depend on it (httpie, ollama, etc.) -- that's fine, let brew keep its own copies as deps. Just don't rely on `/opt/homebrew/bin/python3` as your working Python + 4. [x] **Remove pipenv from brew** - `brew uninstall pipenv` -- uv replaces it entirely (`uv pip`, `uv venv`, `uv lock`) - 5. [ ] **Remove brew uv (shadowing mise's newer uv)** + - [-] #windows TRUTH: no pipenv installed (scoop) + 5. [x] **Remove brew uv (shadowing mise's newer uv)** - [x] `brew uninstall uv` -- brew has 0.9.27, mise has 0.10.9; let mise own it - Remove `pipx` from `.mise.toml` -- `uvx` fully replaces it - ? `/Users/walshca/.local/bin/pipx` and `/Users/walshca/.local/share/mise/installs/pipx/1.8.0/pipx` - 6. [ ] **Clean up stale uv cached environments** + - [ ] #windows TRUTH: `scoop uninstall pipx` -- check global tools first (`pipx list`), reinstall any keepers via `uv tool install` + - [ ] #windows TRUTH: install uv (not in scoop yet) so `uvx`/`uv tool` replace pipx; also drop the uv warning in [win/Microsoft.PowerShell_profile.ps1](../win/Microsoft.PowerShell_profile.ps1) + 6. [x] **Clean up stale uv cached environments** - `uv cache clean` to reclaim temp build caches - 7. [ ] **Update mise config** to be the single source of truth + 7. [x] **Update mise config** to be the single source of truth - Your [.mise.toml](vscode-webview://03pmfhf2lnqoajc2je4ng9pqmgkqck4msa7ae7kr402f2orgt76q/dotfiles/.mise.toml) already has `python = "latest"` and `uv = "latest"` -- this is correct - - Add specific versions per-project via `.mise.toml` or `.python-version` in each repo - 8. [ ] **Remove Brewfile entries** + - [-] Add specific versions per-project via `.mise.toml` or `.python-version` in each repo + 8. [x] **Remove Brewfile entries** running `dump` - Remove: `pyenv`, `pyenv-virtualenv`, `pipenv` - Keep: `mise`, `hatch` (if you use it for project builds) ## After cleanup: how it works diff --git a/apps/uvdump-ADSKKHQYC7QDK4.md b/apps/uvdump-ADSKKHQYC7QDK4.md index 9362c28..68baecc 100644 --- a/apps/uvdump-ADSKKHQYC7QDK4.md +++ b/apps/uvdump-ADSKKHQYC7QDK4.md @@ -1,10 +1,5 @@ -## A modern Python package and dependency manager supporting the latest PEP standards pdm -## Install and Run Python Applications in Isolated Environments -pipx -## Python dependency management and packaging made easy. poetry ## A framework for managing and maintaining multi-language pre-commit hooks. pre-commit -## An extremely fast Python linter and code formatter, written in Rust. ruff diff --git a/def.ps1 b/def.ps1 index 142606d..b2c3517 100755 --- a/def.ps1 +++ b/def.ps1 @@ -23,7 +23,7 @@ function noHome($p) { function printPythonFiles($content) { # This is a bit hacky; but better than trying to eval `(Join-Path $PSScriptRoot some_script.py)` - # TODO parse a function like `pipx run (Join-Path $PSScriptRoot gpx.py) @args + # TODO parse a function like `uv run (Join-Path $PSScriptRoot gpx.py) @args # MAYBE move this magic logic into wh.ps1 and have defe.ps1 also use it! foreach ($match in $content | Select-String '\w+\.py' ) { $pyFile = $match.Matches.Value diff --git a/dotfiles/mac/.mise.local.toml b/dotfiles/mac/.mise.local.toml index a5b0e68..981b63c 100644 --- a/dotfiles/mac/.mise.local.toml +++ b/dotfiles/mac/.mise.local.toml @@ -1,4 +1,3 @@ -# Mac-only; claude-code and pipx don't work on Windows (see dotfiles/.mise.toml) +# Mac-only; claude-code package doesn't work on Windows (see dotfiles/.mise.toml) [tools] claude-code = "latest" -pipx = "latest" diff --git a/j2y.ps1 b/j2y.ps1 index 48bd82f..b5703de 100644 --- a/j2y.ps1 +++ b/j2y.ps1 @@ -6,4 +6,4 @@ Converts JSON from stdin and writes YAML to stdout $script:ErrorActionPreference = "Stop" Set-StrictMode -Version Latest -$Input | pipx run (Join-Path $PSScriptRoot j2y.py) +$Input | uv run (Join-Path $PSScriptRoot j2y.py) diff --git a/lnx/Microsoft.PowerShell_profile.ps1 b/lnx/Microsoft.PowerShell_profile.ps1 index ed4a446..ead1ce3 100644 --- a/lnx/Microsoft.PowerShell_profile.ps1 +++ b/lnx/Microsoft.PowerShell_profile.ps1 @@ -1,4 +1,4 @@ . (Join-Path $PSScriptRoot ".." "Microsoft.PowerShell_profile.ps1") PrependPATH $PSScriptRoot -if (Test-Path ~/.pyenv) { prependPATH ~/.pyenv/shims } +if (Test-Path ~/.pyenv) { Write-Warning "switch to uv!" } diff --git a/mac/Microsoft.PowerShell_profile.ps1 b/mac/Microsoft.PowerShell_profile.ps1 index 2441a88..6304cf2 100644 --- a/mac/Microsoft.PowerShell_profile.ps1 +++ b/mac/Microsoft.PowerShell_profile.ps1 @@ -3,7 +3,6 @@ PrependPATH "~/.local/bin" PrependPATH "~/go/bin" PrependPATH $PSScriptRoot -if (Test-Path ~/.pyenv) { prependPATH ~/.pyenv/shims } export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES export HOMEBREW_NO_AUTO_UPDATE=1 # Using brew autoupdate so skip interactively updating @@ -26,4 +25,4 @@ function exec() { So we force it to use zsh. #> function fzf { $input | /usr/bin/env SHELL="/bin/zsh" /opt/homebrew/bin/fzf @Args -} \ No newline at end of file +} diff --git a/pytree.ps1 b/pipdeptree.ps1 similarity index 72% rename from pytree.ps1 rename to pipdeptree.ps1 index 96d0b4a..30f3e06 100644 --- a/pytree.ps1 +++ b/pipdeptree.ps1 @@ -1,10 +1,12 @@ <# .SYNOPSIS Runs pipdeptree against the current venv python +.DESCRIPTION +Like uv tree but works on any venv #> $script:ErrorActionPreference = "Stop" Set-StrictMode -Version Latest # MAYBE could use `uv tree` optionally with --script for PEP 723 style imports. -pipx run pipdeptree --python auto @args +uvx pipdeptree --python auto @args diff --git a/va.ps1 b/va.ps1 index df87827..fe04f2a 100755 --- a/va.ps1 +++ b/va.ps1 @@ -18,7 +18,7 @@ try { catch { } -if (Select-String 'uv sync' ./README.md) { +if ((Test-Path README.md) -and (Select-String 'uv sync' README.md)) { Write-Warning "Switch to setup-uv" throw '`uv sync` found in README.md' }