A Tkinter-based graphical user interface for managing pyenv Python versions. This tool provides an intuitive way to view, install, uninstall, and switch between Python versions managed by pyenv without needing to use the command line for every operation.
- List Installed Versions: Clearly displays all Python versions currently installed by
pyenv. - Active Version Indicators: Shows which versions are currently active (global
*, local>). - View Available Versions: Fetches and lists all Python versions available for installation via
pyenv install --list. - Filter Available Versions: Quickly find specific versions in the available list by typing part of the version name or number into the filter field. The list updates dynamically as you type.
- Install Python Versions: Select and install new Python versions from the available list with visual progress.
- Uninstall Python Versions: Easily remove installed Python versions.
- Set Global Version: Set the default global Python version recognized by
pyenv. - Set Local Version: Set a project-specific Python version (creates/updates
.python-versionin the current directory where the GUI is launched from, ifpyenv localis supported and effective in that context). - GUI Shell Version Override: Set a
PYENV_VERSIONspecifically for the context of this GUI application. This allows you to runpyenvcommands within this GUI as if a particular version is active viaPYENV_VERSION, without affecting your actual shell'sPYENV_VERSIONenvironment variable. - Real-time Output Console: Displays the output of
pyenvcommands as they execute, providing transparency and debugging information. - Asynchronous Operations: Long-running tasks (like installations) are performed in separate threads, keeping the GUI responsive.
- Progress Indication: Uses a text spinner for fetching data and an indeterminate progress bar for installations.
- Cross-Platform Theming: Attempts to use native-looking themes (
vistaon Windows,aquaon macOS,clamon other systems). - Auto-detection: Attempts to find the
pyenvexecutable andPYENV_ROOT.
- Python 3.x: The script itself is written in Python 3.
- Tkinter: This is Python's standard GUI package.
- On Windows and macOS, it's usually included with Python.
- On Linux, you might need to install it separately (e.g.,
sudo apt-get install python3-tkon Debian/Ubuntu).
pyenv:pyenvmust be installed and correctly configured in your system.- The
pyenvcommand must be accessible in your system'sPATH. - Your shell environment (
~/.bashrc,~/.zshrc, etc.) should have the necessarypyenv initlines. - The GUI relies on
pyenvfor all Python version management operations.
- Save the Code: Save the Python script provided as a
.pyfile (e.g.,pyenv_gui.py). - Ensure Prerequisites: Verify that Python 3, Tkinter, and a working
pyenvinstallation are present. - Execute the Script:
Open your terminal or command prompt, navigate to the directory where you saved the file, and run:
or
python pyenv_gui.py
python3 pyenv_gui.py
- Top Bar:
- Current Versions: Displays the detected
pyenvglobal, local (if any), and the GUI-context shell override version. - Status Indicator: Shows a text spinner during data fetching or a progress bar during installations.
- Refresh All: Button to reload all version lists and current version information.
- Current Versions: Displays the detected
- Versions Pane (Left):
- Installed Versions:
- Listbox showing currently installed Python versions.
*indicates the version active due toPYENV_VERSION(if set by GUI) or the global setting.>indicates the version active due to a local.python-versionfile.- Buttons:
Uninstall,Set Global,Set Local.
- Shell Version Override (GUI Context Only):
- Input field to specify a Python version.
Set: Applies this version toPYENV_VERSIONfor commands run by this GUI instance.Clear: Clears the GUI-contextPYENV_VERSIONoverride.
- Available for Installation:
- Filter: An entry field labeled "Filter:". Type part of a Python version name or number here (e.g., "3.10", "pypy", "miniconda") to dynamically filter the list below.
- Listbox showing versions available for installation based on the filter.
- Button:
Install Selected.
- Installed Versions:
- Output Console (Right):
- A scrolled text area displaying the output (stdout/stderr) from the
pyenvcommands executed by the GUI. This is useful for monitoring progress and diagnosing issues.
- A scrolled text area displaying the output (stdout/stderr) from the
The application serves as a graphical front-end to the pyenv command-line tool.
- It discovers the
pyenvexecutable andPYENV_ROOT. - When you perform an action (e.g., "Install"), the GUI constructs the appropriate
pyenvcommand (e.g.,pyenv install 3.9.7). - These commands are run in separate threads using Python's
subprocessmodule to avoid freezing the GUI. - Output from these commands is captured and displayed in the "Output Console".
- A
queueis used for inter-thread communication to update the GUI safely from worker threads. - The "Shell Version Override" works by setting the
PYENV_VERSIONenvironment variable specifically for the subprocesses launched by the GUI. This doesn't alter your system-wide or terminal-specificPYENV_VERSION.
- Initial
pyenv install --list: Fetching the list of all available versions can be slow, aspyenvitself needs to update its index. The GUI will be disabled during this fetch, with a spinner indicating activity. - Local Version Context: "Set Local" will attempt to set the local version in the directory from which the
pyenv_gui.pyscript was launched. Its effectiveness depends onpyenv's standard behavior. - Error Handling: While the GUI tries to catch and display errors from
pyenvcommands, complexpyenvor build issues might require looking atpyenv's own logs or troubleshooting build dependencies manually. PYENV_ROOTandpyenvexecutable: The script tries its best to find these. If they are in very non-standard locations orpyenvis not inPATH, it might fail to initialize. SettingPYENV_ROOTas an environment variable can help.
Feel free to fork this project, submit issues, or suggest improvements!