`py-search` to help implement [[launch]].
# Structs
## Python feature version
Major and minor as that's universally available no matter which way you search (only [[#Registry]] results have the full Python version based on searching).
If the full version is needed then there can be a helper function that converts [[#Search results]] into full versions.
## Search results
- Path to interpreter
- Feature version
- Free-threaded
- `w` variant on Windows
- Environment kind (only if virtual environments are included in the crate)
- Where it was found / method used
# Iterators
## `$PATH`
- [All env vars](https://doc.rust-lang.org/std/env/fn.vars_os.html)?
- `Option` from [accessing the env var](https://doc.rust-lang.org/std/env/fn.var_os.html)?
- OsString of env var (i.e., already checked the env var exists)?
- [Iterator of PathBuf from OsString](https://doc.rust-lang.org/std/env/fn.split_paths.html)?
- Path of a single directory (i.e., env var exists and converted the OsString to a Path)?
## Registry
Covers [pymanager](https://github.com/python/pymanager) installs (although `pymanager list` also includes [PEP 514](https://peps.python.org/pep-0514/) installs).
Data is:
![[Pasted image 20261110132801.png]]
## Microsoft Store installs
> Searching in %LocalAppData%\WindowsApps for the Python folders is the safest way, they don't move.
https://github.com/python/cpython/blob/05d6a94b92ff9098e8947064499f7a1a09b04770/PC/launcher2.c#L1977-L2001 (3.14 only had alphas on the MS Store)