Skip to content

Latest commit

 

History

History
277 lines (194 loc) · 5.56 KB

File metadata and controls

277 lines (194 loc) · 5.56 KB

pyp - C++ Virtual Environment Manager

C++17 Version License

A lightweight, high-performance Python virtual environment manager built in C++


🌟 Features

  • Blazing Fast - Written in C++ for instant startup and minimal memory usage
  • Zero Dependencies - Built with only standard C++ libraries (no external dependencies)
  • Cross-Platform - Works on Linux, macOS, and Windows
  • Beautiful Output - Colorized terminal output for better readability
  • User-Friendly - Simple, intuitive commands
  • Secure - No Python runtime vulnerabilities, smaller attack surface

🚀 Quick Start

Installation

# Clone or download the source
cd pyp-cpp

# Make install script executable
chmod +x install.sh

# Run installation
./install.sh

# Restart your shell or source your config
source ~/.bashrc  # or ~/.zshrc

# Verify installation
pyp --help

Basic Usage

# Create a virtual environment
pyp -b myenv

# Create with specific Python version
pyp -b myenv --python 3.11

# Create with system site-packages
pyp -b myenv --system-site-packages

# Create and upgrade pip/setuptools
pyp -b myenv --upgrade

# Activate environment
pyp -a myenv

# List all environments
pyp -l

# Show environment info
pyp -i myenv

# Set default environment
pyp --set-default myenv

# Deactivate (run in shell)
deactivate

# Remove environment
pyp --remove myenv

📋 Command Reference

Command Description
pyp -b <name> Create a new virtual environment
pyp -a <name> Activate a virtual environment
pyp -d Deactivate current environment
pyp -l List all environments
pyp -i <name> Show environment information
pyp --set-default <name> Set default environment
pyp --remove <name> Remove an environment
pyp --help Show help message
pyp --version Show version information

Options

Option Description
--python VERSION Python version (e.g., 3.11)
--system-site-packages Include system site-packages
--upgrade Upgrade pip and setuptools after creation

🏗️ Installation Options

Default Installation

./install.sh
  • Installs to ~/.local/bin
  • Automatically configures PATH
  • Creates backup of existing configuration

Custom Installation Directory

./install.sh --install-dir /usr/local/bin

Skip PATH Configuration

./install.sh --no-path

Force Reinstallation

./install.sh --force

🗑️ Uninstallation

Standard Uninstallation

./uninstall.sh

Keep Configuration

./uninstall.sh --keep-config

Skip Confirmation

./uninstall.sh --force

🔧 Technical Details

Compilation Requirements

  • Compiler: g++ or clang++
  • Standard: C++17 (for <filesystem> support)
  • Flags: -std=c++17 -O2 -Wall -Wextra

Built-in Libraries Used

#include <iostream>      // Input/output streams
#include <fstream>       // File operations
#include <sstream>       // String streams
#include <string>        // String manipulation
#include <vector>        // Dynamic arrays
#include <map>           // Key-value pairs
#include <filesystem>    // File system operations (C++17)
#include <cstdlib>       // System calls
#include <chrono>        // Time operations

Performance Comparison

Metric Python Version C++ Version
Startup Time ~50-100ms ~1-5ms
Memory Usage ~10-20MB ~1-5MB
Dependencies Python 3.6+ None

📁 Project Structure

pyp-cpp/
├── main.cpp          # Main C++ source code
├── install.sh        # Installation script
├── uninstall.sh      # Uninstallation script
├── test.sh          # Test script
├── README.md        # This file
└── LICENSE          # MIT License

🐧 Platform-Specific Notes

Linux

  • Default install directory: ~/.local/bin
  • Requires g++ or clang++
  • Supports bash and zsh

macOS

  • Requires Xcode command line tools
  • Supports zsh (default shell on macOS 10.15+)
  • Uses BSD sed instead of GNU sed

Windows

  • Uses WSL or MinGW for compilation
  • Supports PowerShell and CMD
  • Binary: pyp.exe

📝 Configuration

Configuration File

Location: ~/.pyp_config.json

{
  "myenv": {
    "path": "/home/user/projects/myenv",
    "python": "/usr/bin/python3",
    "created": "2024-01-01 12:00:00"
  },
  "default": {
    "path": "/home/user/projects/myenv",
    "python": "/usr/bin/python3"
  }
}

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

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


🙏 Acknowledgments


LotusOS-Core , 2025-2026