Reproducible installation of applications using zc.buildout Thomas - - PowerPoint PPT Presentation

reproducible installation of applications using zc
SMART_READER_LITE
LIVE PREVIEW

Reproducible installation of applications using zc.buildout Thomas - - PowerPoint PPT Presentation

Reproducible installation of applications using zc.buildout Thomas Lotze Europython 2012 tl@gocept.com July 5, Florence, Italy Outline Overview: Scope 1 Sketch: Simple example of a buildout 2 Close-up: How zc.buildout installs Python code


slide-1
SLIDE 1

Reproducible installation of applications using zc.buildout

Thomas Lotze

tl@gocept.com

Europython 2012

July 5, Florence, Italy

slide-2
SLIDE 2

Outline

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-3
SLIDE 3

Outline

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-4
SLIDE 4

Outline

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-5
SLIDE 5

Outline

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-6
SLIDE 6

Outline

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-7
SLIDE 7

Outline

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-8
SLIDE 8

Contents

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-9
SLIDE 9

About zc.buildout

Which problems shall the tool solve? Which problems shall we not concern ourselves with? history of zc.buildout terminology

slide-10
SLIDE 10

About zc.buildout

Which problems shall the tool solve? Which problems shall we not concern ourselves with? history of zc.buildout terminology

slide-11
SLIDE 11

About zc.buildout

Which problems shall the tool solve? Which problems shall we not concern ourselves with? history of zc.buildout terminology

slide-12
SLIDE 12

About zc.buildout

Which problems shall the tool solve? Which problems shall we not concern ourselves with? history of zc.buildout terminology

slide-13
SLIDE 13

Problems to solve

“install and configure software in a reproducible way” both Python packages and any other software simple case: develop a Python package complex case: deploy a multi-part application simple description that is as complete as possible

slide-14
SLIDE 14

Problems to solve

“install and configure software in a reproducible way” both Python packages and any other software simple case: develop a Python package complex case: deploy a multi-part application simple description that is as complete as possible

slide-15
SLIDE 15

Problems to solve

“install and configure software in a reproducible way” both Python packages and any other software simple case: develop a Python package complex case: deploy a multi-part application simple description that is as complete as possible

slide-16
SLIDE 16

Problems to solve

“install and configure software in a reproducible way” both Python packages and any other software simple case: develop a Python package complex case: deploy a multi-part application simple description that is as complete as possible

slide-17
SLIDE 17

Problems to solve

“install and configure software in a reproducible way” both Python packages and any other software simple case: develop a Python package complex case: deploy a multi-part application simple description that is as complete as possible

slide-18
SLIDE 18

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-19
SLIDE 19

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-20
SLIDE 20

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-21
SLIDE 21

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-22
SLIDE 22

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-23
SLIDE 23

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-24
SLIDE 24

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-25
SLIDE 25

Problems not to solve

low-level: don’t build software from source (such as C)

control existing specialised tools configure/make/make install distutils

high-level: don’t install into the host system

self-contained, isolated from other applications provide pieces to be integrated with operating system act as a building block for configuration management

slide-26
SLIDE 26

What is zc.buildout?

developed by Jim Fulton (Zope Corporation) in 2006 builds on lessons learned from two earlier attempts used for much more than Zope projects today

slide-27
SLIDE 27

What is zc.buildout?

developed by Jim Fulton (Zope Corporation) in 2006 builds on lessons learned from two earlier attempts used for much more than Zope projects today

slide-28
SLIDE 28

What is zc.buildout?

developed by Jim Fulton (Zope Corporation) in 2006 builds on lessons learned from two earlier attempts used for much more than Zope projects today

slide-29
SLIDE 29

Terminology: 3 meanings to “buildout”

the software, zc.buildout the specification of an application’s build and configuration the build, i.e. a directory populated by running zc.buildout

  • n a buildout configuration
slide-30
SLIDE 30

Terminology: 3 meanings to “buildout”

the software, zc.buildout the specification of an application’s build and configuration the build, i.e. a directory populated by running zc.buildout

  • n a buildout configuration
slide-31
SLIDE 31

Terminology: 3 meanings to “buildout”

the software, zc.buildout the specification of an application’s build and configuration the build, i.e. a directory populated by running zc.buildout

  • n a buildout configuration
slide-32
SLIDE 32

Contents

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-33
SLIDE 33

A first simple buildout

what’s needed how to run zc.buildout what happens in a buildout run repeating buildout runs

slide-34
SLIDE 34

A first simple buildout

what’s needed how to run zc.buildout what happens in a buildout run repeating buildout runs

slide-35
SLIDE 35

A first simple buildout

what’s needed how to run zc.buildout what happens in a buildout run repeating buildout runs

slide-36
SLIDE 36

A first simple buildout

what’s needed how to run zc.buildout what happens in a buildout run repeating buildout runs

