Pip, Virtualenv,VirtualenvWrapper &        More      Django District  Wednesday, Nov. 7, 2012                        Jacki...
Where we all start● easy_install Globally● And it works! Yay!● But then....  ○ dependencies or versions  ○ coordination w/...
Case study: DependenciesOnce upon a time in city, much like this one,there was a newspaper...     ….. over 90 Django appli...
Case study: Breaking sys pythonFrom stackoverflow..."Is there a way to ensure I can clean everythingup and start from zero...
Why Pip & Virtualenv● Isolate  ○ System packages from project packages  ○ Projects from each other● No sudo required - sys...
Becoming the standard...Pep 405Python 3.3http://www.python.org/dev/peps/pep-0405"... proposes to add to Python a mechanism...
What is...●   pip - replaces easy_install●   virtualenv - creates isolated python    environments●   virtualenvwrapper - t...
Basic setup$ sudo easy_install pip$ sudo pip install virtualenv$ sudo pip install virtualenvwrapperAdd to bash settings......
Make environment$ mkvirtualenv fooYou can add more to this... like setting pythonversion.$ mkvirtualenv --python=python2.7
What is virtualenvwrapper?Helps make things easier...  workon foo    vs  source ~/.virtualenvs/foo/bin/activate
Installing librariespip install djangopip install -r requirements.txtpip install -U django
Where does it live? ~/.virtualenv/foo/...…/bin  Binaries in your env. Example: ipython.../include     Dev headers used by ...
Wrappers●   mkvirtualenv (calls hooks)●   rmvirtualenv●   workon (calls hooks)●   add2virtualenv●   cdsitepackages●   cdvi...
Hooks●   postmkvirtualenv●   prermvirtualenv●   postrmvirtualenv●   postactivate●   predeactivate●   postdeactivate
Hook example: postactivateproj_name=$(echo $VIRTUAL_ENV|awk -F/ {print $NF})if [ $proj_name = "foo" ]; then    cd /opt/foo...
Hooks example: postmkvirtualenvhttps://gist.github.com/4034103
Other helpful stuffpip freezepip freeze > requirements.txtyolk -lpython -c "import sys,pprint;pprint.pprint(sys.path)"
More... virtualenv-burritohttps://github.com/brainsik/virtualenv-burritoWith one command.... BAM! (or maybe not)... a virt...
More... virtualenv-toolshttps://github.com/fireteam/virtualenv-tools"This repository contains scripts wereusing at Firetea...
More... Tox http://tox.testrun.org/latest/Tox as is a generic virtualenv management and testcommand line tool you can use ...
More .... Keeping things freshAutoenvhttps://github.com/kennethreitz/autoenv"Magic per-project shell environments. Very pr...
More .... Keeping things fresh(cont)Pip Linthttps://github.com/dcramer/piplint"Piplint validates your current environment ...
The EndMe: Jackie Kazil, @jackiekazilW/ contributions from...Chris Adams, @acdha   &Members of Django-District :-)http://w...
Upcoming SlideShare
Loading in …5
×

Django district pip, virtualenv, virtualenv wrapper & more

1,895 views
1,776 views

Published on

Quick intro of pip, virtualenv, virtualenv wrapper, followed by a current ways to extend and add on.

Published in: Technology
1 Comment
6 Likes
Statistics
Notes
  • Пожалуйста Это деловое предложение, пишите на мой ID обратно, если интересно.
    ------------------------------------

    Счастливые обильные новые ноябре месяце,

    Здравствуйте.
    a
    Как вы сегодня?
    Я надеюсь, у тебя все хорошо и все будет хорошо с вами? Благодарю God.My зовут Дженифер Петерсон. (я ищу хорошие отношения, а также иметь бизнес-предложение с вами), если хотите. Пожалуйста, напишите мне сообщение на мой почтовый ящик
    СПАСИБО,>

    jeniferpeterson1 в / YH / DT / диплом

    ---------------------

    PLEASE THIS BUSINESS PROPOSAL, WRITE ON MY ID BACK IF INTERESTED.
    ------------------------------------

    Happy abundant new month of November,

    Hello.

    how are you today?
    I hope you are fine and all is well with you ? thank God.My name is JENIFER PETERSON .(i am looking for a good relationship and also to have business proposal with you )if you want. please write me message to my email box
    THANKS,>

    jeniferpeterson1 at / yh / dt / cum
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
1,895
On SlideShare
0
From Embeds
0
Number of Embeds
20
Actions
Shares
0
Downloads
8
Comments
1
Likes
6
Embeds 0
No embeds

No notes for slide

