Sessions at PyCon US 2012 with slides and video in D5

Your current filters are…


Friday 9th March 2012

  • Speedily Practical Large-Scale Tests

    by Erik Rose

    Mozilla's projects have thousands of tests, so we've had to venture beyond vanilla test runners to keep things manageable. Our secret sauce can be used with your project as well. Reach beyond the test facilities that came with your project, harnessing pluggable test frameworks, dynamically reordering tests for speed, exploring various mocking libraries, and profiling your way to testing nirvana.

    A partial outline:

    Motivation: a test not run is no test at all.
    For most web apps, the easiest test speed win is a conquest of I/O.
    The nose testrunner
    Test discovery lets you organize tests well.
    Gluing to projects with custom testrunners: django-nose and test-utils
    Compare to nose. Nose forked from it. Explain history.
    Very cool assertion re-evaluation
    Plugin compatibility between py.test and nose
    Start here. Premature optimization sucks.
    time on the commandline to divide CPU from I/O
    Killing I/O for speedy justice: case study of support.mozilla.com
    Fixture speed hacks (a 5x improvement!)
    Once-per-class setup
    How to use DB transactions to avoid repetitive I/O
    Dynamic test reordering and fixture sharing
    DB reuse and other startup optimizations
    37,583 queries to 4,116. Watch them fly by!
    What to do instead of fixtures: the model-maker pattern
    Lexical proximity
    Lower coupling
    Using mocking to kill the fixtures altogether
    mock, the canonical lib
    fudge, new declarative hotness
    Syntax, capabilities
    Example: oedipus, a better API for the Sphinx search engine. I used fudge to unit-test oedipus without requiring devs to set up and populate Sphinx.
    Dangers of mocking
    Don't mock out your caching unless your invalidation is perfect.
    Some of our mistakes in oedipus
    The nose-progressive display engine
    Test results that are a pain to read don't get read.
    Progress indication
    Elision of junk frames
    Easier round-tripping from test failure to source code
    Continuous integration
    IRC bots
    Next steps: what to do once you're CPU-bound
    More parallelization.
    Multithreading really buys you no speed bump for CPU-bound (or I/O bound?) tasks in Python due to the GIL. (Ref: PyCodeConf talk by David Beazley.)
    State of multiprocess plugins in various testrunners.
    Mozilla's Jenkins test farm
    QA's big stacks of Mac Minis
    What global warming? ;-)

    At 12:10pm to 12:55pm, Friday 9th March

    In D5, Santa Clara Convention Center

Saturday 10th March 2012

  • Militarizing Your Backyard with Python: Computer Vision and the Squirrel Hordes

    by Kurt Grandis

    Has your garden been ravaged by the marauding squirrel hordes? Has your bird feeder been pillaged? Tired of shaking your fist at the neighbor children? Learn how to use Python to tap into computer vision libraries and build an automated sentry water cannon capable of soaking intruders.

    Using the Python bindings for the computer vision library, OpenCV, we will investigate the components and steps needed to power a sentry gun. In addition to basic object and motion tracking, concepts of object recognition (friend or foe) will be discussed. Communication and control of the underlying hardware is performed using Python and will also be covered.

    Additional peace-time applications of the above technology will be demonstrated.

    • OpenCV
    • Object detection
    • Motion tracking
    • Friend-or-foe object recognition
    • Stereo vision
    • Building training sets with Amazon Mechanical Turk
    • Python-Arduino communication
    • Python + Kinect

    At 2:15pm to 2:55pm, Saturday 10th March

    In D5, Santa Clara Convention Center

Sunday 11th March 2012

  • Sketching a Better Product

    by Idan Gazit

    If writing is a means for organizing your thoughts, then sketching is a means for organizing your thoughts visually. Just as good writing requires drafts, good design requires sketches: low-investment, low-resolution braindumps. Learn how to use ugly sketching to iterate your way to a better product.

    Building a better mousetrap is rarely accomplished in one zenlike moment of clarity—like all creative processes, it is iterative. Sketches are those iterations for things we can see and interact with. They are the key tool used to explore ideas and decide if they have merit; they are just as important in deciding what not to pursue.

    A good sketch is crude and fast. It isn’t necessarily pretty, and more often than not, it consists of just boxes and lines, rarely with color. It doesn’t matter what tools you use, so long as you can do it fast and get your ideas out where everybody can see them. It doesn’t matter if you can’t draw, because everybody can draw boxes and lines.

    This talk will cover sketching as a tool in the interface design process, including both the why and the how of sketches. It will include practical techniques for sucking less at making the kind of sketches that are useful for decision making, as well as tips on simple sketching methods to make it feel like an interface.

    At 12:00pm to 12:30pm, Sunday 11th March

    In D5, Santa Clara Convention Center

  • Deep Freeze: building better stand-alone apps with Python

    by Ryan Kelly

    There's more to shipping a stand-alone python app than just running py2exe over your code. Want to deploy automatic updates? Want to be sure it runs on legacy platforms? Want to add professional touches like code signing? And want to do this all in a cross-platform manner? This talk will show you the tools you can use to make your frozen apps better in a variety of small yet important ways.


    Python has a powerful and mature suite tools of tools for "freezing" your python scripts into a stand-alone application, including py2exe, py2app, cxfreeze, bbfeezee and PyInstaller. But there's more to shipping a stand-alone app than just running py2exe over your code.

    This talk will show you the tools you can use to make your frozen apps better in a variety of small yet important ways.

    Want to deploy automatic updates? The "esky" package provides a simple API for building, publishing and installing updates, and jumps through all the hoops needed to ensure failed updates won't leave your program unusable.

    Need to run on older versions of OSX or ancient linux boxes? The "myppy" package can build a python runtime optimized for portable deployment and binary compatibility with older systems.

    Want to add code-signing for that professional touch? The "signedimp" package provides cross-platform hooks for code signing and extends the protection to code loaded at runtime.

    Each of these tools has been extracted from a real-life build process for a complex cross-platform application, and each is designed to help make your frozen applications just that little bit better.

    At 1:30pm to 2:10pm, Sunday 11th March

    In D5, Santa Clara Convention Center