slide-37
SLIDE 37

What’s needed?

assume zc.buildout is not installed download bootstrap.py

$ wget http://svn.zope.org/*checkout*/zc.buildout/\ trunk/bootstrap/bootstrap.py

create a buildout configuration file

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

slide-38
SLIDE 38

What’s needed?

assume zc.buildout is not installed download bootstrap.py

$ wget http://svn.zope.org/*checkout*/zc.buildout/\ trunk/bootstrap/bootstrap.py

create a buildout configuration file

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

slide-39
SLIDE 39

What’s needed?

assume zc.buildout is not installed download bootstrap.py

$ wget http://svn.zope.org/*checkout*/zc.buildout/\ trunk/bootstrap/bootstrap.py

create a buildout configuration file

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

slide-40
SLIDE 40

What’s needed?

assume zc.buildout is not installed download bootstrap.py

$ wget http://svn.zope.org/*checkout*/zc.buildout/\ trunk/bootstrap/bootstrap.py

create a buildout configuration file

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

slide-41
SLIDE 41

Getting started

$ python bootstrap.py -d Downloading http://pypi..../distribute-0.6.27.tar.gz ... Creating directory ’/home/thomas/py/bin’. Creating directory ’/home/thomas/py/parts’. Creating directory ’/home/thomas/py/eggs’. Creating directory ’/home/thomas/py/develop-eggs’. Generated script ’/home/thomas/py/bin/buildout’.

slide-42
SLIDE 42

After bootstrapping

$ ls * bootstrap.py buildout.cfg bin: buildout develop-eggs: eggs: distribute-0.6.27-py2.7.egg zc.buildout-1.5.2-py2.7.egg parts: buildout

slide-43
SLIDE 43

What’s next?

$ bin/buildout Getting distribution for ’zc.recipe.egg’. Got zc.recipe.egg 1.3.2. Installing sphinx. Getting distribution for ’sphinx’. Got Sphinx 1.1.3. Getting distribution for ’docutils>=0.7’. warning: ... Got docutils 0.9.1. Getting distribution for ’Jinja2>=2.3’. warning: ... Got Jinja2 2.6. Getting distribution for ’Pygments>=1.2’. Got Pygments 1.5. Generated script ’/home/thomas/py/bin/sphinx-apidoc’. Generated script ’/home/thomas/py/bin/sphinx-build’. Generated script ’/home/thomas/py/bin/sphinx-quickstart’. Generated script ’/home/thomas/py/bin/sphinx-autogen’.

slide-44
SLIDE 44

After the buildout run

$ ls * bootstrap.py buildout.cfg bin: buildout sphinx-apidoc sphinx-autogen sphinx-build sphinx-quickstart develop-eggs: eggs: distribute-0.6.27-py2.7.egg docutils-0.9.1-py2.7.egg Jinja2-2.6-py2.7.egg Pygments-1.5-py2.7.egg Sphinx-1.1.3-py2.7.egg zc.buildout-1.5.2-py2.7.egg zc.recipe.egg-1.3.2-py2.7.egg parts: buildout

slide-45
SLIDE 45

What happened?

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx buildout part “sphinx” is installed work is done by a recipe: plug-in point recipe comes as an egg

Getting distribution for ’zc.recipe.egg’. Got zc.recipe.egg 1.3.2. Installing sphinx.

slide-46
SLIDE 46

What happened?

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx buildout part “sphinx” is installed work is done by a recipe: plug-in point recipe comes as an egg

Getting distribution for ’zc.recipe.egg’. Got zc.recipe.egg 1.3.2. Installing sphinx.

slide-47
SLIDE 47

What happened?

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx buildout part “sphinx” is installed work is done by a recipe: plug-in point recipe comes as an egg

Getting distribution for ’zc.recipe.egg’. Got zc.recipe.egg 1.3.2. Installing sphinx.

slide-48
SLIDE 48

What happened?

1

[buildout]

2

parts = sphinx

3 4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx buildout part “sphinx” is installed work is done by a recipe: plug-in point recipe comes as an egg

Getting distribution for ’zc.recipe.egg’. Got zc.recipe.egg 1.3.2. Installing sphinx.

slide-49
SLIDE 49

What happened? The sphinx part

zc.recipe.egg invokes zc.buildout’s easy_install API download sphinx sources (as configured)

Getting distribution for ’sphinx’.

build the egg

Got Sphinx 1.1.3.

follow declared dependencies

Getting distribution for ’docutils>=0.5’. Got docutils 0.9.1. ...

detect and install scripts provided by explicitly listed eggs

Generated script ’/home/thomas/py/bin/sphinx-apidoc’. ...

slide-50
SLIDE 50

What happened? The sphinx part

zc.recipe.egg invokes zc.buildout’s easy_install API download sphinx sources (as configured)

Getting distribution for ’sphinx’.

build the egg