Django district pip, virtualenv, virtualenv wrapper & more

  1. 1. Pip, Virtualenv,VirtualenvWrapper & More Django District Wednesday, Nov. 7, 2012 Jackie Kazil @jackiekazil
  2. 2. Where we all start● easy_install Globally● And it works! Yay!● But then.... ○ dependencies or versions ○ coordination w/ other developers ○ keeping different systems on same page ○ breaking sys python
  3. 3. Case study: DependenciesOnce upon a time in city, much like this one,there was a newspaper... ….. over 90 Django applications updated from 0.96 to 1.1.
  4. 4. Case study: Breaking sys pythonFrom stackoverflow..."Is there a way to ensure I can clean everythingup and start from zero?""If you remove everything in these 2 directories,it should clear out all modules...."
  5. 5. Why Pip & Virtualenv● Isolate ○ System packages from project packages ○ Projects from each other● No sudo required - sys python requires sudo access, project python doesn’t
  6. 6. Becoming the standard...Pep 405Python 3.3http://www.python.org/dev/peps/pep-0405"... proposes to add to Python a mechanism forlightweight "virtual environments" with their ownsite directories, optionally isolated from systemsite directories...."
  7. 7. What is...● pip - replaces easy_install● virtualenv - creates isolated python environments● virtualenvwrapper - to be explained later
  8. 8. Basic setup$ sudo easy_install pip$ sudo pip install virtualenv$ sudo pip install virtualenvwrapperAdd to bash settings...source /usr/local/bin/virtualenvwrapper.shexport WORKON_HOME=$HOME/.virtualenvs
  9. 9. Make environment$ mkvirtualenv fooYou can add more to this... like setting pythonversion.$ mkvirtualenv --python=python2.7
  10. 10. What is virtualenvwrapper?Helps make things easier... workon foo vs source ~/.virtualenvs/foo/bin/activate
  11. 11. Installing librariespip install djangopip install -r requirements.txtpip install -U django
  12. 12. Where does it live? ~/.virtualenv/foo/...…/bin Binaries in your env. Example: ipython.../include Dev headers used by the #include directive in C.…/lib Where all your python libraries will live lib/python2.7/site-packages.../share Mans & Docs
  13. 13. Wrappers● mkvirtualenv (calls hooks)● rmvirtualenv● workon (calls hooks)● add2virtualenv● cdsitepackages● cdvirtualenv● deactivate (calls hooks)
  14. 14. Hooks● postmkvirtualenv● prermvirtualenv● postrmvirtualenv● postactivate● predeactivate● postdeactivate
  15. 15. Hook example: postactivateproj_name=$(echo $VIRTUAL_ENV|awk -F/ {print $NF})if [ $proj_name = "foo" ]; then cd /opt/foo/core/ export DJANGO_SETTINGS_MODULE=settings.dev_settings echo "DJANGO_SETTINGS_MODULE set to:"$DJANGO_SETTINGS_MODULEfi
  16. 16. Hooks example: postmkvirtualenvhttps://gist.github.com/4034103
  17. 17. Other helpful stuffpip freezepip freeze > requirements.txtyolk -lpython -c "import sys,pprint;pprint.pprint(sys.path)"
  18. 18. More... virtualenv-burritohttps://github.com/brainsik/virtualenv-burritoWith one command.... BAM! (or maybe not)... a virtualenv & virtualenvwrapper environment
  19. 19. More... virtualenv-toolshttps://github.com/fireteam/virtualenv-tools"This repository contains scripts wereusing at Fireteam for our deployment ofPython code."
  20. 20. More... Tox http://tox.testrun.org/latest/Tox as is a generic virtualenv management and testcommand line tool you can use for:● checking your package installs correctly with different Python versions and interpreters● running your tests in each of the environments, configuring your test tool of choice● acting as a frontend to Continuous Integration servers, greatly reducing boilerplate and merging CI and shell- based testing.
  21. 21. More .... Keeping things freshAutoenvhttps://github.com/kennethreitz/autoenv"Magic per-project shell environments. Very pretentious."Bundle Scouthttp://bundlescout.com/"Daily emails keep you on top of the latest updates fromyour favorite libraries."
  22. 22. More .... Keeping things fresh(cont)Pip Linthttps://github.com/dcramer/piplint"Piplint validates your current environment with therequirements files youve specified."Pip Toolshttps://github.com/nvie/pip-tools"A set of two command line tools to help you keep your pip-based packages fresh, even when youve pinned them"
  23. 23. The EndMe: Jackie Kazil, @jackiekazilW/ contributions from...Chris Adams, @acdha &Members of Django-District :-)http://www.django-district.org/

×