Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions Microsoft.PowerShell_profile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
6 changes: 0 additions & 6 deletions apps/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/keep.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/markdown.formatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Just remove the H1 if it matches the file name
6 changes: 3 additions & 3 deletions apps/python.RelativePathShebang.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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]].)

Expand Down
7 changes: 2 additions & 5 deletions apps/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
32 changes: 19 additions & 13 deletions apps/python.xkcd-install-meme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions apps/uvdump-ADSKKHQYC7QDK4.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion def.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions dotfiles/mac/.mise.local.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion j2y.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion lnx/Microsoft.PowerShell_profile.ps1
Original file line number Diff line number Diff line change
@@ -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!" }
3 changes: 1 addition & 2 deletions mac/Microsoft.PowerShell_profile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
4 changes: 3 additions & 1 deletion pytree.ps1 → pipdeptree.ps1
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion va.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down