SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
Pip, Virtualenv,
VirtualenvWrapper &
        More
      Django District
  Wednesday, Nov. 7, 2012

                        Jackie Kazil
                        @jackiekazil
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
Case study: Dependencies
Once upon a time in city, much like this one,
there was a newspaper...

     ….. over 90 Django applications updated
  from 0.96 to 1.1.
Case study: Breaking sys python
From stackoverflow...
"Is there a way to ensure I can clean everything
up and start from zero?"

"If you remove everything in these 2 directories,
it should clear out all modules...."
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
Becoming the standard...
Pep 405
Python 3.3

http://www.python.org/dev/peps/pep-0405

"... proposes to add to Python a mechanism for
lightweight "virtual environments" with their own
site directories, optionally isolated from system
site directories...."
What is...
●   pip - replaces easy_install

●   virtualenv - creates isolated python
    environments




●   virtualenvwrapper - to be explained later
Basic setup
$ sudo easy_install pip
$ sudo pip install virtualenv
$ sudo pip install virtualenvwrapper

Add to bash settings...
source /usr/local/bin/virtualenvwrapper.sh
export WORKON_HOME=$HOME/.virtualenvs
Make environment
$ mkvirtualenv foo

You can add more to this... like setting python
version.
$ mkvirtualenv --python=python2.7
What is virtualenvwrapper?
Helps make things easier...

  workon foo
    vs
  source ~/.virtualenvs/foo/bin/activate
Installing libraries
pip install django
pip install -r requirements.txt
pip install -U django
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
Wrappers
●   mkvirtualenv (calls hooks)
●   rmvirtualenv
●   workon (calls hooks)
●   add2virtualenv
●   cdsitepackages
●   cdvirtualenv
●   deactivate (calls hooks)
Hooks
●   postmkvirtualenv
●   prermvirtualenv
●   postrmvirtualenv
●   postactivate
●   predeactivate
●   postdeactivate
Hook example: postactivate
proj_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_MODULE
fi
Hooks example: postmkvirtualenv
https://gist.github.com/4034103
Other helpful stuff
pip freeze
pip freeze > requirements.txt

yolk -l

python -c "import sys,pprint;pprint.pprint(sys.
path)"
More... virtualenv-burrito
https://github.com/brainsik/virtualenv-burrito

With one command.... BAM! (or maybe not)
... a virtualenv & virtualenvwrapper environment
More... virtualenv-tools
https://github.com/fireteam/virtualenv-tools

"This repository contains scripts we're
using at Fireteam for our deployment of
Python code."
More... Tox http://tox.testrun.org/latest/
Tox as is a generic virtualenv management and test
command 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.
More .... Keeping things fresh
Autoenv
https://github.com/kennethreitz/autoenv
"Magic per-project shell environments. Very pretentious."


Bundle Scout
http://bundlescout.com/
"Daily emails keep you on top of the latest updates from
your favorite libraries."
More .... Keeping things fresh
(cont)
Pip Lint
https://github.com/dcramer/piplint
"Piplint validates your current environment with the
requirements files you've specified."


Pip Tools
https://github.com/nvie/pip-tools
"A set of two command line tools to help you keep your pip-
based packages fresh, even when you've pinned them"
The End
Me: Jackie Kazil, @jackiekazil

W/ contributions from...
Chris Adams, @acdha
   &
Members of Django-District :-)
http://www.django-district.org/

Mais conteúdo relacionado

Mais procurados

Tsung Intro presentation 2013
Tsung Intro presentation 2013Tsung Intro presentation 2013
Tsung Intro presentation 2013Steffen Larsen
 
Easy distributed load test with Tsung
Easy distributed load test with TsungEasy distributed load test with Tsung
Easy distributed load test with TsungNgoc Dao
 
Don’t block the event loop!
Don’t block the event loop!Don’t block the event loop!
Don’t block the event loop!hujinpu
 
Scale11x lxc talk
Scale11x lxc talkScale11x lxc talk
Scale11x lxc talkdotCloud
 
Python + Machine Learning Course, Session 2
Python + Machine Learning Course, Session 2Python + Machine Learning Course, Session 2
Python + Machine Learning Course, Session 2aminmesbahi
 
Porting Gentoo to DragonFly
Porting Gentoo to DragonFlyPorting Gentoo to DragonFly
Porting Gentoo to DragonFlyNaohiro Aota
 
NodeJs
NodeJsNodeJs
NodeJsdizabl
 
Torch7 and ConvNet
Torch7 and ConvNetTorch7 and ConvNet
Torch7 and ConvNetQin Jian
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxSignalFx
 
Re: 제로부터시작하는텐서플로우
Re: 제로부터시작하는텐서플로우Re: 제로부터시작하는텐서플로우
Re: 제로부터시작하는텐서플로우Mario Cho
 