Got Sphinx 1.1.3.

follow declared dependencies

Getting distribution for ’docutils>=0.5’. Got docutils 0.9.1. ...

detect and install scripts provided by explicitly listed eggs

Generated script ’/home/thomas/py/bin/sphinx-apidoc’. ...

slide-51
SLIDE 51

What happened? The sphinx part

zc.recipe.egg invokes zc.buildout’s easy_install API download sphinx sources (as configured)

Getting distribution for ’sphinx’.

build the egg

Got Sphinx 1.1.3.

follow declared dependencies

Getting distribution for ’docutils>=0.5’. Got docutils 0.9.1. ...

detect and install scripts provided by explicitly listed eggs

Generated script ’/home/thomas/py/bin/sphinx-apidoc’. ...

slide-52
SLIDE 52

What happened? The sphinx part

zc.recipe.egg invokes zc.buildout’s easy_install API download sphinx sources (as configured)

Getting distribution for ’sphinx’.

build the egg

Got Sphinx 1.1.3.

follow declared dependencies

Getting distribution for ’docutils>=0.5’. Got docutils 0.9.1. ...

detect and install scripts provided by explicitly listed eggs

Generated script ’/home/thomas/py/bin/sphinx-apidoc’. ...

slide-53
SLIDE 53

What happened? The sphinx part

zc.recipe.egg invokes zc.buildout’s easy_install API download sphinx sources (as configured)

Getting distribution for ’sphinx’.

build the egg

Got Sphinx 1.1.3.

follow declared dependencies

Getting distribution for ’docutils>=0.5’. Got docutils 0.9.1. ...

detect and install scripts provided by explicitly listed eggs

Generated script ’/home/thomas/py/bin/sphinx-apidoc’. ...

slide-54
SLIDE 54

Repeating the buildout run

with configuration unchanged: $ bin/buildout Updating sphinx. already installed, not installed again unconditional update phase

looks for new releases by default

slide-55
SLIDE 55

Repeating the buildout run

with configuration unchanged: $ bin/buildout Updating sphinx. already installed, not installed again unconditional update phase

looks for new releases by default

slide-56
SLIDE 56

Repeating the buildout run

with configuration unchanged: $ bin/buildout Updating sphinx. already installed, not installed again unconditional update phase

looks for new releases by default

slide-57
SLIDE 57

Repeating the buildout run

modify configuration:

4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

7

scripts = sphinx-build sphinx-apidoc

$ bin/buildout Uninstalling sphinx. Installing sphinx. Generated script ’/home/thomas/py/sphinx-apidoc’. Generated script ’/home/thomas/py/sphinx-build’.

part with modified configuration is re-installed from scratch previously created files (e.g. scripts) are removed parts with unchanged configuration are updated

slide-58
SLIDE 58

Repeating the buildout run

modify configuration:

4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

7

scripts = sphinx-build sphinx-apidoc

$ bin/buildout Uninstalling sphinx. Installing sphinx. Generated script ’/home/thomas/py/sphinx-apidoc’. Generated script ’/home/thomas/py/sphinx-build’.

part with modified configuration is re-installed from scratch previously created files (e.g. scripts) are removed parts with unchanged configuration are updated

slide-59
SLIDE 59

Repeating the buildout run

modify configuration:

4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

7

scripts = sphinx-build sphinx-apidoc

$ bin/buildout Uninstalling sphinx. Installing sphinx. Generated script ’/home/thomas/py/sphinx-apidoc’. Generated script ’/home/thomas/py/sphinx-build’.

part with modified configuration is re-installed from scratch previously created files (e.g. scripts) are removed parts with unchanged configuration are updated

slide-60
SLIDE 60

Repeating the buildout run

modify configuration:

4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

7

scripts = sphinx-build sphinx-apidoc

$ bin/buildout Uninstalling sphinx. Installing sphinx. Generated script ’/home/thomas/py/sphinx-apidoc’. Generated script ’/home/thomas/py/sphinx-build’.

part with modified configuration is re-installed from scratch previously created files (e.g. scripts) are removed parts with unchanged configuration are updated

slide-61
SLIDE 61

Repeating the buildout run

modify configuration:

4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

7

scripts = sphinx-build sphinx-apidoc

$ bin/buildout Uninstalling sphinx. Installing sphinx. Generated script ’/home/thomas/py/sphinx-apidoc’. Generated script ’/home/thomas/py/sphinx-build’.

part with modified configuration is re-installed from scratch previously created files (e.g. scripts) are removed parts with unchanged configuration are updated

slide-62
SLIDE 62

Contents

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-63
SLIDE 63

How Python code is installed

scripts and their environment a Python interpreter compare to virtualenv + pip

slide-64
SLIDE 64

How Python code is installed

scripts and their environment a Python interpreter compare to virtualenv + pip

slide-65
SLIDE 65

How Python code is installed

