zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/software delivery _...

62
July 2008 OSCON’08 / PORTLAND 1 zc.buildout OSCON’08 Tarek Ziadé <[email protected] >

Upload: vudan

Post on 07-Apr-2018

249 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

July 2008 OSCON’08 / PORTLAND 1

zc.buildout

OSCON’08

Tarek Ziadé <[email protected]>

Page 2: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

2

Who am I & what we doCTO at Ingeniweb (Paris)Ingeniweb - part of Alterway

Alterway - 100% open source company

Python, Zope and Plone

QA

Releasing & deployment processes

My work

Building tools and conventions for developers

Page 3: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

3

Books I wrote“Programmation Python” Editor: Eyrolles (Paris) - 2006 - French

“Petit guide à l’usage du développeur agile” Editeur Dunod (Paris) - 2007 - French

“Expert Python programming”Packt Publishing (UK) - Available in September 2008

Open Source stuff

Involved in Zope and PloneA few contributions in Python

Page 4: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

4

45 min is too short

Plone drinkup tonightLucky Lab in NW, 1945 NW Quimby

at 6 pm

Page 5: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

5

5 hours in 2006

Page 6: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

6

5 hours in 2006get zopeinstall zope

install python extra packages

get extra products

install extra products dependency

doesn’t workahhh right, install python-ldap

create an instance

checkout products in development

start to work

doesn’t work

ahhh right, wrong python-ldap version

read extra products doc

install extra products

Page 7: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

7

Page 8: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

8

5 minutes in 2008

Page 9: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

9

5 minutes in 2008get the “buildout”$ python bootstrap.py$ bin/buildoutstart to work

Page 10: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

10

Yes !!!

Page 11: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

11

Yepeee !!!

Page 12: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

12

hahaha !!!

Page 13: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

13

zc.buildout is a

a Coarse-Grained Python-Based Configuration-Driven Build Tool*

* definition stolen on Grok website

Page 14: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

14

PaverPOSAV (Plain Old Setuptools And Virtualenv)

Capistrano, Ant, etc., Maven

IDNTS (I Don’t Need That Stuff)

Page 15: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

15

Zope 3PloneGrok

All Zope based appsPylons based appsTwisted based appsBuildbot thinghies

Our customers

Community

...Herder (Creative Commons)

Every Python Project

Page 16: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

16

zc.buildout =

distutils + setuptools + PyPI + configuration file

Page 17: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

17

distutils =

builds and distributes a packageregisters and uploads it to PyPI

Page 18: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

18

get the screencast at

http://ziade.org/oscon/demo1.m4v

Page 19: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

19

setuptools =

simple dependencies management, namespaced package egg distribution

provides easy_install

Page 20: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

20

setuptools + distutils=

the future distutils

Page 21: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

21

egg=

binary or source distributionextended metadata

zip archive

Page 22: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

22

easy_install my_package=

will get and install “my_package”from “PyPI”

Page 23: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

23

PythonPackageIndex =

Python’s CPAN, driven with distutils

register and upload commands

Page 24: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

24

get the screencast at

http://ziade.org/oscon/demo2.m4v

Page 25: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

25

A zc.buildout primer

Page 26: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

26

Page 27: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

27

buildout.cfg : simple ini file (ConfigParser)

[buildout]

parts = one two

[one]recipe = my.recipe.onearg1 = value1

[two]recipe = my.recipe.twoarg1 = value1arg2 = value2

1

2

3

Page 28: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

28

buildout.cfg processed

1

2

3

process each part sequentially

looks for “my.recipe.one”gets itexecutes it

look for “my.recipe.two”gets it executes it

Page 29: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

29

demoinstalling zc.buildoutcreating a simple buildoutplaying with it

Page 30: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

30

get the screencast at

http://ziade.org/oscon/demo3.mov

Page 31: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

31

demo debriefbuildout.cfg describes the applicationrecipes = simple packageschange the .cfg -> re-run bin/buildoutzc.buildout grabs dependencies

Page 32: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

