Skip to main content

CLI utility to manage Python virtual environments with auto-detection

Project description

pynstal

A CLI utility to manage Python virtual environments with auto-detection of system Python installations.

Features

  • Auto-detect Python installations across Windows, macOS, and Linux (pyenv, conda, system Python)
  • Manage interpreters - add, list, and configure Python interpreter paths
  • Create virtual environments using any configured Python interpreter
  • Install templates - predefined and custom package templates with special pip arguments (e.g., CUDA-specific PyTorch)
  • Persistent configuration - interpreter paths and templates stored in .pynstal/interpreters.json and .pynstal/templates.json

Installation

From PyPI

pip install pynstal

After installation, use the pynstal command:

pynstal --help

From source

git clone https://github.com/yourusername/PythonProjectManager.git
cd PythonProjectManager
pip install -e .

Quick Start

1. Detect and add Python installations

# List found Python installations
pynstal interpreter detect

# Interactively select which to add
pynstal interpreter detect --add

# Add all detected interpreters
pynstal interpreter detect --add-all

2. Create a virtual environment

pynstal create-venv "C:\Users\...\python.exe" my_venv

3. Install packages using templates

# 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

4. Create custom templates

# Simple template
pynstal template add mytemplate "numpy scipy matplotlib"

# Add packages with custom pip args to an existing template
pynstal template add-pkg-complex mytemplate torch torchvision --args-str "--index-url https://download.pytorch.org/whl/cu124"

# Create venv from custom template
pynstal create-from-template mytemplate my_venv

Commands

  • Interpreter management

    • pynstal interpreter list - List configured interpreters
    • pynstal interpreter detect [--add | --add-all] - Auto-detect system Python installations
    • pynstal interpreter add - Interactive prompt to add interpreter paths
    • pynstal interpreter remove - Interactive prompt to remove interpreter paths
    • pynstal 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 <interpreter> <venv_dir> [--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 template list - List all templates

  • pynstal template show <name> - Show template details

  • pynstal template add <name> "<packages>" - Add a simple template

  • pynstal template add-pkg <name> <packages...> - Add packages to an existing template

  • pynstal template add-pkg-complex <name> <packages...> --args-str "<args>" - Add packages with pip args to a template

  • pynstal template remove-pkg <name> - Interactively remove packages from a template

  • pynstal template remove <name> - Remove a template

  • pynstal install <template> [--interpreter <path>] [--dry-run] - Install packages from a template into an interpreter without creating a venv

Data Storage

  • Interpreters: .pynstal/interpreters.json - stores configured Python interpreter paths
  • Templates: .pynstal/templates.json - stores user-defined package installation templates

Configuration

interpreters.json

{
    "FILE_PATH": "interpreters.json",
    "interpreters": [
        "C:\\Users\\...\\python.exe",
        "/usr/bin/python3.12"
    ],
    "global_interpreter": null
}

templates.json

{
    "templates": {
        "simple": ["numpy", "scipy"],
        "pytorch-cu124": {
            "packages": ["torch", "torchvision"],
            "args": ["--index-url", "https://download.pytorch.org/whl/cu124"]
        }
    }
}

Platform Support

  • Windows: Detects pyenv-win, AppData Python installations, system Python
  • macOS/Linux: Detects /usr/bin/python*, pyenv, conda, system Python

License

MIT

Contributing

Contributions welcome! Please feel free to submit issues and pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynstal-0.1.4-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file pynstal-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pynstal-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pynstal-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9fb1fb66eb47bfa4c57e2b49547432efccf675b42c3179445180ad01983cb7c0
MD5 1e04f99c6b825c7141083a22b92b2764
BLAKE2b-256 e816e3aef5f61a621562dc108228e93c55e3b30e75ef75c24d83e9474729e683

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page