scripts and their environment a Python interpreter compare to virtualenv + pip

slide-66
SLIDE 66

How egg installation works

$ cat bin/sphinx-quickstart

1

#!/usr/bin/python

2 3

import sys

4

sys.path[0:0] = [

5

’/home/thomas/py/eggs/Sphinx-1.1.3-py2.7.egg’,

6

’/home/thomas/py/eggs/docutils-0.9.1-py2.7.egg’,

7

’/home/thomas/py/eggs/Jinja2-2.6-py2.7.egg’,

8

’/home/thomas/py/eggs/Pygments-1.5-py2.7.egg’,

9

]

10 11

import sphinx.quickstart

12 13

if __name__ == ’__main__’:

14

sphinx.quickstart.main()

slide-67
SLIDE 67

How egg installation works

each script calls one of the egg’s entry points

13

if __name__ == ’__main__’:

14

sphinx.quickstart.main()

each script sets up its own Python path

4

sys.path[0:0] = [

5

’/home/thomas/py/eggs/Sphinx-1.1.3-py2.7.egg’,

6

...

use a Python installation without modifying it

slide-68
SLIDE 68

How egg installation works

each script calls one of the egg’s entry points

13

if __name__ == ’__main__’:

14

sphinx.quickstart.main()

each script sets up its own Python path

4

sys.path[0:0] = [

5

’/home/thomas/py/eggs/Sphinx-1.1.3-py2.7.egg’,

6

...

use a Python installation without modifying it

slide-69
SLIDE 69

How egg installation works

each script calls one of the egg’s entry points

13

if __name__ == ’__main__’:

14

sphinx.quickstart.main()

each script sets up its own Python path

4

sys.path[0:0] = [

5

’/home/thomas/py/eggs/Sphinx-1.1.3-py2.7.egg’,

6

...

use a Python installation without modifying it

slide-70
SLIDE 70

Using eggs with an interpreter

configure the eggs’ part to create an interpreter:

4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

7

interpreter = py the egg recipe creates an executable script:

$ bin/buildout ... Generated interpreter ’/home/thomas/py/bin/py’.

slide-71
SLIDE 71

Using eggs with an interpreter

configure the eggs’ part to create an interpreter:

4

[sphinx]

5

recipe = zc.recipe.egg

6

eggs = sphinx

7

interpreter = py the egg recipe creates an executable script:

$ bin/buildout ... Generated interpreter ’/home/thomas/py/bin/py’.

slide-72
SLIDE 72

Using eggs with an interpreter

1

#!/usr/bin/python

2 3

import sys

4

sys.path[0:0] = [

5

’/var/lib/python-eggs/Sphinx-1.1.3-py2.7.egg’,

6

’/var/lib/python-eggs/docutils-0.9.1-py2.7.egg’,

7

’/var/lib/python-eggs/Jinja2-2.6-py2.7.egg’,

8

’/var/lib/python-eggs/Pygments-1.5-py2.7.egg’,

9

]

10 11

...

12

exec _val

13

__import__("runpy").run_module(...)

14

execfile(...)

15

__import__("code").interact(...)

just another script that sets up its path invokes Python interpreter according to options

slide-73
SLIDE 73

Using eggs with an interpreter

1

#!/usr/bin/python

2 3

import sys

4

sys.path[0:0] = [

5

’/var/lib/python-eggs/Sphinx-1.1.3-py2.7.egg’,

6

’/var/lib/python-eggs/docutils-0.9.1-py2.7.egg’,

7

’/var/lib/python-eggs/Jinja2-2.6-py2.7.egg’,

8

’/var/lib/python-eggs/Pygments-1.5-py2.7.egg’,

9

]

10 11

...

12

exec _val

13

__import__("runpy").run_module(...)

14

execfile(...)

15

__import__("code").interact(...)

just another script that sets up its path invokes Python interpreter according to options

slide-74
SLIDE 74

Using eggs with an interpreter

1

#!/usr/bin/python

2 3

import sys

4

sys.path[0:0] = [

5

’/var/lib/python-eggs/Sphinx-1.1.3-py2.7.egg’,

6

’/var/lib/python-eggs/docutils-0.9.1-py2.7.egg’,

7

’/var/lib/python-eggs/Jinja2-2.6-py2.7.egg’,

8

’/var/lib/python-eggs/Pygments-1.5-py2.7.egg’,

9

]

10 11

...

12

exec _val

13

__import__("runpy").run_module(...)

14

execfile(...)

15

__import__("code").interact(...)

just another script that sets up its path invokes Python interpreter according to options

slide-75
SLIDE 75

Contrast: virtualenv + pip

creates a Python installation meant to be modified pip requirements file: minimal set of packages defines the Python path as a well-known directory Python path implicitly set up by using the local interpreter Python path may be exported: “activate” the environment

slide-76
SLIDE 76

Contrast: virtualenv + pip

creates a Python installation meant to be modified pip requirements file: minimal set of packages defines the Python path as a well-known directory Python path implicitly set up by using the local interpreter Python path may be exported: “activate” the environment

slide-77
SLIDE 77

Contrast: virtualenv + pip

creates a Python installation meant to be modified pip requirements file: minimal set of packages defines the Python path as a well-known directory Python path implicitly set up by using the local interpreter Python path may be exported: “activate” the environment

slide-78
SLIDE 78

Contrast: virtualenv + pip

creates a Python installation meant to be modified pip requirements file: minimal set of packages defines the Python path as a well-known directory Python path implicitly set up by using the local interpreter Python path may be exported: “activate” the environment

slide-79
SLIDE 79

Contrast: virtualenv + pip

creates a Python installation meant to be modified pip requirements file: minimal set of packages defines the Python path as a well-known directory Python path implicitly set up by using the local interpreter Python path may be exported: “activate” the environment

slide-80
SLIDE 80

Contents

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-81
SLIDE 81

Reproducibility

specifying what to install: pinning versions enforcing a complete specification known-good sets of software packages

slide-82
SLIDE 82

Reproducibility

specifying what to install: pinning versions enforcing a complete specification known-good sets of software packages

slide-83
SLIDE 83

Reproducibility

specifying what to install: pinning versions enforcing a complete specification known-good sets of software packages

slide-84
SLIDE 84

Which eggs are installed?

determined by buildout configuration and dependencies full paths baked into scripts: no random additions eggs are looked up at the package index eggs may also come from files or an on-line list of links

slide-85
SLIDE 85

Which eggs are installed?

determined by buildout configuration and dependencies full paths baked into scripts: no random additions eggs are looked up at the package index eggs may also come from files or an on-line list of links

slide-86
SLIDE 86

Which eggs are installed?

determined by buildout configuration and dependencies full paths baked into scripts: no random additions eggs are looked up at the package index eggs may also come from files or an on-line list of links

slide-87
SLIDE 87

Which eggs are installed?

determined by buildout configuration and dependencies full paths baked into scripts: no random additions eggs are looked up at the package index eggs may also come from files or an on-line list of links

slide-88
SLIDE 88

Which egg versions are installed?

declared dependencies on versions are always fulfilled newest matching versions are used search for newer versions may be suppressed versions still depend on first installation

slide-89
SLIDE 89

Which egg versions are installed?

declared dependencies on versions are always fulfilled newest matching versions are used search for newer versions may be suppressed versions still depend on first installation

slide-90
SLIDE 90

Which egg versions are installed?

declared dependencies on versions are always fulfilled newest matching versions are used search for newer versions may be suppressed versions still depend on first installation

slide-91
SLIDE 91

Which egg versions are installed?

declared dependencies on versions are always fulfilled newest matching versions are used search for newer versions may be suppressed versions still depend on first installation

slide-92
SLIDE 92

How to pin versions with buildout

global option:

1

[buildout]

2

versions = versions

3 4

[versions]

5

sphinx = 1.1.2 version pinnings are always honoured versions of other packages are still unpredictable

slide-93
SLIDE 93

How to pin versions with buildout

global option:

1

[buildout]

2

versions = versions

3 4

[versions]

5

sphinx = 1.1.2 version pinnings are always honoured versions of other packages are still unpredictable

slide-94
SLIDE 94

How to pin versions with buildout

global option:

1

[buildout]

2

versions = versions

3 4

[versions]

5

sphinx = 1.1.2 version pinnings are always honoured versions of other packages are still unpredictable

slide-95
SLIDE 95

Forcing all versions to be pinned

1

[buildout]

2

parts = sphinx

3

versions = versions

4

allow-picked-versions = false

5 6

[versions]

7

Jinja2 = 2.6

8

Pygments = 1.5

9

distribute = 0.6.27

10

docutils = 0.9.1

11

sphinx = 1.1.2

12

zc.buildout = 1.5.2

13

zc.recipe.egg = 1.3.2

14 15

[sphinx]

16

recipe = zc.recipe.egg

17

eggs = sphinx

slide-96
SLIDE 96

Forcing all versions to be pinned

recipes and even zc.buildout itself are pinned known-good build in addition to known-good code:

be sure that pieces of the build system match predictable configuration (e.g. paths, generated scripts)

still not pinned: Python itself

slide-97
SLIDE 97

Forcing all versions to be pinned

recipes and even zc.buildout itself are pinned known-good build in addition to known-good code:

be sure that pieces of the build system match predictable configuration (e.g. paths, generated scripts)

still not pinned: Python itself

slide-98
SLIDE 98

Forcing all versions to be pinned

recipes and even zc.buildout itself are pinned known-good build in addition to known-good code:

be sure that pieces of the build system match predictable configuration (e.g. paths, generated scripts)

still not pinned: Python itself

slide-99
SLIDE 99

Forcing all versions to be pinned

recipes and even zc.buildout itself are pinned known-good build in addition to known-good code:

be sure that pieces of the build system match predictable configuration (e.g. paths, generated scripts)

still not pinned: Python itself

slide-100
SLIDE 100

Forcing all versions to be pinned

recipes and even zc.buildout itself are pinned known-good build in addition to known-good code:

be sure that pieces of the build system match predictable configuration (e.g. paths, generated scripts)

still not pinned: Python itself

slide-101
SLIDE 101

Isolation and sharing

  • ne version of each egg per buildout (one versions section)

(possible future feature: egg versions per part) doesn’t modify the Python installation or the OS still, be careful about site-packages (e.g., OS packages) any number of buildouts may coexist egg files on disk may be shared among buildouts:

1

[buildout]

2

eggs-directory = /var/lib/python-eggs

slide-102
SLIDE 102

Isolation and sharing

  • ne version of each egg per buildout (one versions section)

(possible future feature: egg versions per part) doesn’t modify the Python installation or the OS still, be careful about site-packages (e.g., OS packages) any number of buildouts may coexist egg files on disk may be shared among buildouts:

1

[buildout]

2

eggs-directory = /var/lib/python-eggs

slide-103
SLIDE 103

Isolation and sharing

  • ne version of each egg per buildout (one versions section)

(possible future feature: egg versions per part) doesn’t modify the Python installation or the OS still, be careful about site-packages (e.g., OS packages) any number of buildouts may coexist egg files on disk may be shared among buildouts:

1

[buildout]

2

eggs-directory = /var/lib/python-eggs

slide-104
SLIDE 104

Isolation and sharing

  • ne version of each egg per buildout (one versions section)

(possible future feature: egg versions per part) doesn’t modify the Python installation or the OS still, be careful about site-packages (e.g., OS packages) any number of buildouts may coexist egg files on disk may be shared among buildouts:

1

[buildout]

2

eggs-directory = /var/lib/python-eggs

slide-105
SLIDE 105

Isolation and sharing

  • ne version of each egg per buildout (one versions section)

(possible future feature: egg versions per part) doesn’t modify the Python installation or the OS still, be careful about site-packages (e.g., OS packages) any number of buildouts may coexist egg files on disk may be shared among buildouts:

1

[buildout]

2

eggs-directory = /var/lib/python-eggs

slide-106
SLIDE 106

Isolation and sharing

  • ne version of each egg per buildout (one versions section)

(possible future feature: egg versions per part) doesn’t modify the Python installation or the OS still, be careful about site-packages (e.g., OS packages) any number of buildouts may coexist egg files on disk may be shared among buildouts:

1

[buildout]

2

eggs-directory = /var/lib/python-eggs

slide-107
SLIDE 107

Maintaining version pinnings

add a version pinning for each new package update versions consciously at a convenient time pinnings describe known good sets (KGS) of eggs maintain KGS of related packages in a central place

slide-108
SLIDE 108

Maintaining version pinnings

add a version pinning for each new package update versions consciously at a convenient time pinnings describe known good sets (KGS) of eggs maintain KGS of related packages in a central place

slide-109
SLIDE 109

Maintaining version pinnings

add a version pinning for each new package update versions consciously at a convenient time pinnings describe known good sets (KGS) of eggs maintain KGS of related packages in a central place

slide-110
SLIDE 110

Maintaining version pinnings

add a version pinning for each new package update versions consciously at a convenient time pinnings describe known good sets (KGS) of eggs maintain KGS of related packages in a central place

slide-111
SLIDE 111

Overriding version pinnings

buildout configurations may extend each other use externally maintained KGS:

1

[buildout]

2

extends = http://example.com/versions.cfg

3

parts = sphinx

4

allow-picked-versions = false

5 6

[versions]

7

sphinx = 1.1.2 contents of versions.cfg:

1

[buildout]

2

versions = versions

3 4

[versions]

5

Jinja2 = ...

slide-112
SLIDE 112

Overriding version pinnings

buildout configurations may extend each other use externally maintained KGS:

1

[buildout]

2

extends = http://example.com/versions.cfg

3

parts = sphinx

4

allow-picked-versions = false

5 6

[versions]

7

sphinx = 1.1.2 contents of versions.cfg:

1

[buildout]

2

versions = versions

3 4

[versions]

5

Jinja2 = ...

slide-113
SLIDE 113

Overriding version pinnings

buildout configurations may extend each other use externally maintained KGS:

1

[buildout]

2

extends = http://example.com/versions.cfg

3

parts = sphinx

4

allow-picked-versions = false

5 6

[versions]

7

sphinx = 1.1.2 contents of versions.cfg:

1

[buildout]

2

versions = versions

3 4

[versions]

5

Jinja2 = ...

slide-114
SLIDE 114

Contents

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-115
SLIDE 115

How to install non-Python software

1

[buildout]

2

parts = frontend

3 4

[nginx]

5

recipe = zc.recipe.cmmi

6

url = http://nginx.org/download/nginx-1.2.2.tar.gz

7 8

[frontend]

9

recipe = gocept.nginx

10

nginx = nginx

11

configuration =

12

worker_processes 1;

13

events {

14

worker_connections 1024;

15

...

slide-116
SLIDE 116

How to install non-Python software

recipe for doing configure/make/make install

$ ls parts/nginx conf html logs sbin

custom recipes for specialised tasks

$ cat parts/frontend/frontend.conf pid /home/thomas/py/parts/frontend/frontend.pid; ... worker_processes 1; events { worker_connections 1024; ... $ cat bin/frontend #!/bin/sh ARGV="$@" NGINX=’/home/thomas/py/parts/nginx/sbin/nginx’ PIDFILE=’/home/thomas/py/parts/frontend/frontend.pid’ ...

slide-117
SLIDE 117

How to install non-Python software

recipe for doing configure/make/make install

$ ls parts/nginx conf html logs sbin

custom recipes for specialised tasks

$ cat parts/frontend/frontend.conf pid /home/thomas/py/parts/frontend/frontend.pid; ... worker_processes 1; events { worker_connections 1024; ... $ cat bin/frontend #!/bin/sh ARGV="$@" NGINX=’/home/thomas/py/parts/nginx/sbin/nginx’ PIDFILE=’/home/thomas/py/parts/frontend/frontend.pid’ ...

slide-118
SLIDE 118

How to install non-Python software

recipe for doing configure/make/make install

$ ls parts/nginx conf html logs sbin

custom recipes for specialised tasks

$ cat parts/frontend/frontend.conf pid /home/thomas/py/parts/frontend/frontend.pid; ... worker_processes 1; events { worker_connections 1024; ... $ cat bin/frontend #!/bin/sh ARGV="$@" NGINX=’/home/thomas/py/parts/nginx/sbin/nginx’ PIDFILE=’/home/thomas/py/parts/frontend/frontend.pid’ ...

slide-119
SLIDE 119

Interaction between configuration sections

dependencies between configuration sections dependent part can reuse information from others depended-upon parts will be handled first in each phase also possible: referring to part options in config file

slide-120
SLIDE 120

Interaction between configuration sections

dependencies between configuration sections dependent part can reuse information from others depended-upon parts will be handled first in each phase also possible: referring to part options in config file

slide-121
SLIDE 121

Interaction between configuration sections

dependencies between configuration sections dependent part can reuse information from others depended-upon parts will be handled first in each phase also possible: referring to part options in config file

slide-122
SLIDE 122

Interaction between configuration sections

dependencies between configuration sections dependent part can reuse information from others depended-upon parts will be handled first in each phase also possible: referring to part options in config file

slide-123
SLIDE 123

Using buildout for large systems

[database] recipe = zc.recipe.filestorage blob-dir = ${buildout:directory}/parts/database/blobs [zeo] recipe = zc.zodbrecipes:server address = 8100 pack-keep-old = true zeo.conf = <zeo> address ${zeo:address} </zeo> <filestorage 1> blob-dir ${database:blob-dir} ... [app-server] recipe = zc.zope3recipes:instance zodb-client-cache-size = 200MB zodb-object-cache-size = 20MB blob-dir = ${database:blob-dir}

slide-124
SLIDE 124

Other commonly used recipes

file templates, directories deployment development tools: test runner, omelette more specific software: django, sphinx, supervisor, ...

slide-125
SLIDE 125

Other commonly used recipes

file templates, directories deployment development tools: test runner, omelette more specific software: django, sphinx, supervisor, ...

slide-126
SLIDE 126

Other commonly used recipes

file templates, directories deployment development tools: test runner, omelette more specific software: django, sphinx, supervisor, ...

slide-127
SLIDE 127

Other commonly used recipes

file templates, directories deployment development tools: test runner, omelette more specific software: django, sphinx, supervisor, ...

slide-128
SLIDE 128

Contents

1

Overview: Scope

2

Sketch: Simple example of a buildout

3

Close-up: How zc.buildout installs Python code

4

Our perspective: Reproducible builds

5

Bigger picture: More complex applications

6

Summary and Outlook: zc.buildout’s future

slide-129
SLIDE 129

Closing remarks

summary, zc.buildout’s strengths issues with zc.buildout roadmap for further development

slide-130
SLIDE 130

Closing remarks

summary, zc.buildout’s strengths issues with zc.buildout roadmap for further development

slide-131
SLIDE 131

Closing remarks

summary, zc.buildout’s strengths issues with zc.buildout roadmap for further development

slide-132
SLIDE 132

Summary: zc.buildout’s strengths

very well suited for installing Python code (dependencies, scripts) extensible by recipes to cover complex applications works from a complete plain-text specification able to pin versions including those of the build system isolation of the build from uncontrolled environment

slide-133
SLIDE 133

Summary: zc.buildout’s strengths

very well suited for installing Python code (dependencies, scripts) extensible by recipes to cover complex applications works from a complete plain-text specification able to pin versions including those of the build system isolation of the build from uncontrolled environment

slide-134
SLIDE 134

Summary: zc.buildout’s strengths

very well suited for installing Python code (dependencies, scripts) extensible by recipes to cover complex applications works from a complete plain-text specification able to pin versions including those of the build system isolation of the build from uncontrolled environment

slide-135
SLIDE 135

Summary: zc.buildout’s strengths

very well suited for installing Python code (dependencies, scripts) extensible by recipes to cover complex applications works from a complete plain-text specification able to pin versions including those of the build system isolation of the build from uncontrolled environment

slide-136
SLIDE 136

Summary: zc.buildout’s strengths

very well suited for installing Python code (dependencies, scripts) extensible by recipes to cover complex applications works from a complete plain-text specification able to pin versions including those of the build system isolation of the build from uncontrolled environment

slide-137
SLIDE 137

Issues

Python path is not readily inspectable no way to recognise a failed buildout by its state simple domain model that leaves all details up to recipes combination of configuration by non-programming language plus recipes feels unwieldy no concept of convergence: parts installed depending on configuration, not state

slide-138
SLIDE 138

Issues

Python path is not readily inspectable no way to recognise a failed buildout by its state simple domain model that leaves all details up to recipes combination of configuration by non-programming language plus recipes feels unwieldy no concept of convergence: parts installed depending on configuration, not state

slide-139
SLIDE 139

Issues

Python path is not readily inspectable no way to recognise a failed buildout by its state simple domain model that leaves all details up to recipes combination of configuration by non-programming language plus recipes feels unwieldy no concept of convergence: parts installed depending on configuration, not state

slide-140
SLIDE 140

Issues

Python path is not readily inspectable no way to recognise a failed buildout by its state simple domain model that leaves all details up to recipes combination of configuration by non-programming language plus recipes feels unwieldy no concept of convergence: parts installed depending on configuration, not state

slide-141
SLIDE 141

Issues

Python path is not readily inspectable no way to recognise a failed buildout by its state simple domain model that leaves all details up to recipes combination of configuration by non-programming language plus recipes feels unwieldy no concept of convergence: parts installed depending on configuration, not state

slide-142
SLIDE 142

Roadmap

egg support

currently by reusing easy_install from distribute switch to distutils2/packaging when it’s “stable enough”

Python 3 support

attempt at porting with 2to3: zc.buildout 2.0.0 alpha2 current plans: start over using a single code base

features, efficiency, refactoring

slide-143
SLIDE 143

Roadmap

egg support

currently by reusing easy_install from distribute switch to distutils2/packaging when it’s “stable enough”

Python 3 support

attempt at porting with 2to3: zc.buildout 2.0.0 alpha2 current plans: start over using a single code base

features, efficiency, refactoring

slide-144
SLIDE 144

Roadmap

egg support

currently by reusing easy_install from distribute switch to distutils2/packaging when it’s “stable enough”

Python 3 support

attempt at porting with 2to3: zc.buildout 2.0.0 alpha2 current plans: start over using a single code base

features, efficiency, refactoring

slide-145
SLIDE 145

Roadmap

egg support

currently by reusing easy_install from distribute switch to distutils2/packaging when it’s “stable enough”

Python 3 support

attempt at porting with 2to3: zc.buildout 2.0.0 alpha2 current plans: start over using a single code base

features, efficiency, refactoring

slide-146
SLIDE 146

Roadmap

egg support

currently by reusing easy_install from distribute switch to distutils2/packaging when it’s “stable enough”

Python 3 support

attempt at porting with 2to3: zc.buildout 2.0.0 alpha2 current plans: start over using a single code base

features, efficiency, refactoring

slide-147
SLIDE 147

Roadmap

egg support

currently by reusing easy_install from distribute switch to distutils2/packaging when it’s “stable enough”

Python 3 support

attempt at porting with 2to3: zc.buildout 2.0.0 alpha2 current plans: start over using a single code base

features, efficiency, refactoring

slide-148
SLIDE 148

Roadmap

egg support

currently by reusing easy_install from distribute switch to distutils2/packaging when it’s “stable enough”

Python 3 support

attempt at porting with 2to3: zc.buildout 2.0.0 alpha2 current plans: start over using a single code base

features, efficiency, refactoring

slide-149
SLIDE 149

Where to work with zc.buildout

Of course, with us! gocept is looking for developers. http://gocept.com

slide-150
SLIDE 150

Thank you.