distribute und pip als Ersatz für setuptools und easy_install bieten im Zusammenspiel mit virtualenv viele neue Möglichkeiten bei der Entwicklung und dem Deployment von Python-Applikationen. In diesem Vortrag stelle ich alle Werkzeuge kurz vor und zeige, wie man sie zusammen einsetzen kann.
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Arbeiten mit distribute, pip und virtualenv
1. Arbeiten mit distribute,
pip und virtualenv
Markus Zapke-Gründemann
11. DZUG-Tagung zu Zope, Plone und Python
2. Markus
Zapke-Gründemann
• Softwareentwickler seit 2001
• Schwerpunkt: Web Application Development
mit Python und PHP
• Django, symfony & Zend Framework
• Freier Softwareentwickler und Berater
seit 2008
• www.keimlink.de
3. Überblick
• Vorstellung der Werkzeuge • Einsatz in der Praxis
• distribute • modern-package-
template
• distutils2
• virtualenv
• pip
• virtualenvwrapper
• virtualenv
• pip
• virtualenvwrapper
7. distribute
• Fork des setuptools Pakets
• Erweitert distutils
• Stellt setuptools für Pakete zur Verfügung,
die davon abhängen
• Python 3 Unterstützung
• Maintainer: Tarek Ziadé
8. distribute installieren
$ wget http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
1. Entfernen der bestehenden setuptools Installation
2. Installieren einer Fake setuptools Installation
3. Installation von distribute
9. distutils2
• Tarek Ziadé: „A toolbox for third packaging
tools“
• PEP 345: Metadata for Python Software
Packages 1.2
• PEP 376: Database of Installed Python
Distributions
• PEP 386: Changing the version comparison
module in Distutils
10. pip
• „pip installs packages“ • Protokollieren der Aktionen
• Ersatz für easy_install • Kann einen URL oder ein
VCS als Quelle benutzen
• Kann Pakete wieder
deinstallieren • „requirements“
• Nur vollständige • Unterstüzung für
Installationen werden virtualenv
durchgeführt
• Autor: Ian Bicking
• „Sinnvolle“ Ausgaben
$ easy_install pip
11. Design done by Idan Gazit (http://pixane.com) - License: cc-by-3.0
12. virtualenv
• Isolierte Python Umgebungen
• Unterstützung für distribute
• Kann mit WSGI Containern benutzt werden
• Autor: Ian Bicking
$ pip install virtualenv
13. virtualenv: Isolierte
Python Umgebungen
• Python Version wählbar (zum Teil als Symlink)
• Eigenes bin Verzeichnis
• Eigenes site-packages Verzeichnis
19. modern-package-template
$ paster create -t modern_package testpackage
Selected and implied templates:
modern-package-template#modern_package Package with distribute and buildout support
Variables:
egg: testpackage
package: testpackage
project: testpackage
Enter version (Version (like 0.1)) ['0.1']:
Enter description (One-line description of the package) ['']: A test package.
Enter keywords (Space-separated keywords/tags) ['']: test package
Enter author (Author name) ['']: Markus Zapke-Gründemann
Enter author_email (Author email) ['']: info@keimlink.de
Enter url (URL of homepage) ['']: http://www.keimlink.de/
Enter license_name (License name) ['']: BSD
Creating template modern_package
Creating directory ./testpackage
Copying HACKING.txt to ./testpackage/HACKING.txt
Copying MANIFEST.in to ./testpackage/MANIFEST.in
Copying NEWS.txt to ./testpackage/NEWS.txt
Copying README.rst to ./testpackage/README.rst
Copying bootstrap.py to ./testpackage/bootstrap.py
Copying buildout.cfg_tmpl to ./testpackage/buildout.cfg
Copying setup.py_tmpl to ./testpackage/setup.py
Running /usr/bin/python setup.py egg_info
33. rmvirtualenv
(testenv)zappi ~$ rmvirtualenv testenv
ERROR: You cannot remove the active environment ('testenv').
Either switch to another environment, or run 'deactivate'.
(testenv)zappi ~$ deactivate
zappi ~$ rmvirtualenv testenv
38. pip install
$ cat requirements.txt
Django==1.1.2
nose==0.11
-e svn+http://mycompany/svn/MyApp/trunk@1045#egg=MyApp
-e svn+http://mycompany/svn/MyLibrary/trunk@1058#egg=MyLibrary
$ pip install -r requirements.txt
Downloading/unpacking nose==0.11 (from -r requirements.txt (line 2))
Downloading nose-0.11.0.tar.gz (249Kb): 249Kb downloaded
Running setup.py egg_info for package nose
no previously-included directories found matching 'doc/.build'
Downloading/unpacking Django==1.1.2 (from -r requirements.txt (line 1))
Downloading Django-1.1.2.tar.gz (5.7Mb): 5.7Mb downloaded
Running setup.py egg_info for package Django
Installing collected packages: Django, nose
Running setup.py install for Django
changing mode of build/scripts-2.6/django-admin.py from 644 to 755
changing mode of /Users/zappi/.virtualenvs/devenv/bin/django-admin.py to 755
Running setup.py install for nose
no previously-included directories found matching 'doc/.build'
Installing nosetests-2.6 script to /Users/zappi/.virtualenvs/devenv/bin
Installing nosetests script to /Users/zappi/.virtualenvs/devenv/bin
Successfully installed Django nose
Cleaning up...
39. pip install
$ pip install -E ~/.virtualenvs/devenv -r requirements.txt
Downloading/unpacking nose==0.11 (from -r requirements.txt (line 2))
Downloading nose-0.11.0.tar.gz (249Kb): 249Kb downloaded
Running setup.py egg_info for package nose
no previously-included directories found matching 'doc/.build'
Downloading/unpacking Django==1.1.2 (from -r requirements.txt (line 1))
Downloading Django-1.1.2.tar.gz (5.7Mb): 5.7Mb downloaded
Running setup.py egg_info for package Django
Installing collected packages: Django, nose
Found existing installation: Django 1.1.1
Not uninstalling Django at /Library/Python/2.6/site-packages, outside environment /
Users/zappi/.virtualenvs/devenv/bin/..
Running setup.py install for Django
changing mode of build/scripts-2.6/django-admin.py from 644 to 755
changing mode of /Users/zappi/.virtualenvs/devenv/bin/django-admin.py to 755
Found existing installation: nose 0.11.1
Not uninstalling nose at /Library/Python/2.6/site-packages, outside environment /
Users/zappi/.virtualenvs/devenv/bin/..
Running setup.py install for nose
no previously-included directories found matching 'doc/.build'
Installing nosetests-2.6 script to /Users/zappi/.virtualenvs/devenv/bin
Installing nosetests script to /Users/zappi/.virtualenvs/devenv/bin
Successfully installed Django nose
Cleaning up...
40. pip install
$ pip install anyjson boo
Downloading/unpacking anyjson
Downloading anyjson-0.2.4.tar.gz
Running setup.py egg_info for package anyjson
Downloading/unpacking boo
Could not find any downloads that satisfy the requirement boo
No distributions at all found for boo
Storing complete log in /Users/zappi/.pip/pip.log
44. pip search
$ pip search markdown
Markdoc - A lightweight Markdown-based wiki build tool.
markdown2 - markdown2: A fast and complete Python implementaion of
Markdown.
Argot - argot text markup -- a markdown dialect
Flask-Markdown - Small extension to make using markdown easy
Markdown - Python implementation of Markdown.
INSTALLED: 2.0.3 (latest)
django-markdown2 - This is a simple app, which supplies a single template tag
for markdown markup.
tiddlywebplugins.markdown - Markdown rendering for TiddlyWeb
discount - A Python interface for Discount, the C Markdown parser
tiddlywebplugins.simplewiki - A simple markdown based wiki in TiddlyWeb
django-markdown-deux - a Django app that provides template tags for using Markdown
(using the python-markdown2 processor)
pymarkdown_minisite - Parse a list of markdown files to a website with index.
html2text - Turn HTML into equivalent Markdown-structured text.
markdown2latex - Extension
django-autolinks - App for storing links and automatic link extraction from
markdown texts.
collective.transform.multimarkdown - MultiMarkdown text transform for Plone
47. Lizenz
Dieses Werk ist unter einem Creative Commons
Namensnennung-Weitergabe unter gleichen Bedingungen 3.0
Unported Lizenzvertrag lizenziert.
Um die Lizenz anzusehen, gehen Sie bitte zu
http://creativecommons.org/licenses/by-sa/3.0/ oder schicken
Sie einen Brief an Creative Commons, 171 Second Street,
Suite 300, San Francisco, California 94105, USA.