pam_container -- jeszcze lżejsza wirtualizacja
pam_container -- jeszcze lżejsza wirtualizacjapam_container -- jeszcze lżejsza wirtualizacja
pam_container -- jeszcze lżejsza wirtualizacjagnosek
 
Node Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node ModulesNode Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node ModulesRick Chang
 
Glusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offsGlusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offsPranith Karampuri
 
Terraform: начинайте использовать, если еще не.
Terraform: начинайте использовать, если еще не.Terraform: начинайте использовать, если еще не.
Terraform: начинайте использовать, если еще не.Serhii Vasylenko
 

Mais procurados (19)

Tsung Intro presentation 2013
Tsung Intro presentation 2013Tsung Intro presentation 2013
Tsung Intro presentation 2013
 
Easy distributed load test with Tsung
Easy distributed load test with TsungEasy distributed load test with Tsung
Easy distributed load test with Tsung
 
Don’t block the event loop!
Don’t block the event loop!Don’t block the event loop!
Don’t block the event loop!
 
Scale11x lxc talk
Scale11x lxc talkScale11x lxc talk
Scale11x lxc talk
 
Python + Machine Learning Course, Session 2
Python + Machine Learning Course, Session 2Python + Machine Learning Course, Session 2
Python + Machine Learning Course, Session 2
 
Porting Gentoo to DragonFly
Porting Gentoo to DragonFlyPorting Gentoo to DragonFly
Porting Gentoo to DragonFly
 
NodeJs
NodeJsNodeJs
NodeJs
 
Torch intro
Torch introTorch intro
Torch intro
 
Torch7 and ConvNet
Torch7 and ConvNetTorch7 and ConvNet
Torch7 and ConvNet
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
 
Re: 제로부터시작하는텐서플로우
Re: 제로부터시작하는텐서플로우Re: 제로부터시작하는텐서플로우
Re: 제로부터시작하는텐서플로우
 
pam_container -- jeszcze lżejsza wirtualizacja
pam_container -- jeszcze lżejsza wirtualizacjapam_container -- jeszcze lżejsza wirtualizacja
pam_container -- jeszcze lżejsza wirtualizacja
 
Node Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node ModulesNode Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node Modules
 
Elastic search
Elastic searchElastic search
Elastic search
 
RingoJS
RingoJSRingoJS
RingoJS
 
devday2012
devday2012devday2012
devday2012
 
Glusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offsGlusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offs
 
Terraform: начинайте использовать, если еще не.
Terraform: начинайте использовать, если еще не.Terraform: начинайте использовать, если еще не.
Terraform: начинайте использовать, если еще не.
 
Koha
KohaKoha
Koha
 

Destaque

We Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese ShopWe Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese ShopTzu-ping Chung
 
Python, Development Environment for Windows
Python, Development Environment for WindowsPython, Development Environment for Windows
Python, Development Environment for WindowsKwangyoun Jung
 
Python Recipes for django girls seoul
Python Recipes for django girls seoulPython Recipes for django girls seoul
Python Recipes for django girls seoulJoeun Park
 
The Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.pyThe Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.pyTzu-ping Chung
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at PyconJacqueline Kazil
 
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCMindfire Solutions
 
NoSql Day - Chiusura
NoSql Day - ChiusuraNoSql Day - Chiusura
NoSql Day - ChiusuraWEBdeBS
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework  for perfectionists with deadlinesDjango - The Web framework  for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesMarkus Zapke-Gründemann
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1Ke Wei Louis
 
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribThe Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribTzu-ping Chung
 
Django mongodb -djangoday_
Django mongodb -djangoday_Django mongodb -djangoday_
Django mongodb -djangoday_WEBdeBS
 
2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 Na Lee
 
라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘Jiho Lee
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesMarkus Zapke-Gründemann
 

Destaque (20)

We Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese ShopWe Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese Shop
 
Python, Development Environment for Windows
Python, Development Environment for WindowsPython, Development Environment for Windows
Python, Development Environment for Windows
 
Python Recipes for django girls seoul
Python Recipes for django girls seoulPython Recipes for django girls seoul
Python Recipes for django girls seoul
 
The Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.pyThe Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.py
 
User-centered open source
User-centered open sourceUser-centered open source
User-centered open source
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at Pycon
 
EuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein RückblickEuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein Rückblick
 
PythonBrasil[8] closing
PythonBrasil[8] closingPythonBrasil[8] closing
PythonBrasil[8] closing
 
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVC
 
Bottle - Python Web Microframework
Bottle - Python Web MicroframeworkBottle - Python Web Microframework
Bottle - Python Web Microframework
 
Vim for Mere Mortals
Vim for Mere MortalsVim for Mere Mortals
Vim for Mere Mortals
 
