Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bento presentation for CAMPUG

Bento presentation for CAMPUG

A quick presentation I made at CAMPUG to highlight a few points around my python packaging solution, bento.

cournape

July 27, 2012
Tweet

More Decks by cournape

Other Decks in Programming

Transcript

  1. 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
  2. BENTO # bento.info file Name: foo Version: 0.1 Description: Package

    description. Library: Packages: foo, foo.core Tuesday, 3 July 12
  3. BENTOMAKER $ bentomaker configure $ bentomaker build $ bentomaker install

    # Or more simply (automatically # runs configure and build) $ bentomaker install Tuesday, 3 July 12
  4. FROM DISTUTILS TO BENTO # convert setup.py to bento.info $

    bentomaker convert Tuesday, 3 July 12
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. NUMPY AND BENTO • Build scripts 50 % smaller •

    parallel and reliable partial build support Tuesday, 3 July 12
  11. 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