Slide 1

Slide 1 text

ห౰(BENTO) A Python solution for packaging Tuesday, 3 July 12

Slide 2

Slide 2 text

WHO AM I ? Tuesday, 3 July 12

Slide 3

Slide 3 text

NUMPY/SCIPY DEVELOPER Tuesday, 3 July 12

Slide 4

Slide 4 text

IN PARTICULAR: PACKAGING Tuesday, 3 July 12

Slide 5

Slide 5 text

NUMPY USES DISTUTILS Tuesday, 3 July 12

Slide 6

Slide 6 text

WHY WE DON’T LIKE IT • Hard to customize • Extensions based on monkey- patching • pip, setuptools, etc... a nightmare to manage Tuesday, 3 July 12

Slide 7

Slide 7 text

BENTO # bento.info file Name: foo Version: 0.1 Description: Package description. Library: Packages: foo, foo.core Tuesday, 3 July 12

Slide 8

Slide 8 text

BENTOMAKER $ bentomaker configure $ bentomaker build $ bentomaker install # Or more simply (automatically # runs configure and build) $ bentomaker install Tuesday, 3 July 12

Slide 9

Slide 9 text

FROM DISTUTILS TO BENTO # convert setup.py to bento.info $ bentomaker convert Tuesday, 3 July 12

Slide 10

Slide 10 text

PIP SUPPORT # setup.py from bento.distutils import setup setup() Tuesday, 3 July 12

Slide 11

Slide 11 text

ADDING NEW COMMAND $ bentomaker hello hello # bscript file from bento.commands import hooks @hooks.command def hello(context): print "Hello" # bento.info file HookFile: bscript Tuesday, 3 July 12

Slide 12

Slide 12 text

ADDING DATA-FILES Datafiles: pdf_documentation TargetDir: $pdfdir Files: main.pdf $ bentomaker configure --pdfdir=/usr/pdfdoc # ant-like glob format supported Datafiles: pdf_documentation TargetDir: $pdfdoc Files: doc/**/*.pdf Tuesday, 3 July 12

Slide 13

Slide 13 text

ADVANCED USAGE Tuesday, 3 July 12

Slide 14

Slide 14 text

HOOKS FILES (2) from bento.commands import hooks @hooks.command def hello(context): print "hello nice world" @hooks.command def goodbye(context): print "goodbye cruel world !" @hooks.startup def startup(context): context.set_before("goodbye", "hello") Dependencies defined outside classes for lower coupling between commands Tuesday, 3 July 12

Slide 15

Slide 15 text

PACKAGE METADATA (1) # bento.info content Version: 0.2 Author: John Doe MetaTemplateFile: foo/__info.py.in # foo/__info.py.in template content version = $VERSION author = $AUTHOR Allow for a package to know its own metadata: Tuesday, 3 July 12

Slide 16

Slide 16 text

PACKAGE METADATA (2) New metadata can be defined in the hook file: # foo/__info.py.in template content version = $VERSION git_revision = $GIT_REVISION author = $AUTHOR @hooks.pre_build def pre_build(context): context.register_metadata("git_revision", compute_git_revision()) Tuesday, 3 July 12

Slide 17

Slide 17 text

OUT-OF-TREE BUILDS source_tree$ ls bento.info foo/__init__.py ... build_tree$ bentomaker \ --bento-info=.../bento.info Tuesday, 3 July 12

Slide 18

Slide 18 text

NUMPY AND BENTO • Build scripts 50 % smaller • parallel and reliable partial build support Tuesday, 3 July 12

Slide 19

Slide 19 text

WHERE TO GET IT • On github: http://github.com/cournape/Bento.git • Documentation: http://cournape.github.com/Bento • Mailing List: [email protected] Tuesday, 3 July 12