Skip to content

Latest commit

 

History

History
163 lines (118 loc) · 3.66 KB

File metadata and controls

163 lines (118 loc) · 3.66 KB

Usage Scenarios for pyp

Scenario 1: First Time User

$ pyp --help

  pyp - Python Virtual Environment Manager
  =========================================
  
  Usage: pyp [options] [arguments]
  
  Commands:
    -b, --build <name>     Create a new virtual environment
    -a, --activate <name>  Activate a virtual environment
    -d, --deactivate       Deactivate current environment
    -l, --list             List all environments
    -i, --info <name>      Show environment information
    --set-default <name>   Set default environment
    --remove <name>        Remove an environment
    --help, -h             Show this help message
    --version              Show version information

  Options:
    --python VERSION       Python version (e.g., 3.11)
    --system-site-packages Include system site-packages
    --upgrade              Upgrade pip and setuptools

Scenario 2: Create and Activate Environment

$ cd ~/myproject

$ pyp -b myenv
  Building virtual environment: myenv
  Using Python: /usr/bin/python3
  Creating venv at: /home/user/myproject/myenv
  ✓ Virtual environment created successfully!

$ pyp -a myenv
  
  Activating: myenv
  Shell: bash
  
  Run the following command to activate:
    source "/home/user/myproject/myenv/bin/activate"

$ source ~/myproject/myenv/bin/activate

$ (myenv) python --version
Python 3.10.12

$ (myenv) pip install requests
Successfully installed requests-2.31.0

Scenario 3: List Environments

$ pyp -l
  
  Virtual Environments
  ===================
  
  Name                      Path                                        Python
  --------------------------------------------------------------------------------
  myenv                     /home/user/myproject/myenv                  /usr/bin/python3
  data_science              /home/user/projects/data_science            /usr/bin/python3.11
  web_app                   /home/user/webapp/web_app                   /usr/bin/python3
  
  Local environments (current directory):
    - myenv

Scenario 4: Create with Options

$ pyp -b analytics --python 3.11 --system-site-packages --upgrade
  Building virtual environment: analytics
  Using Python: /usr/bin/python3.11
  Creating venv at: /home/user/analytics
  ✓ Virtual environment created successfully!
  Upgrading pip and setuptools...
  ✓ Upgraded successfully!

Scenario 5: Environment Info and Default

$ pyp -i myenv
  
  Environment: myenv
  =============
  
  Path: /home/user/myproject/myenv
  Python: /usr/bin/python3
  Created: 2024-01-15 10:30:45
  ✓ Valid virtual environment

$ pyp --set-default myenv
✓ Default environment set to: myenv

$ pyp -a
  
  Activating: myenv
  Shell: bash
  
  Run the following command to activate:
    source "/home/user/myproject/myenv/bin/activate"

Scenario 6: Remove Environment

$ pyp --remove myenv
Are you want to remove 'myenv'? [y/N] y
✓ Removed environment: myenv

# Or force remove
$ pyp --remove analytics --force
✓ Removed environment: analytics

Scenario 7: Error Handling

$ pyp -b
Error: Environment name required for --build
Usage: pyp --build <environment_name>

$ pyp -a nonexistent
Error: Environment 'nonexistent' not found

$ pyp -i
Error: Environment name required for --info
Usage: pyp --info <environment_name>

$ pyp --remove
Error: Environment name required for --remove
Usage: pyp --remove <environment_name>

Scenario 8: Deactivate

$ pyp -d
  
  Deactivating virtual environment...
  
  Run the following command:
    deactivate

Scenario 9: Version Check

$ pyp --version
pyp v2.0.0
C++ Virtual Environment Manager
Built with only standard libraries