NoSql Day - Chiusura
NoSql Day - ChiusuraNoSql Day - Chiusura
NoSql Day - Chiusura
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework  for perfectionists with deadlinesDjango - The Web framework  for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribThe Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contrib
 
Django mongodb -djangoday_
Django mongodb -djangoday_Django mongodb -djangoday_
Django mongodb -djangoday_
 
2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论
 
라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
 
Django-Queryset
Django-QuerysetDjango-Queryset
Django-Queryset
 

Semelhante a Django district pip, virtualenv, virtualenv wrapper & more

Virtualenv
VirtualenvVirtualenv
VirtualenvWEBdeBS
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-Gründemann
 
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Codemotion
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenvamenasse
 
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideAWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideRapidValue
 
Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Takuya Nishimoto
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialJustin Lin
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modulesKris Buytaert
 
Package Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerPackage Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerJianwen Wei
 
First python project
First python projectFirst python project
First python projectNeetu Jain
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-Gründemann
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
 
Installing OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.xInstalling OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.xNader Karimi
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolutionTatiana Al-Chueyr
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingHenry Schreiner
 

Semelhante a Django district pip, virtualenv, virtualenv wrapper & more (20)

Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenv
 
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideAWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
 
Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Great Hiroshima with Python 170830
Great Hiroshima with Python 170830
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 Tutorial
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 
Package Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerPackage Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π Supercomputer
 
Intro django
Intro djangoIntro django
Intro django
 
First python project
First python projectFirst python project
First python project
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
Python Projects at Neova
Python Projects at NeovaPython Projects at Neova
Python Projects at Neova
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
Installing OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.xInstalling OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.x
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolution
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 

Último

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Último (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Django district pip, virtualenv, virtualenv wrapper & more

  • 1. Pip, Virtualenv, VirtualenvWrapper & More Django District Wednesday, Nov. 7, 2012 Jackie Kazil @jackiekazil
  • 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. Case study: Dependencies Once 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. Case study: Breaking sys python From stackoverflow... "Is there a way to ensure I can clean everything up and start from zero?" "If you remove everything in these 2 directories, it should clear out all modules...."
  • 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. Becoming the standard... Pep 405 Python 3.3 http://www.python.org/dev/peps/pep-0405 "... proposes to add to Python a mechanism for lightweight "virtual environments" with their own site directories, optionally isolated from system site directories...."
  • 7. What is... ● pip - replaces easy_install ● virtualenv - creates isolated python environments ● virtualenvwrapper - to be explained later
  • 8. Basic setup $ sudo easy_install pip $ sudo pip install virtualenv $ sudo pip install virtualenvwrapper Add to bash settings... source /usr/local/bin/virtualenvwrapper.sh export WORKON_HOME=$HOME/.virtualenvs
  • 9. Make environment $ mkvirtualenv foo You can add more to this... like setting python version. $ mkvirtualenv --python=python2.7
  • 10. What is virtualenvwrapper? Helps make things easier... workon foo vs source ~/.virtualenvs/foo/bin/activate
  • 11. Installing libraries pip install django pip install -r requirements.txt pip install -U django
  • 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. Wrappers ● mkvirtualenv (calls hooks) ● rmvirtualenv ● workon (calls hooks) ● add2virtualenv ● cdsitepackages ● cdvirtualenv ● deactivate (calls hooks)
  • 14. Hooks ● postmkvirtualenv ● prermvirtualenv ● postrmvirtualenv ● postactivate ● predeactivate ● postdeactivate
  • 15. Hook example: postactivate proj_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_MODULE fi
  • 17. Other helpful stuff pip freeze pip freeze > requirements.txt yolk -l python -c "import sys,pprint;pprint.pprint(sys. path)"
  • 18. More... virtualenv-burrito https://github.com/brainsik/virtualenv-burrito With one command.... BAM! (or maybe not) ... a virtualenv & virtualenvwrapper environment
  • 19. More... virtualenv-tools https://github.com/fireteam/virtualenv-tools "This repository contains scripts we're using at Fireteam for our deployment of Python code."
  • 20. More... Tox http://tox.testrun.org/latest/ Tox as is a generic virtualenv management and test command 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. More .... Keeping things fresh Autoenv https://github.com/kennethreitz/autoenv "Magic per-project shell environments. Very pretentious." Bundle Scout http://bundlescout.com/ "Daily emails keep you on top of the latest updates from your favorite libraries."
  • 22. More .... Keeping things fresh (cont) Pip Lint https://github.com/dcramer/piplint "Piplint validates your current environment with the requirements files you've specified." Pip Tools https://github.com/nvie/pip-tools "A set of two command line tools to help you keep your pip- based packages fresh, even when you've pinned them"
  • 23. The End Me: Jackie Kazil, @jackiekazil W/ contributions from... Chris Adams, @acdha & Members of Django-District :-) http://www.django-district.org/