Sessions at PyCon US 2012 about Python on Saturday 10th March

Your current filters are…

  • Python Software Foundation Chairman's Address

    by Steve Holden

    At 9:05am to 9:15am, Saturday 10th March

    Coverage video

  • Let's Talk About (something diabolical) - PyPy

    by David Beazley

    At 9:15am to 10:00am, Saturday 10th March

    Coverage video

  • Python Meets the Arduino

    by Peter Kropf

    Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. Python is our favorate programming language that allows you to integrate systems more effectively. Learn how to use Python to communicate with an Arduino and interact with sensors, solenoids and motors.

    This talk with introduce the Arduino microcontroller and show how to interact with it using Python. With a serial line command protocol, Python code can easily turn on digital I/O pins to turn on LEDs, change the pulse width modulation (PWM) to alter brightness or move a stepper motor. Examples will be shown of a small robot that has a pair of 2 axis gimbles that serve as eyes and of controlling fire effect sequencing.

    At 10:25am to 11:05am, Saturday 10th March

    In D5, Santa Clara Convention Center

  • What you need to know about datetimes

    by Taavi Burns

    `time`, `datetime`, and `calendar` from the standard library are a bit messy. Find out what to use where and how (particularly when you have users in many timezones), and what extra modules you might want to look into.

    • Defining an "instant"
    • Silly timezones
    • In the words of Armin Ronacher:
    • Always measure and store time in UTC
    • Do not use offset aware datetimes
    • If you are taking in user input that is in local time, immediately convert it to UTC. If that conversion would be ambiguous let the user know.
    • Rebase for Formatting (then throw away that filthy offset aware datetime object)
    • Emil Mikulik on time
    • UTC vs UT1 vs UNIX time
    • Timezones are a presentation-layer problem!
    • Getting timezone information: pytz vs python-dateutil
    • Naïve vs Aware datetimes
    • datetime.now(tz) vs datetime.utcnow()
    • What does tm_isdst actually mean
    • datetime vs struct_time vs UNIX time
    • How to store them?
    • Using UNIX time: time.gmtime() and calendar.timegm()
    • Using MySQL (date, datetime, timestamp)
    • Using Postgres (date, timestamp)
    • Using Sqlite (text, real, integer)
    • To talk to JavaScript
    • Formatting with offsets
    • strftime and %z and friends, e.g. to simulate syslog log lines

    At 10:25am to 11:05am, Saturday 10th March

    In E3, Santa Clara Convention Center

    Coverage video

  • Python for makers

    by Hugo Boyer

    Digital fabrication is the art of translating digital designs into physical objects. Using personal machines that are controlled via software, a live demonstration of CNC milling and 3D printing will also be performed. This talk is a walkthrough from 3D models to machine motion, that shows how we can use Python to write GCODE generators that create endless form.

    This talk is aimed to the beginner to intermediate Python developer because it covers basic uses of certain parts of the standard library. it should also be of interest to people who are curious about digital fabrication and geometry.

    First, 2 personal fabrication machines are presented: A Sherline Milling machine and the latest Makerbot dual extruder 3D printer. A very quick functioning overview is presented, showing how electric pulses are translated to XYZ movements of the toolheads, as well as the difference between hot plastic extrusion onto a surface and milling away material.

    Then the rationale for a machine controller software is explained (being able to control the machine in terms of distances and feed rates rather than pulses), and an overview of gcode is provided. The first python scripts demonstrated generate gcode for milling operation. They are based on the code behind http://machinetouch.appspot.com

    http://machinetouch.appspot.com/... is presented with 2 or 3 slides of code and a Python logo is then engraved (live demo, 5 min) while an overview of the code is given: - how primitives map to python methods and gcode. - how it was easy to move from a console app to gui and to a web app using only the standard library features. - how this parametric approach to design allows the user to change certain aspects (materials, forms) and regenerate the tool path automatically (as opposed to a static drawing or the normal CAM based approach)

    The second part of the talk deals with 3D printing. The 3D printer is demoed first (loading a 3D model file, creating slices with the desired density and launching the tool), because the print will last about 10 minutes. As the machine runs, the following python code will be shown: - extracting triangles from an stl file using generators - slicing: finding intersection contours at a given height - pathing: generating patterns for the extruder - hard core parallelization of certain tasks using pyOpenCl (TBD, depending on the code base available) The presentation ends by assembling the new object made entirely from a digital representation (except for the LED circuit).
    The code will be based on Skeinforge of Makerbot’s new slicer (in development in Python3 right now).

    Makerbot operators are growing in numbers (more than 4000 units of open hardware sold) and all use Python to slice their 3D models and print them.

    At 11:05am to 11:45am, Saturday 10th March

    In D5, Santa Clara Convention Center

  • Storing, manipulating and visualizing timeseries using open source packages in Python

    by Jonathan Rocher

    Analyzing, storing and visualizing time-series efficiently are recurring though difficult tasks in various aspects of scientific data analysis such as meteorological forecasting, financial modeling, ... In this talk we will explore the current Python ecosystem for doing this effectively, comparing options, using only open source packages that are mature yet still under active development.

    At 11:05am to 11:45am, Saturday 10th March

    In E3, Santa Clara Convention Center

    Coverage video

  • Pragmatic Unicode, or, How do I stop the pain?

    by Ned Batchelder

    Python has great Unicode support, but it's still your responsibility to handle it properly. I'll do a quick overview of what Unicode is, but only enough to get your program working properly. I'll describe strategies to make your code work, and keep it working, without getting too far afield in Unicode la-la-land.

    Python has great Unicode support, but it's still your responsibility to handle it properly. Even expert programmers get tripped up with the encodings and decodings that can happen implicitly, throwing errors in unexpected places.

    This talk will present a quick overview of what Unicode is, why it exists, and how it works, but only enough to get your program working properly. Unicode can be intricate and fascinating, but really, who cares? You just want your code to work without throwing a UnicodeEncodeError every time an accented character sneaks in somehow.

    I'll describe strategies to make your code work, and keep it working, without getting too far afield in Unicode la-la-land.

    How Unicode is handled is one of the biggest changes in Python 3. I'll touch on what those changes are, and how you can use them to keep even your Python 2 code running smoothly.

    Bytes vs. text
    ASCII, 8859-1, etc.
    Python 2: str vs unicode
    encode and decode
    implicit conversions!!
    Python 3: bytes vs str
    Everybody's happy!

    At 11:45am to 12:15pm, Saturday 10th March

    In E3, Santa Clara Convention Center

  • Project Gado: Building an Open Archival Scanning Robot Using Python and Arduino

    by Thomas Smith

    Project Gado is an initiative which aims to create an open-source archival scanning robot which small archives can purchase for $500 and use to autonomously scan their photographic collections. This talk presents the Gado 2, a prototype scanning robot built around Python and Arduino, and shares lessons learned from using Python as the primary language in a large-scale archival scanning project.

    The archives of the Afro American Newspaper in Baltimore MD contain over 1.5 million historical photos spanning 115 years of the city’s African American history. One of the largest Black history collections in the world, the Afro’s archives include thousands of photos which have never been seen by the public.

    Why? Of the paper’s 1.5 million photos, only around 10,000 exist in a digital form; the Afro, like many small archives, simply does not have the human resources to manually digitize its collections. As a result, photos with incredible value for scholars, educators and community members alike are available only to the select few with the access, specialized skills, and time to travel to the physical archive and locate them.

    Project Gado was founded in 2010 to address these challenges. The project seeks to create an open source archival scanning robot which small organizations like the Afro can use to autonomously digitize their photographic holdings. The Gado 1, a proof-of-concept machine built using Python and Arduino, has successfully scanned over 1,000 photos to date.

    At 11:45am to 12:30pm, Saturday 10th March

    In D5, Santa Clara Convention Center

  • Coroutines, event loops, and the history of Python generators

    by David Mertz

    This talk traces lightweight concurrency from Python 2.2's generators, which enabled semi-coroutines as a mechanism for scheduling "weightless" threads; to PEP 342, which created true coroutines, and hence made event-driven programming easier; to 3rd party libraries built around coroutines, from older GTasklet and peak.events to the current Greenlet/gevent and Twisted Reactor.

    This talk aims to provide both a practical guide and theoretical underpinnings to the use of generator-based lightweight concurrency in Python.

    Lightning tour of generator constructs. Why generator-based scheduling is particularly useful for event-based programming.
    Simple example of a "trampoline" or scheduler.
    Slightly fleshed out example of scheduler with discussion of data-passing issues.
    Examples using GTasklet to make coroutine code look more like familiar sequential code (the framework is based on greenlets rather than generators, but accomplishes similar purpose).
    Brief examples of Twisted Reactors and Deferreds.
    Limits of generator-based concurrency (i.e. doesn't help with multiple cores and multiple servers). "Throw at the wall" list of ways to generalize to larger scales than single cores.

    At 1:20pm to 2:15pm, Saturday 10th March

    In E1, Santa Clara Convention Center

    Coverage video

  • Building a Kinect game with Python

    by Dino Viehland

    This talk will show you how to develop a game using Kinect from Python. I'll start w/ an introduction to the Kinect API including skeleton tracking, normal video, depth video, and audio APIs including speech recognition. I’ll then show how the Kinect APIs can be incorporated into a game using PyGame. After the talk you’ll be able to start developing your own Python based Kinect games!

    Kinect Device
    Kinect SDK
    Kinect API Overview
    Skeleton Tracking
    Audio / Voice Recognition
    PyGame Integration
    Post Kinect events to PyGame event queue
    Processing skeleton data, drawing skeletons, working w/ video stream
    The Game

    At 1:35pm to 2:15pm, Saturday 10th March

    In D5, Santa Clara Convention Center

  • Python and HDF5 - Fast Storage for Large Data

    by Mike Müller

    The presentation introduces the possibilities to use HDF5 (Hierarchical Data Format) from Python. HDF5 is one of the fastest ways to store large amounts of numerical data. The talk is for scientist who would like to store their measured or calculated data as well as for programmers who are interested in non-relational data storage.

    HDF5 (Hierarchical Data Format) allows to store large amounts of data fast. Many scientists use HDF5 for numerical data. Multidimensional arrays and database-like tables can be nested. This makes HDF5 useful for other user groups such as people working with image data.

    The main objective of HDF5 is the storage of data in the GB and TB range. A HDF5 file has a hierarchical structure with groups and sub-groups similar to file system with directories and sub-directories. The analogy to files are homogeneous, multidimensional arrays or database-like tables. The hierarchical structure uses B-trees that may span several files.

    HDF5 comes with compression options that allow a compact data storage. Therefore, write and read rates can be faster than the maximum rate of the hard drive compared to the stored data.

    Users from scientific and technical fields like to use HDF5. It has proven valuable for a variety of applications. The speed is often considerably higher than that of user defined binary formats. HDF5 is very attractive because its storage capacity is practically unlimited and the data access is very convenient. In addition, there are many tools that help visualize and interpret data stored in HDF5 files.

    HDF5 can be interesting not only for scientific application. Multidimensional arrays can be stored in tables. This opens new possibilities for an efficient and easy storage of image data including indexing. Another application could be platform independent virtual file systems based on HDF5.

    There are HDF5 libraries for different programming languages such as C, C++ and Fortran. There are two libraries for Python:

    h5py exposing the full C-API with all options to Python and
    PyTables that adds pythonic features to simplify especially the work with tables.
    This presentation gives examples for how to work with both libraries. Python programs for reading and writing HDF5 data are typically multiple times shorter than their counterparts in C or Fortran. Combining the elegance of Python with the extraordinary speed of HDF5 makes programming as well as program execution highly effective.

    At 1:35pm to 2:15pm, Saturday 10th March

    In E2, Santa Clara Convention Center

  • Web Server Bottlenecks And Performance Tuning

    by Graham Dumpleton

    New Python web developers seem to love running benchmarks on WSGI servers. Reality is that they often have no idea what they are doing or what to look at. This talk will look at a range of factors which can influence the performance of your Python web application. This includes the impact of using threads vs processes, number of processors, memory available, the GIL and slow HTTP clients.

    A benchmark of a hello world application is often what developers use to make the all important decision of what web hosting infrastructure they use. Worse is that in many cases this is the only sort of performance testing or monitoring they will ever do. When it comes to their production applications they are usually flying blind and have no idea of how it is performing and what they need to do to tune their web application stack.

    This talk will discuss different limiting factors or bottlenecks within your WSGI server stack and system that can affect the performance of your Python web application. It will illustrate the impacts of these by looking at typical configurations for the more popular WSGI hosting mechanisms of Apache/mod_wsgi, gunicorn and uWSGI, seeing how they perform under various types of traffic and request loads and then tweaking the configurations to see whether they perform better or worse.

    Such factors that will be discussed will include:

    Use of threads vs processes.
    Number of processors available.
    Python global interpreter lock (GIL)
    Amount of memory available.
    Slow HTTP browsers/clients.
    Browser keep alive connections.
    Need to handle static assets.
    From this an attempt will be made to provide some general guidelines of what is a good configuration/architecture to use for different types of Python web applications. The importance of continuous production monitoring will also be covered to ensure that you know when the performance of your system is dropping off due to changing traffic patterns as well as code changes you have made in your actual web application.

    At 1:35pm to 2:15pm, Saturday 10th March

    In E4, Santa Clara Convention Center

  • Getting the Most Out of Python Imports

    by Eric Snow

    To really take advantage of Python you must understand how imports work and how to use them effectively. In this talk we'll discuss both of these. After a short introduction to imports, we'll dive right in and look at how customizing import behavior can make all your wildest dreams come true.

    Python's import statement has been a powerful feature since the first release, and only gotten better with age. Understanding how imports work under the hood will let you take advantage of that power.

    A big key to customizing Python's imports is the importers introduced by PEP 302. That's a tool that you want in your belt! We'll be covering such import hooks as well as a couple other customization methods.

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

    In E1, Santa Clara Convention Center

    Coverage handout

  • Making maps with Python

    by Zain Memon

    Python makes it easy to store, query, and transform geodata. We will run through a handful of useful GIS libraries and patterns that let you do magical things with your maps. If you want to make maps that are more interactive and more interesting, this talk is for you.

    This talk will demystify the different parts of a usual map stack, including:

    GeoSpatial Datastores (RDBMS & NoSQL)
    Map servers (that query the geodata)
    Tile servers (that chunk the data into tiles and cache it)
    Browser UIs (and the difference between different Javascript slippy maps)

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

    In E3, Santa Clara Convention Center

    Coverage video

  • 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

  • RESTful APIs With Tastypie

    by Daniel Lindsley

    Providing full-featured REST APIs is an increasingly popular request. Tastypie allows you to easily implement a customizable REST API for your Python or Django applications.

    Who am I? (Primary author of Tastypie)
    Why REST?
    A touch of philosophy

    Use HTTP the best we can
    Flexible serialization (not everyone wants JSON)
    What you can GET should be able to be POST/PUT
    Should be reasonable by default but easy to extend
    URIs Everywhere!
    Why Tastypie?

    Works with Django
    Any data source (Not just ORM)
    Designed to be extensible
    Supports a variety of serialization formats (JSON/XML/YAML/bplist)
    URIs everywhere by default
    Lots of hooks for customization
    Demonstrate a simple setup

    Then explore the API based on that trivial setup
    Demonstrate adding authentication/authorization

    Demonstrate adding custom serialization
    Demonstrate adding a different data source
    Demonstrate adding a custom endpoint

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

    In E4, Santa Clara Convention Center

  • Cache Rules Everything Around Me

    by Noah Silas and Jacob Burch

    This talk aims to briefly introduce the core concepts of caching and covers the best practices of implementing them, using a small variety of python web frameworks (Flask, Django) for example code.

    "Are you caching?" is a question asked early on in any yarn on web scaling advice. These conversations are much better steered by asking a more open and difficult questions "What is your caching strategy?" and “How are you implementing it?” This talk aims to briefly introduce the core concepts of caching and quickly moves to cover the best practices using Django and Flask for example code. We will let the audience know what the important questions to ask are, give them advice on how to implement the right answers, and when even the built-in core backend isn’t enough, point them to more advanced techniques and the right third party tools.

    Important questions covered:

    • Why am I caching in the first place? Do I have to?
    • What is your caching strategy?
    • What are examples of good caching strategies?
    • Where do I put my cache code?
    • How dynamic is my content? Could I use a published cache?
    • Should I cache Python objects/classes, or base Python types?

    At 2:55pm to 3:40pm, Saturday 10th March

    In D5, Santa Clara Convention Center

    Coverage video

  • Python for data lovers: explore it, analyze it, map it

    by Jacqueline Kazil and Dana Bauer

    Exploring and analyzing data can be daunting and time-consuming, even for data lovers. Python can make the process fun and exciting. We will present techniques of data analysis, along with python tools that help you explore and map data. Our talk includes examples that show how python libraries such as csvkit, matplotlib, scipy, networkx and pysal can help you dig into and make sense of your data.

    Learn about powerful python libraries for analyzing all types of data, including spatial data, through the following illustrated examples.

    Example 1: Explore data

    Problem: I have a large voter data file in CSV format. I want to examine it, check the column headings and data types, and do some basic stats, but I don’t want to pull it into Excel or Access. What are my options?
    Solution: csvkit - I can explore my data, chop it up, sort it, summarize it, and prepare it for import to postgis.
    Bonus: Developers and journalists have been working hard to add functionality to csvkit. You can contribute!

    Example 2: Analyze data

    Problem: I have a bunch of data points from Twitter. How do I make sense of what I have in front of me, and where do I start?
    Solutions: matplotlib, networkx
    Bonus: Learn about how python libraries are plug and play with each other.

    Example 3: Map data

    Problem: I have a year’s worth of crime incidents for a large city. I want to explore global and local patterns in the data and identify clusters.
    Solutions: PySal (Numpy, Scipy)
    Bonus: We’ll look at the full ESDA (Exploratory Spatial Data Analysis) module in PySal, and we’ll briefly touch on a selection of the rest of PySal’s functionality.

    To wrap up the talk, we'll give some tips on using postgis and geodjango to go from data analysis and mapping to building a web application.

    At 2:55pm to 3:40pm, Saturday 10th March

    In E2, Santa Clara Convention Center

  • Sharing is Caring: Posting to the Python Package Index

    by Luke Sneeringer

    Due to its robust namespacing, Python uniquely equips developers to write and distribute reusable code. The Python community has a tool for this: the Python Package Index. PyPI is a massive repository of code, and in this talk you'll learn how to take code that you've written it and register and distribute it for use by others.

    Sharing is Caring: Posting to the Python Package Index
    Introduction (2.5m)
    I had been writing Python professionally for over a year before I learned how to do this. If I’d known how easy it was, perhaps I would make more code available.
    What is the Python Package Index? (5m)
    A repository of Python code written by thousands of different contributors
    Brief history (“the Cheese Shop”), and bare-bones explanation of pip
    Ultimately, it’s a place to help you re-invent as few wheels as possible
    Reminders: Reusable Code (5m)
    Everyone has a different use case.
    Use options.
    Support subclassing.
    Some best practices for this.
    The bottom line: Think about general needs, not just your specific needs.
    Python internal documentation
    ...and write your own, too!
    Walkthrough of Posting a Package (12.5m)
    An explanation of setup.py
    The file
    The setup function
    Things you need: name, author, version, packages, scripts
    Bonus material
    Registering and uploading your project.
    Questions? (5m)

    At 2:55pm to 3:25pm, Saturday 10th March

    In E1, Santa Clara Convention Center

  • Polyglot Programming with Python: Python/Scala Interop

    by Andrea O. K. Wright

    I won't just demonstrate how to use projects that bridge programming languages, I'll walk through the lower-level code that allows inter-language communication to happen.

    This talk is written to engage developers interested in exploring the different forms that polyglot programs can take. The examples all demonstrate techniques for integrating Python with Scala, but the concepts are applicable beyond the specific use case of Python/Scala interop, and the talk does not assume prior knowledge of Scala.

    Topics include:

    Brief intro to Scala (enough to be able to follow the examples)
    Basic script hosting APIs
    Python/Scala integration via Jython
    JEPP (CPython/JVM bridge)
    Leveraging Python’s support for metaprogramming to make foreign function calls virtually indistinguishable from host language function calls
    Passing a Python function to a Scala function that takes a Scala function as an argument
    Interface Definition Language (IDL) and IDL-based strategies
    Using TCP for inter-language communication
    Attendees should be familiar Python's metaprogramming capabilities because I won’t be providing background information about adding or modifying attributes dynamically or interrogating a Python object for attribute details.

    At 4:00pm to 4:55pm, Saturday 10th March

    In E1, Santa Clara Convention Center

    Coverage video

  • Spatial data and web mapping with Python

    by Paul Smith

    Spatial data are often seen as opaque to most developers, and while dealing with them does require a shift in approach from the data types we most regularly handle, they needn’t be the domain of specialists. High-quality Python libraries and Python-based applications exist for operating on and transforming spatial data, and for creating visualizations, including maps for presentation on the web.

    This talk will be an overview of the Python libraries and applications available for handling spatial and geospatial data and creating maps for the web. It will cover libraries for open and transforming spatial data formats and representations, spatial operators and predicates for queries and relationships, spatial indexes for efficient queries, and compositing and rendering map tiles, as well as desktop applications extensible with Python that replace much of the functionality of "enterprise" GIS software.

    At 4:00pm to 4:55pm, Saturday 10th March

    In E3, Santa Clara Convention Center

  • Building a Robot that Can Play Angry Birds on a Smartphone, (or Robots are the Future of Testing)

    by Jason Huggins

    Can your robot play Angry Birds? On an iPhone? Mine can. I call it "BitbeamBot". It started as an art project, but it has a much more serious practical application: mobile web testing. To trust that your mobile app truly works, you need an end-to-end test on the actual device. BitbeamBot is an Arduino-powered open-source hardware CNC robot that can test any application on any mobile device.

    For the confidence that your mobile app truly works, you need an end-to-end test on an actual device. This means the full combination of device manufacturer, operating system, data network, and application. And since mobile devices were meant to be handled with the human hand, you need something like a real hand to do real end-to-end testing. At some point, after lots of repetitive manual testing, the inevitable questions is asked "Can we / should we automate the testing of the old features, so I can focus the manual testing effort on the new features?"

    That's where the BitbeamBot comes in. BitbeamBot is an Arduino-powered open-source hardware CNC robot that can test any application on any mobile device -- touching the screen of a mobile device just like a user would. It also uses Python and the Selenium automation API to work its magic. In the future your testing will be automated... with robots.

    At the moment, BitbeamBot is just a prototype, but it can play games with simple mechanics, like Angry Birds. However, it's not very smart; it can't yet "see" where objects are on the screen. From my computer, I send electrical signals to two motors to move the pin over any point on an iPhone screen. I then use a third motor to move the pin down to the screen surface and click or drag objects. This open loop, flying-blind approach to automation is how automated software testing was done years ago. It's the worst way to automate. Without any sense of what's actually visible on screen, the script will fail when there's a discrepancy between what's actually on the screen and what you expected to be on screen at the time you wrote the automation script.

    A better approach to testing with BitbeamBot will involve closing the feedback loop and have software determine where to click based on what is actually on screen. There are two styles I'll experiment with: black box and grey box. Black box testing is easier to get started with, but grey box testing is more stable long term.

    Black box testing requires no internal knowledge of the application. It treats the application like a metaphorical "black box". If something is not visible via the user interface, it doesn't exist. To get this approach to work with BitbeamBot, I'll place a camera over the phone, send the image to my computer, and use an image-based testing tool like Sikuli. Sikuli works by taking a screenshot and then using the OpenCV image recognition library to find elements like text or buttons in the screenshot.

    The other style is grey box testing. It's a more precise approach, but it requires access to and internal knowledge of the application. I'll implement this approach by extending the Selenium library and tethering the phone to my computer via a USB cable. With the USB debugging interface turned on, I can ask the application precisely which elements are on screen, and where they are before moving the BitbeamBot pin to the right location.

    BitbeamBot's home is bitbeam.org. The hardware, software, and mechanical designs are open source and available on github.

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

    In E4, Santa Clara Convention Center

  • Cross-Compiling Python & C Extensions for Embedded Systems

    by Chris Lambacher

    Cross-compiling is not a use case directly supported by the Python build and extension system. This talk will discuss the process of building python for your embedded platform, and the basics of getting C extensions compiled and running. It will focus on Linux so that the build host and the build target are the same.

    Outline of talk

    Ground Rules:
    This talk is on cross-compiling. Porting Python to your favourite OS is a whole other (much longer) talk
    Examples Focus on embedded Linux so that build host and target are the same OS. Different host and target OS is way harder
    What makes cross-compiling Python challenging?

    Why can't I just use OpenEmbedded?

    may not support most recent Python versions
    may not have a build recipe for a required extension
    won't support your custom extensions
    you must use another platform
    Building Python (a short overview)

    build, patch, cross-build
    build standard lib extensions
    Building Extensions

    satisfying C dependencies
    modifying setup.py
    building for your platform
    packaging for distribution
    Other Things to Look Out for:

    package dependencies
    virtualenv & easy_install / pip
    Challenges you may encounter with platforms other than Linux

    Python 3.3 on hardware TBD
    Invitation to discuss ways to make Python more accessible to embedded developers

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

    In D5, Santa Clara Convention Center

    Coverage video

  • The Email Package: Past, Present, and Future

    by R. David Murray

    The email package in the Python Standard library has had a somewhat rocky transition into the Python3 era, and still doesn't handle non-ASCII easily. That is about to change. This talk will compare how things worked in Python2 (the past), how things work now (in Python3.2), and how things will work much better in the future (hopefully Python3.3).

    The email package in Python2 was given the internal version number '4'. The email package in Python3 bumped that to '5'. We're now working on version '6', hoping that it will be in shippable state for the Python 3.3 release.

    An email message, to the user, consists of a few headers (from, to, subject, date), some text (possibly rich-formatted html), and possibly some attachments. An email message sent over the Internet is a sequence of bytes formatted according to a very complex set of rules designed to make accurate interchange possible and backward compatibility with older software likely.

    The email package tries to bridge the gap between the ideal user representation and the network format.
    In the past, it has pretty much settled for providing basic tools that an application can use to do the translation itself. Using those tools to do anything non-trivial (such as using non-ASCII characters!) required understanding far more about the relevant email RFCs than any application developer should have to deal with. Now that Python3 makes working with unicode a fundamental, easy to use part of the language, it makes sense to have the email package provide an easy to use way of manipulating non-ASCII text in email messages. This talk will compare the old way of doing things with the new way. In doing so it will provide an introduction to the new capabilities of the email package, as well as providing a brief tutorial on how these facilities can be used to create, manipulate, receive, and transmit complex email messages.

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

    In E2, Santa Clara Convention Center

    Coverage video

  • Designing Embedded Systems with Linux and Python

    by Mark Kohler

    The continual decrease in the cost of computer hardware is allowing more embedded systems to be built with Linux and Python, instead of the traditional approach of a real-time operating system and C. This talk reviews the differences between those approaches and describes problems, solutions, and tools that can be used when building embedded systems with Python.

    • Intro - goal of talk (2 minutes)
    • Debian vs Fedora vs source distributions vs building your own (5 minutes)
    • Different from the Desktop (10 minutes)
    • user interfaces: toolkits vs. browsers
    • setting the time
    • network
    • storage and backups
    • upgrades: images vs packages vs deployment
    • Portability, or ifdefs are Harmful in Python too (5 minutes)
    • Not Python: C extensions, Swig, and import subprocess (5 minutes)
    • Summary (2 minutes)

    At 4:55pm to 5:30pm, Saturday 10th March

    In D5, Santa Clara Convention Center

    Coverage video

  • How CherryPy supports Python 2 and 3

    by Robert Brewer

    CherryPy was the first web framework to be made available for use with Python 3, and we tried several approaches to support both Python 2 and 3 before settling on one. Learn about the ups and the downs of each approach, and ways you can make your own porting project easier.

    The CherryPy project was the first web framework to support Python 3. At the same time, we needed to continue to support and improve the Python 2 implementation. It's taken plenty of time and lots of experimentation to find out the best way. We will explore four different ways to support both Python 2 and 3, commenting on the pros and cons of each.

    Python 3 change highlights
    Special concerns for I/O, including WSGI
    Approach 1: 2to3
    Approach 2: separate branches
    Approach 3: setup.py switch
    Approach 4: compatibility layer

    At 4:55pm to 5:30pm, Saturday 10th March

    In E3, Santa Clara Convention Center

    Coverage video

  • Mailman 3

    by Barry Warsaw

    Mailman 3 has been in development for several years. This is an evolution of the ever popular mailing list management system that runs thousands of mailing lists around the world. This talk describes how the code has been modernized and how the architectural deficiencies of Mailman 2 have been addressed using REST and other technologies. This is a spinoff from the AOSA chapter on Mailman 3.

    GNU Mailman has been around since the early 1990's. The current major version 2.1 is used at thousands of sites around the world, to host countless number of mailing lists, both public and private. Newsletter/announce style lists as well as discussion lists, and everything in between are hosted on Mailman systems. If you participate in open source, you almost certainly use Mailman whether you know it or not. You might even occasionally curse some of Mailman's mis-features such as password reminders, or multiple domain hosting limitations. Or you might have struggled with integrating Mailman into your own larger web site design.

    Mailman 3 is an initiative to address the biggest of the old architectural faults by bringing the code base into modern Python best practices, integrating a SQL database backend, and providing an administrative REST interface to the system for controlling it and making it easier to integrate into third party systems. This talk will outline some of these changes, always with an emphasis on the larger applicability of the solutions employed, and their lessons for the general Python programming public.

    At 4:55pm to 5:30pm, Saturday 10th March

    In E2, Santa Clara Convention Center

    Coverage video

  • The Pyed Piper: A Modern Python Alternative to awk, sed and Other Unix Text Manipulation Utilities

    by Toby Rosen

    "The Pyed Piper", or pyp, is a linux command line text manipulation tool similar to awk or sed, but which uses standard python string and list methods as well as custom functions evolved to generate fast results in an intense production environment.

    Pyp is a linux command line text manipulation tool similar to awk or sed, but which uses standard python string and list methods as well as custom functions evolved to generate fast results in an intense production environment. Pyed Pyper was developed at Sony Pictures Imageworks to facilitate the construction of complex image manipulation unix commands during visual effects work on Alice in Wonderland, Green Lantern, and the upcoming The Amazing Spiderman.

    Because pyp employs its own internal piping syntax ("|") similar to unix pipes, complex operations can be proceduralized by feeding the output of one python command to the input of the next. This greatly simplifies the generation and troubleshooting of multistep operations without the use of temporary variables or nested parentheses.

    pyp output has been optimized for typical production scenarios. For example, if text is broken up into an array using the "split()" method, the output will be automatically numbered by field making selecting a particular field trivial. Numerous other conveniences have been included, such as an accessible history of all inter-pipe sub-results, an ability to perform mathematical operations, and a complement of variables based on common metacharcter split/join operations.

    For power users, commands can be easily saved and recalled from disk as macros, providing an alternative to quick and dirty scripting. For the truly advanced user, additional methods can be added to the pyp class via a config file, allowing tight integration with larger facilities data structures or custom toolsets.

    At 4:55pm to 5:30pm, Saturday 10th March

    In E4, Santa Clara Convention Center

    Coverage video

  • What Python can learn from Java

    by Jonathan Ellis

    Java is in some ways a bogeyman to the Python community -- the language that parents scare their children with, the Cobol of the 21st century. But if we look past the cesspool of JEE it turns out that Java has quietly become an excellent systems environment, one that is still in many ways ahead of its time.

    • Introduction
    • The difference between systems and web (and scientific) computing
    • Why Pythonistas should care about systems programming
    • Concurrency
    • Why "just use multiple processes" is inadequate
    • Why event loops are inadequate
    • java.util.concurrent: low level (collections, synch primitives)
    • j.u.c.: high level (executors, futures, fork/join)
    • The VM
    • State of the art GC
    • Built-in (and extensible) telemetry
    • More functional than Python?!
    • immutability
    • Guava: com.google.*

    At 4:55pm to 5:30pm, Saturday 10th March

    In E1, Santa Clara Convention Center