A CLI utility to manage Python virtual environments with auto-detection of system Python installations.
- Auto-detect Python installations across Windows, macOS, and Linux (pyenv, conda, system Python)
- Manage interpreters - add/list/remove and set defaults
- Project-aware defaults - per-project
pynstal.jsonplus global config under~/.pynstal - Create virtual environments using any configured Python interpreter
- Install templates - predefined and custom package templates (including pip args like CUDA wheels)
- Persistent configuration - interpreter paths and templates stored in global config, with optional project-local defaults
pip install pynstalAfter installation, use the pynstal command:
pynstal --helpgit clone https://github.com/yourusername/PythonProjectManager.git
cd PythonProjectManager
pip install -e .# List found Python installations
pynstal interpreter detect
# Interactively select which to add
pynstal interpreter detect --add
# Add all detected interpreters
pynstal interpreter detect --add-allpynstal set-default-interpreter # prompts to choose from the configured list# Uses project-local default (pynstal.json) or global default if not provided
pynstal create-venv my_venv
# Or specify an interpreter explicitly
pynstal create-venv my_venv --interpreter "/usr/bin/python3.12"# List available templates
pynstal template list
# Create venv with datascience template (numpy, scipy, pandas, etc.)
pynstal create-from-template datascience my_ds_venv
# Create venv with PyTorch (CUDA 12.4)
pynstal create-from-template pytorch-cu124 my_pytorch_venv# Create a template (interactive)
pynstal template add mytemplate
# then add packages
pynstal template add-pkg mytemplate numpy scipy matplotlib
# or add packages with custom pip args
pynstal template add-pkg-complex mytemplate torch torchvision --args-str "--index-url https://download.pytorch.org/whl/cu124"
# Create venv from the custom template
pynstal create-from-template mytemplate my_venv-
Interpreter management
pynstal interpreter list- List configured interpreterspynstal interpreter detect [--add | --add-all]- Auto-detect system Python installationspynstal interpreter add- Interactive prompt to add interpreter pathspynstal interpreter remove- Interactive prompt to remove interpreter pathspynstal add-interpreter <path>- Manually add a Python interpreter path (positional)pynstal set-default-interpreter- Interactive prompt to choose the global default interpreter
-
pynstal create-venv <venv_dir> [--interpreter <path>] [--dry-run]- Create a virtual environment -
pynstal create-from-template <template> <venv_dir> [--interpreter <path>] [--dry-run]- Create venv and install template packages -
pynstal remove-venv <venv_dir>- Delete a virtual environment and clean up references -
pynstal install <template> [--interpreter <path>] [--dry-run]- Install packages from a template into an interpreter without creating a venv -
Template management
pynstal template list- List all templatespynstal template show <name>- Show template detailspynstal template create <name>- Create a new template interactivelypynstal template add-pkg <name> <packages...>- Add packages to an existing templatepynstal template add-pkg-complex <name> <packages...> --args-str "<args>"- Add packages with pip args to a templatepynstal template remove-pkg <name>- Interactively remove packages from a templatepynstal template remove <name>- Remove a template
- Global config:
~/.pynstal(or$XDG_CONFIG_HOME/pynstal)interpreters.json– configured interpreter paths anddefault_interpretertemplates.json– user-defined package templates
- Project-local config:
./pynstal.jsondefault_interpreter– default interpreter for the current project (set automatically when creating a venv)
- Windows: Detects pyenv-win, AppData Python installations, system Python
- macOS/Linux: Detects /usr/bin/python*, pyenv, conda, system Python
MIT
Contributions welcome! Please feel free to submit issues and pull requests.