Skip to main content

Pyxenv 🐍 - Python Version/Environment Manager

Python Version License

npx for Python - Manage Python versions and virtual environments with ease

Pyxenv is a command-line tool inspired by Node.js's npx, designed to simplify managing multiple Python versions and virtual environments.

Features

  • Quick version switching - Run scripts with different Python versions
  • Automatic installation - Downloads and installs Python versions automatically (Windows)
  • Virtual environment management - Create and activate virtual environments easily
  • Smart detection - Lists all available Python versions
  • Cross-platform - Support for Windows, Linux and macOS
  • Zero configuration - Works immediately after installation

Installation

Via pip (recommended)

pip install pyxenv

Via GitHub

git clone https://github.com/luigicfilho/pyxenv.git
cd pyxenv
pip install -e .

Quick Usage

Run script with specific version

# Run script.py with Python 3.11
pyxenv 3.11 script.py

# With arguments
pyxenv 3.11 script.py --arg1 value1 --arg2 value2

Manage Python versions

# List versions installed by pyxenv
pyxenv --list

# List all versions (including globals)
pyxenv --list-all

# Auto-install (Windows)
pyxenv 3.12 script.py  # Installs 3.12 if not exists

Manage virtual environments

# Create virtual environment
pyxenv 3.11 --create-env my-project

# Create with default name (pyxenv-3.11)
pyxenv 3.11 --create-env

# Activate environment
pyxenv --activate my-project

# List environments
pyxenv --list-envs

Examples

Multi-version development

# Test your code in different versions
pyxenv 3.8 test_script.py
pyxenv 3.9 test_script.py
pyxenv 3.11 test_script.py
pyxenv 3.12 test_script.py

Isolated projects

# Django project with Python 3.11
pyxenv 3.11 --create-env django-project
pyxenv --activate django-project
pip install django
django-admin startproject mysite

# FastAPI project with Python 3.12
pyxenv 3.12 --create-env fastapi-project
pyxenv --activate fastapi-project
pip install fastapi uvicorn

CI/CD

# .github/workflows/test.yml
name: Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: windows-latest
    strategy:
      matrix:
        python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
    
    steps:
      - uses: actions/checkout@v3
      - name: Install pyxenv
        run: pip install pyxenv
      - name: Run tests
        run: pyxenv ${{ matrix.python-version }} -m pytest

Commands

Command Description
pyxenv <version> <script> Run script with specific version
pyxenv --list List versions installed by pyxenv
pyxenv --list-all List all detected versions
pyxenv --create-env <name> Create virtual environment
pyxenv --activate <name> Activate virtual environment
pyxenv --list-envs List created environments
pyxenv --version Show pyxenv version

Directory Structure

~/.pyxenv/
├── pythons/          # Installed Python versions
│   ├── 3.8.10/
│   ├── 3.11.5/
│   └── 3.12.0/
└── envs/             # Virtual environments
    ├── my-project/
    ├── django-app/
    └── pyxenv-3.11/

Configuration

pyxenv works without configuration, but you can customize:

# ~/.pyxenv/config.py (optional)
pyxenv_HOME = Path.home() / ".pyxenv"
PYTHON_DIR = pyxenv_HOME / "pythons"
ENV_DIR = pyxenv_HOME / "envs"

Troubleshooting

Python not found

# Check available versions
pyxenv --list-all

# Install specific version (Windows)
pyxenv 3.11 --version  # Auto-installs

Virtual environment not activating

# Check if it exists
pyxenv --list-envs

# Recreate if necessary
pyxenv 3.11 --create-env env-name

Contributing

Contributions are welcome! See CONTRIBUTING.md for details.

Development setup

# Clone repository
git clone https://github.com/luigicfilho/pyxenv.git
cd pyxenv

# Install development dependencies
pip install -e .

# Run tests
pytest

# Check coverage
pytest --cov=pyxenv --cov-report=html

Run tests

# All tests
pytest

# Specific tests
pytest tests/test_cli.py

# With verbose output
pytest -vv

# With coverage
pytest --cov=pyxenv --cov-report=term-missing

Code style

# Format code
black pyxenv tests

# Sort imports
isort pyxenv tests

# Check style
flake8 pyxenv tests

# Type checking
mypy pyxenv

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Luigi C. Filho

Acknowledgments

  • Inspired by Node.js's npx
  • Python community for excellent documentation

Project Status

  • Python version detection
  • Virtual environment management
  • Automatic installation (Windows)
  • Automatic installation (Linux/macOS) - In development
  • Download cache - Planned
  • Auto-update - Planned

Useful Links

Roadmap

v0.2.0

  • pyenv support
  • Auto-install on Linux/macOS
  • Installer cache

v0.3.0

  • Interactive TUI interface
  • Project configuration (.pyxenvrc)
  • Docker integration

v1.0.0

  • Stable API
  • Complete documentation
  • Verified PyPI package

Inspiration and Alternatives

  • pyenv - Complete Python version manager
  • virtualenv - Virtual environment creation
  • pipx - Install and run Python applications
  • conda - Package and environment manager

pyxenv combines the best of these worlds with the simplicity of npx!

Star History

If this project has been useful to you, consider giving it a ⭐!


Made with ❤️ by Luigi C. Filho

Metadata

Release files for pyxenv 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyxenv 0.2.0
File Size Uploaded Provenance Actions
pyxenv-0.2.0.tar.gz 16.7 kB With provenance Details for pyxenv-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyxenv 0.2.0
File Interpreter ABI Platform Actions
pyxenv-0.2.0-py3-none-any.whl Python 3 none any Details for pyxenv-0.2.0-py3-none-any.whl

Total release size: 28.8 kB

Release files / pyxenv-0.2.0.tar.gz

Download URL pyxenv-0.2.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a2f4df365763db525df91f805551eb57089d7b13293b2c91778aefaaed810779
BLAKE2b-256 checksum
How to use checksums
27fb852a596ef73e97e79c67c86c7565c631f7e35634db388102c3c7d3e7f5d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2025.

Transparency log

Release files / pyxenv-0.2.0-py3-none-any.whl

Download URL pyxenv-0.2.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a96c9fb684573c0f90d291c570519561b90f34be13fbd05abf43129ab3f22df
BLAKE2b-256 checksum
How to use checksums
01ae21c40505c3d3c2dbcb45759f4167c918359bfcbd18788b634f8a08ea586f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2025.

Transparency log

Security for pyxenv 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyxenv-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page