- Python 100%
Expanded README with detailed tool description, features, installation instructions, usage examples, and contribution guidelines. |
||
|---|---|---|
| LICENSE | ||
| pyfinder.py | ||
| README.md | ||
π pyfinder - Where are my py?
pyfinder is a cross-platform command-line tool that finds all Python interpreters and package managers installed on your system. It searches across PATH, pyenv, conda, and the Windows Registryβthen presents the results in a clear, colorful overview.
β¨ Features
- π Comprehensive Discovery β Finds Python interpreters from:
PATH(common names likepython3,python3.11,pypy3, etc.)- The currently running interpreter (
sys.executable) pyenvinstallationscondaenvironments- Windows Registry (PEP 514)
- π¦ Package Managers β Detects package managers including
pip,conda,mamba,poetry,pdm,uv,pipenv, and more. - π Beautiful Output β Color-coded terminal output with icons, status indicators, and neatly formatted paths.
- π JSON Export β Option to output machine-readable JSON (great for scripts or CI/CD).
- πͺ Windows Friendly β Uses
pylauncher detection,winreg, andNO_COLORsupport. - β‘ Zero Dependencies β Pure Python 3 standard library. No
pip installneeded.
π¦ Installation
Just download the scriptβno dependencies required.
git clone https://github.com/0xA672/pyfinder.git
cd pyfinder
python pyfinder.py
Or copy it directly:
curl -O https://raw.githubusercontent.com/0xA672/pyfinder/main/pyfinder.py
python pyfinder.py
π Usage
python pyfinder.py [OPTIONS]
Options
| Flag | Description |
|---|---|
-i, --interpreters-only |
Show only Python interpreters |
-p, --packages-only |
Show only package managers |
-j, --json |
Output in JSON format |
--no-color |
Disable colored output |
Examples
1. Default β show everything
$ python pyfinder.py
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
System Info
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
OS Linux 5.15.0-91-generic (x86_64)
Python 3.11.6
Prefix /usr
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Python Interpreters
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1 β python3.11 Python 3.11.6
β³ /usr/bin/python3.11
src: sys.executable
2 β python3 Python 3.10.12
β³ /usr/bin/python3
src: PATH
3 β pyenv:3.9.18 Python 3.9.18
β³ /home/user/.pyenv/versions/3.9.18/bin/python
src: pyenv
...
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Package Managers
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1 β pip 23.2.1
β³ /usr/bin/pip
src: PATH
2 β poetry Poetry (version 1.6.1)
β³ /home/user/.local/bin/poetry
src: PATH
...
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Interpreters: 4 Β· Package Managers: 3 Β· Unreachable: 0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2. Only interpreters, JSON output
$ python pyfinder.py -i -j
3. Use in a script
import subprocess, json
result = subprocess.run(["python", "pyfinder.py", "-j"], capture_output=True, text=True)
data = json.loads(result.stdout)
for interpreter in data["interpreters"]:
print(interpreter["path"])
π JSON Schema
{
"platform": {
"system": "Linux",
"release": "5.15.0-91-generic",
"machine": "x86_64",
"python_version": "3.11.6"
},
"interpreters": [
{
"name": "python3.11",
"path": "/usr/bin/python3.11",
"version": "Python 3.11.6",
"source": "sys.executable",
"accessible": true
}
],
"package_managers": [
{
"name": "pip",
"path": "/usr/bin/pip",
"version": "23.2.1",
"source": "PATH",
"accessible": true
}
]
}
π§© How It Works
pyfinder scans your system using multiple strategies:
- PATH scanning β Looks for executables named
python3,python,pip, etc. - Current process β Uses
sys.executable. - pyenv β Lists all versions under
$PYENV_ROOT/versions(or~/.pyenv). - conda β Runs
conda env listand checks each environmentβsbin/python. - Windows Registry β Reads PEP 514 keys to find Python installations.
pylauncher (Windows only) β Detects the Python launcher andpy -m pip.
Each found executable is verified for accessibility (os.X_OK) and its version is extracted.
π οΈ Requirements
- Python 3.6+ (uses f-strings,
subprocess.run,dataclasses) - No external packages required
- Works on Linux, macOS, and Windows
π€ Contributing
Contributions are welcome! Here's how you can help:
- Test on different operating systems and report issues
- Add support for additional package managers
- Improve error handling or performance
- Submit PRs with enhancements
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
Inspired by pythonfinder and the need for a lightweight, dependencyβfree Python discovery tool.
pyfinder β never lose track of your Python installations again.