项目作者: faycheng

项目描述 :
Virtualenv for Humans
高级语言: Shell
项目地址: git://github.com/faycheng/venv.git
创建时间: 2017-09-04T02:36:47Z
项目社区:https://github.com/faycheng/venv

开源协议:

下载


venv

Watch the demo:

asciicast

Main Features

  • Organize all of your virtualenvs in $HOME/venvs
  • Wrappers for managing virtualenvs(gen, remove)
  • Show details of virtualenv
  • Activate and deactivate

Installation

Prerequirements

  • Python
  • pip
  • virtualenv

Installation

Clone this repo:

  1. https://github.com/faycheng/venv.git

Append venv.sh to your startup script(~/.zshrc):

  1. echo `source {VENV_REPO_LOCATION}/venv.sh` >> {START_UP_SCRIPT}

Usage

Options:

  1. Usage: venv
  2. Management Commands:
  3. gen Generate venv: gen VENV_NAME PYTHON_EXECUTABLE -r REQUIREMENTS.txt
  4. remove Remove venv: remove VENV_NAME
  5. desc Show details of venv: desc VENV_NAME
  6. list List all venvs: list
  7. activate Activate venv: activate VENV_NAME
  8. deactivate Deactivate working venv: deactivate

Generate a new virtualenv base on python3:

  1. > venv gen dev-py3 $(which python3)
  2. Running virtualenv with interpreter /usr/local/bin/python3
  3. Using base prefix '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6'
  4. New python executable in /Users/cf/.venvs/dev-py3/bin/python3.6
  5. Also creating executable in /Users/cf/.venvs/dev-py3/bin/python
  6. Installing setuptools, pip, wheel...done.
  7. Gen virtualenv success
  8. Name: dev-py3
  9. Python: /usr/local/bin/python3
  10. Location: /Users/cf/.venvs/dev-py3
  11. Activate: venv activate dev-py3

Generate a new virtualenv according to requirements:

  1. > venv gen candy-dev $(which python3) -r requirements.txt
  2. Running virtualenv with interpreter /usr/local/bin/python3
  3. Using base prefix '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6'
  4. New python executable in /Users/chengfei/.venvs/candy-dev/bin/python3.6
  5. Also creating executable in /Users/chengfei/.venvs/candy-dev/bin/python
  6. Installing setuptools, pip, wheel...done.
  7. Collecting Jinja2==2.9.6 (from -r requirements.txt (line 1))
  8. Using cached Jinja2-2.9.6-py2.py3-none-any.whl
  9. Requirement already satisfied: setuptools==36.4.0 in /Users/chengfei/.venvs/candy-dev/lib/python3.6/site-packages (from -r requirements.txt (line 2))
  10. Collecting delegator.py==0.0.13 (from -r requirements.txt (line 3))
  11. Collecting pytest==3.2.1 (from -r requirements.txt (line 4))
  12. Using cached pytest-3.2.1-py2.py3-none-any.whl
  13. Collecting click==6.7 (from -r requirements.txt (line 5))
  14. Using cached click-6.7-py2.py3-none-any.whl
  15. Collecting prompt_toolkit==1.0.15 (from -r requirements.txt (line 6))
  16. Using cached prompt_toolkit-1.0.15-py3-none-any.whl
  17. Collecting MarkupSafe>=0.23 (from Jinja2==2.9.6->-r requirements.txt (line 1))
  18. Collecting pexpect>=4.1.0 (from delegator.py==0.0.13->-r requirements.txt (line 3))
  19. Using cached pexpect-4.2.1-py2.py3-none-any.whl
  20. Collecting py>=1.4.33 (from pytest==3.2.1->-r requirements.txt (line 4))
  21. Using cached py-1.4.34-py2.py3-none-any.whl
  22. Collecting wcwidth (from prompt_toolkit==1.0.15->-r requirements.txt (line 6))
  23. Using cached wcwidth-0.1.7-py2.py3-none-any.whl
  24. Collecting six>=1.9.0 (from prompt_toolkit==1.0.15->-r requirements.txt (line 6))
  25. Using cached six-1.10.0-py2.py3-none-any.whl
  26. Collecting ptyprocess>=0.5 (from pexpect>=4.1.0->delegator.py==0.0.13->-r requirements.txt (line 3))
  27. Using cached ptyprocess-0.5.2-py2.py3-none-any.whl
  28. Installing collected packages: MarkupSafe, Jinja2, ptyprocess, pexpect, delegator.py, py, pytest, click, wcwidth, six, prompt-toolkit
  29. Successfully installed Jinja2-2.9.6 MarkupSafe-1.0 click-6.7 delegator.py-0.0.13 pexpect-4.2.1 prompt-toolkit-1.0.15 ptyprocess-0.5.2 py-1.4.34 pytest-3.2.1 six-1.10.0 wcwidth-0.1.7
  30. Name: candy-dev
  31. Python: Python 3.6.2
  32. Location: /Users/chengfei/.venvs/candy-dev
  33. Activate: venv activate candy-dev
  34. Packages: click==6.7, delegator.py==0.0.13, Jinja2==2.9.6, MarkupSafe==1.0, pexpect==4.2.1, prompt-toolkit==1.0.15, ptyprocess==0.5.2, py==1.4.34, pytest==3.2.1, six==1.10.0, wcwidth==0.1.7

Activate virtualenv called dev-py3:

  1. venv activate dev-py3

Show detailed information of dev-py3:

  1. > venv desc dev-py3
  2. Name: dev-py3
  3. Python: Python 3.6.2
  4. Location: /Users/cf/.venvs/dev-py3
  5. Activate: venv activate dev-py3
  6. Packages: python-redis-lock==3.2.0, redis==2.10.6

List all virtualenvs in $HOME/.venvs:

  1. > venv list
  2. VENV PATH
  3. dev-py3 /Users/cf/.venvs/dev-py3

Contribute

If you’d like to contribute, fork this repository, commit your changes to the develop branch, and send a pull request.