Files
gui-video-clipper/chat-summaries/2026-09-22_14-10-fix-pyenv-pot-provider-v011-summary.md

44 lines
2.7 KiB
Markdown
Raw Normal View History

# Fix pyenv pot-provider detection & version bump to v0.1.1
## Task Description
The built `.app` bundle was not detecting the `bgutil-ytdlp-pot-provider` yt-dlp plugin, even after the initial `fix_path_env()` implementation that added Homebrew paths to `PATH`. After fixing, bump version to 0.1.1, commit, push, and tag.
## Root Cause
`fix_path_env()` added `/opt/homebrew/bin` to PATH, which found Homebrew's `yt-dlp` binary. However, the pot-provider plugin was pip-installed under **pyenv**'s Python (`~/.pyenv/versions/3.12.6/lib/python3.12/site-packages/yt_dlp_plugins`). Homebrew's yt-dlp uses a different Python runtime with no plugin directories (`[debug] Plugin directories: none`). The pyenv shim for `yt-dlp` correctly resolves to pyenv's Python where the plugin is installed.
## Changes Made
### `src-tauri/src/lib.rs` — Enhanced `fix_path_env()`
- Added `~/.pyenv/shims` to PATH **before** Homebrew paths so pyenv-managed yt-dlp (with pip plugins) takes priority
- Sets `PYENV_ROOT` env var when pyenv exists so shims resolve correctly
- Added `~/.nvm/versions/node/<latest>/bin` discovery for nvm-managed Node.js
- Added `~/.deno/bin` to handled paths
- Restructured the function for clarity: home-relative paths first, then system-wide paths
### Version Bump (via `scripts/bump-version.sh 0.1.1`)
- `VERSION` → 0.1.1
- `package.json` → 0.1.1
- `src-tauri/Cargo.toml` → 0.1.1
- `src-tauri/tauri.conf.json` → 0.1.1
- `src-tauri/Cargo.lock` regenerated
### Git Operations
- Committed: `d46973a` on `master`
- Pushed to `origin/master`
- Tagged: `v0.1.1` (annotated, pushed)
## Verification
- `npm run check` — 0 errors, 0 warnings
- `npm test` — 5 files, 31 tests passed
- `cargo build` — clean compile
- `npm run release` — built `.app` and `.dmg` successfully
- Launched `.app` bundle — all 4 dependencies detected (ffmpeg, yt-dlp, JS runtime, bgutil-ytdlp-pot-provider)
## Lessons Learned
- **Python version managers (pyenv) create shim binaries** that dispatch to a specific Python version. When a tool like yt-dlp is both Homebrew-installed and pyenv/pip-installed, PATH ordering determines which one runs — and they can have different plugin directories.
- **Simulating the `.app` environment** with `env -i HOME="$HOME" PATH="<minimal>" yt-dlp -v` was the key diagnostic step that instantly reproduced the issue (`Plugin directories: none` vs `Plugin directories: ~/.pyenv/...`).
- The `bump-version.sh` script works correctly for multi-file version bumps across `VERSION`, `package.json`, `Cargo.toml`, `tauri.conf.json`, and `Cargo.lock`.
## Follow-up Items
- The `npm pkg set` command in `bump-version.sh` produces a cosmetic JSON error with `--json` flag before falling back; could be cleaned up.