32

What we get

bin buildout scripts from recipes

eggs all dependencies

develop-eggs

parts data from recipes

Page 33: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

33

A recipe primer

Page 34: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

34

a class + an entry point = a recipea recipe = a simple package

Page 35: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

35

buildout developers love Paste ScriptPlone community provides ZopeSkel

Page 36: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

36

demo writing a recipe using a Paste templatesetting an entry pointpublishing it at PyPI

Page 37: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

37

get the screencast at

http://ziade.org/oscon/demo4.mov

Page 38: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

38

http://pypi.python.org/pypi?:action=browse&show=all&c=512

Trove classifier : Framework :: Buildout

Hundreds of recipes at PyPI

Page 39: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

39

great !!!

Page 40: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

40

Plone application lifecycle

Page 41: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

41

Plone buildouts are source based Warning

Get my Windows installer : python2.4.4-win32.zipGoogle “An installer for a buildout-ready Windows”

Windows developers

Page 42: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

42

Page 43: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

43

[buildout]

develop =path/to/my/package1path/to/another/package

cd path/to/my/package1python setup.py develop

buildout/develop-eggs

Page 44: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

44

Typical buildout layout uses the extends feature

dev.cfg (extends buildout.cfg)buildout.cfg

prod.cfg (extends buildout.cfg)+ bootstrap.py

Page 45: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

45

[buildout]extends = buildout.cfgparts = three

[buildout]parts = one two

buildout.cfg :

dev.cfg :

[buildout]parts = one two three

Page 46: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

46

democreating a fresh Plone 3 buildout (Paste)adding the dev.cfghooking a new development packageadding a prod.cfg

Page 47: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

47

get the screencast at

http://ziade.org/oscon/demo5.mov

Page 48: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

48

complex example: plone.orghttps://svn.plone.org/svn/plone/PloneOrg/buildouts/trunk/devel/

python-ldap

zopezeo

varnish

pound

http://tinyurl.com/plone-buildout

Page 49: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

49

Releasing the application

Page 50: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

50

Source distribution

[buildout]offline = true...

[buildout]download-cache = downloads...

Page 51: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

51

zc.buildout caveatsHard to do TDD for recipe codeisolated system = boundary with os is fuzzy

Page 52: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

52

collective.releaser scripts to automate buildout releases and update

Tools on the top of zc.buildout

collective.buildbot buildout recipe to create a buildbot

Page 53: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

5347

get the screencast at

http://ziade.org/oscon/demo6.mov

Page 54: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

54

amazing !!!

Page 55: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

55

alternative eggs locations

Page 56: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

56

PyPI == SPOF

Eggs are not on PyPI sometimes

Eggs need privacy sometimes

A “Company PyPI” is useful

Command line releasing is cool

Why ?

Page 57: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

57

Distributed model

Page 58: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

58

a simple directorya directory published with a web server

or...

PloneSoftwareCenter

How : the find-links option[buildout]

find-links =http://plone.org/productshttp://my-company/eggs

Page 59: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

59

PloneSoftwareCenter same APIs than PyPI distutils compliant powers the next plone.org can be used for any package

Page 60: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

60

That’s all folks !

Thanks, questions ?

Page 61: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

61

[email protected]

Diagrams made with OmniGraffle (it rocks)

http://tarekziade.wordpress.com

zc.buildout @ PyPI

collective.buildbot @ PyPI

collective.releaser @ PyPI

http://alterway.fr

Page 62: zc.buildout - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Software Delivery _ Continuous... · zc.buildout OSCON’08 Tarek ... Python, Zope and Plone QA ... ahhh right,

62

The Alter Way approach

Mission : bring a long-lasting and mature business model to Open Source

Significant contributions to Free Software

http://www.alterway.fr/

Federation of market leaders to foster the most complete solution to all IT needs for SME and institutions

The first european integrator 100% Open Source to be a real alternative to traditionnal players

Revenue in 2008 : 8 M€ (target in 2011 : 25 M€) Source in France