Sessions at PyCon US 2012 matching your filters

Your current filters are…

Clear
  • Documenting Your Project With Sphinx

    by Brandon Rhodes

    Python projects can succeed or fail because of their documentation. Thanks to Sphinx, Python now has a “documentation framework” with indexing, syntax highlighting, and integration with your code. Students will be given a small undocumented Python package, and during the exercises they will give the package a tutorial and reference manual. Plus: deployment and theming!

    Python projects can succeed or fail based on their documentation. Thanks to Sphinx, Python now has a "documentation framework" that provides convenient indexing and automatic syntax highlighting, and can also integrate your documentation with your code (your documentation can be run as a test, and your class and function docstrings can become your reference documentation). Students will be given an undocumented sample Python package, and be lead through exercises that result, by the end of the tutorial, in their giving the package a full tutorial and reference manual. Deployment and theming will also be taught.

    Besides a 15-minute introduction and 15 minutes for questions and discussion at the end, the tutorial will be organized in six 25-minute sessions which each involve a short lecture and then an interactive exercise that asks the students to apply what they have just learned. Here are the major topics covered by each of the six sessions:

    • The reStructuredText markup language and its syntax; the standard doctools; and the two different conventions that Sphinx can support for laying projects out as directories and files.
    • The Sphinx documentation build process on both Unix and Windows; how to arrange your project documentation in a way that will make sense to novice, experienced, and expert users alike; and how Sphinx supports connections between different pages of documentation.
    • Running code examples in the documentation as doctests; the pros and cons of pulling docstrings from the code as API documentation (and how to do it if it proves necessary); and including non-doctest full code listings in the documentation.
    • Referencing headings in the same document; cross-referencing between documents; making class and method names automatically link to their entry in the API documentation; and how to make code objects appear in the index.
    • Theming with custom HTML and CSS, for students who happen to know web design; plugging in pre-made Sphinx themes; and how to integrate Sphinx into an entire web site for their product.
    • Shipping documentation with your package on PyPI; installing it readthedocs.org; making sure that documentation gets included with a binary install; using a version control source browser to view documentation directly in their project trunk; and deploying Sphinx to a web site.

    The Sphinx approach will be linked to other successful documentation systems in our computing heritage, most notably in the practices it shares in common with the Unix Documenter's Workbench (DWB) of the 1970s.

    At 9:00am to 12:20pm, Thursday 8th March

    In H2, Santa Clara Convention Center

    Coverage video

  • High Performance Python I

    by Ian Ozsvald

    At EuroPython 2011 I ran a very hands-on tutorial for High Performance Python techniques. This updated tutorial will cover profiling, PyPy, Cython, numpy, NumExpr, ShedSkin, multiprocessing, ParallelPython and pyCUDA. Here's a 55 page PDF write-up of the EuroPython material: http://ianozsvald.com/2011/07/25...

    At EuroPython 2011 I ran a very hands-on tutorial for High Performance Python techniques. This updated tutorial will cover:

    • profiling with cProfile, run_snake and line_profiler
    • PyPy
    • Cython
    • numpy with and without vectors
    • NumExpr
    • ShedSkin Py->C++ compiler
    • multiprocessing for multi-core
    • ParallelPython for multi-machine
    • pyCUDA demos

    I plan to expand the original material and to maybe also cover other tools like execnet and PyPy-numpy.

    At 9:00am to 12:20pm, Thursday 8th March

    In D2, Santa Clara Convention Center

  • Introduction to Game Development

    by Richard Jones and Katie Cunningham

    This tutorial will walk the attendees from some introductory game development theory (what makes a good game) and through development of a simple game (how to make a good game) with time left over for some experimentation and exploration of different types of games.

    The tutorial will start with Katie Cunningham giving an introduction to video games, covering the basic components of a game, and some general game genres. Some basic tropes in modern games will be explored, as well as pitfalls to avoid in making a game for a today’s audience. Genres will be paired with inexpensive/free examples that can be explored by the tutorial attendees later.

    The baton will then pass to Richard Jones who will walk through the practicalities of building a simple video game from scratch, starting with presenting one approach to structuring the game code to keep it sane. He will talk about what libraries are available and then focus on the facilities present in the library used in the tutorial.

    We will then walk through the development of a simple game during which the attendees will code the game. Once the game is developed we will talk about potential further development that possibilities and use the remaining tutorial time to encourage and assist attendees in their efforts to do so.

    The game developed will cover the key game-writing skills of controlling what appears on the screen (including animation), loading resources, handling user input and simulating the environment within the game.

    Participants should be familiar with Python, and must have pygame installed. We will not have time to deal with installation and compatibility issues so participants must check their laptops can run pygame applications.

    At 9:00am to 12:20pm, Thursday 8th March

    In H3, Santa Clara Convention Center

    Coverage video

  • Optimize Performance and Scalability with Parallelism and Concurrency

    by Robert Hancock

    From how the operating system handles your requests through design principles on how to use concurrency and parallelism to optimize your program's performance and scalability. We will cover processes, threads, generators, coroutines, non-blocking IO, and the gevent library.

    How processes, threads, coroutines, and non-blocking IO work from the operating system through code implementation and design principles to optimize Python programs. The difference between parallelism and concurrency and when to use each.

    The premise is that to make an informed decision you need to know what is happening under the hood. Once you understand the low level functionality, you can make the correct decision in the design phase.

    The emphasis is on practical application to solve real world problems.

    Outline

    • How the operating system handles traps and interrupts
    • Scheduling
    • Processes
    • Threads
    • The GIL
    • Generators
    • What is a coroutine?
    • What is a Python coroutine?
    • Blocking/Non-blocking I/O.
    • Parallelism versus Concurrency
    • How do these work with CPython, Pypy, and Stackless
    • Greenlets and libevent (gevent)
    • Design principles
    • Example networked application
    • Performance results
    • What are other the other options?

    At 9:00am to 12:20pm, Thursday 8th March

    In F2, Santa Clara Convention Center

  • Plotting with matplotlib

    by Mike Müller

    When it comes to plotting with Python many people think about matplotlib. It is widely used and provides a simple interface for creating a wide variety of plots from very simple diagrams to sophisticated animations. This tutorial is a hands-on introduction that teaches the basics of matplotlib. Students will learn how to create publication-ready plots with just a few lines of Python.

    Target Audience

    This tutorial is for Python users who would like to create nice 2d plots with Python.

    Audience Level

    Students should have a working knowledge of Python. NumPy knowledge is helpful but not required.

    Prerequisites

    Please bring your laptop with the operating system of your choice (Linux, Mac OS X, Windows). In addition to Python 2.6 or 2.7, we need: - a current versions of matplotlib (http://matplotlib.sourceforge.net) - IPython (http://ipython.org) and - NumPy (http://numpy.scipy.org).

    Method

    This is a hands-on course. Students are strongly encouraged to work along with the trainer at the interactive prompt. There will be exercises the students need to do on their own. Experience shows that this active involvement is essential for an effective learning.

    Content

    The library matplotlib provides many different types of diagrams from within Python with only few lines of code. Examples are used to exercise the use of this library. The tutorial provides an overview how to create plots with matplotlib. IPython in combination with pylab from matplotlib provides an interactive environment for fast testing of ideas. We will be using this for most of the tutorial.

    With a simple plot we learn how to add axis labels, titles and a legend. The GUI offers zooming, panning, changing of plot sizes and other interactive ways to modify the plot. We will use Python to change properties of existing plots such as line colors, marker symbols, or line styles. There are several ways how to place text on plots. You will learn about the different coordinate systems relative to the plot, the canvas or the figure. Another topic are ticks, where to put them and how to format them to achieve publication-quality plots. The concepts of figures, subplots, and axes and how they relate to each other will be explained with examples.

    matplotlib offers many different types of plots. The tutorial introduces several of them with an example. A more advanced topic will be creating your own plot types. We will build a stacked plot type. Finally, we will create a small animation to explore the possibilities to visualize changes.

    Outline

    • Introduction (5 min)
    • IPython (5 min)
    • pylab (5 min)
    • Simple plots (20 min)
    • Properties (15 min)
    • Text (20 min)
    • Ticks (25 min)
    • Figures, subplots, and axes (25 min)
    • Other types of plots (10 min)
    • The class library (15 min)
    • Creating New Plot Types (20 min)
    • Animations (15 min)

    At 9:00am to 12:20pm, Thursday 8th March

    In H1, Santa Clara Convention Center

    Coverage video

  • Python Epiphanies

    by Stuart Williams

    This tutorial is for software developers who've been using Python with success for a while but are looking for a deeper understanding of the language. It demystifies a number of language features that are often misunderstood.

    In many ways Python is very similar to other programming languages. However, in a few sometimes subtle ways it is quite different, and many software developers new to Python, after their initial successes, hit a plateau and can't figure out how to get past it. Others don't hit or perceive a plateau, but still find some of Python's features a little mysterious. This tutorial will help deconstruct your incorrect assumptions about Python and pull away the mists of confusion.

    If in your use of Python you sometimes feel like an outsider, like you're missing the inside jokes, or like you have most of the puzzle pieces but they don't quite fit together yet, this may be a good tutorial for you.

    After completing this tutorial you'll have a deeper understanding of many Python features. Here are some of the topics we'll cover:

    • How namespaces really work, after which you'll understand:
    • most of the differences between variables in other languages and Python, including
    • why Python has neither pass-by-value nor pass-by-reference function call semantics, or why sometimes variables passed to a function can be changed by it, and sometimes they cannot.
    • Iterables, iterators, and the iterator protocol, including how to add it to a class
    • How generators can make your code easier to read and understand
    • Creating classes without a class statement in order to better understand how they work
    • Bound versus unbound methods and interesting uses of the former
    • How and why you might want to create or use a partial function
    • Other use-cases of functions as first-class citizens
    • Unpacking and packing arguments with * and ** on function call and definition

    Attendee Requirements

    Bring a laptop computer with a recent version of Python 2.7 or Python 3 installed.

    Prerequisites

    Intermediate ability in Python and little or no fear of iterators, generators, classes, methods, and how to call a function that's stored in a data structure.

    At 9:00am to 12:20pm, Thursday 8th March

    In F1, Santa Clara Convention Center

    Coverage video

  • Social Network Analysis with Python

    by Maksim Tsvetovat

    Social Network data permeates our world -- yet we often don't know what to do with it. In this tutorial, I will introduce both theory and practice of Social Network Analysis -- gathering, analyzing and visualizing data using Python and other open-source tools. I will walk the attendees through an entire project, from gathering and cleaning data to presenting results.

    SNA techniques are derived from sociological and social-psychological theories and take into account the whole network (or, in case of very large networks such as Twitter -- a large segment of the network). Thus, we may arrive at results that may seem counter-intuitive -- e.g. that Justin Bieber (7.5 mil. followers) and Lady Gaga (7.2 mil. followers) have relatively little actual influence despite their celebrity status -- while a middle-of-the-road blogger with 30K followers is able to generate tweets that "go viral" and result in millions of impressions.

    In this tutorial, we will conduct social network analysis of a real dataset, from gathering and cleaning data to analysis and visualization of results. We will use Python and a set of open-source libraries, including NetworkX, NumPy and Matplotlib.

    Outline:

    • Introduction. Why should we do this? What is the data like? Why is this different from other techniques? What can we learn?
    • Centralities: Degree, closeness, betweenness, PageRank, Klout Score
    • Beyond Klout Score: Finding communities of interest, finding clusters in networks
    • Information diffusion in networks -- how do things go viral?

    At 9:00am to 12:20pm, Thursday 8th March

    In D3, Santa Clara Convention Center

    Coverage video

  • High Performance Python II

    by Travis Oliphant

    In this tutorial, I will cover how to write very fast Python code for data analysis. I will briefly introduce NumPy and illustrate how fast code for Python is written in SciPy using tools like Fwrap / F2py and Cython. I will also describe interesting new approaches to creating fast code that is leading changes to NumPy on a fundamental level.

    In this tutorial, I will cover how to write very fast Python code for data analysis including making use of NumPy and using GPUs. I will largely focus on writing extensions to Python using hand-wrapping and Cython but will touch also on using tools like weave, Instant, ShedSkin and compare them to PyPy. I will also spend the last part of the tutorial on using GPUs with Python and discuss the performance trade-offs of the technology. This will be a high-level overview of the space with deep dives in Cython and GPUs

    Outline:

    • Brief Introduction to NumPy, SciPy and array-oriented computing with Python including exercises (1 hour)
    • Introduction to hand-wrapping and extending Python (1 hour)
    • Detailed description of Cython and how to use it to connect to machine-compiled code (1 hour)
    • Detailed description of GPUs and how to use them best with NumPy (45 minutes)
    • Summary and overview of using Python to write super fast code (15 minutes)

    At 1:20pm to 4:40pm, Thursday 8th March

    In D2, Santa Clara Convention Center

    Coverage video

  • Introduction to Interactive Predictive Analytics in Python with scikit-learn

    by Olivier Grisel

    The goal of this tutorial is to give the attendee a first experience of machine learning tools applied to practical software engineering tasks such as language detection of tweets, topic classification of web pages, sentiment analysis of customer products reviews and facial recognition in pictures from the web or from your own webcam.

    The demand for software engineers with Data Analytics and Machine Learning skills is rapidly growing and Python / Numpy is one of the best environments for quickly prototyping scalable data-centric applications or interactively exploring your data especially thanks to tools such as IPython and Matplotlib.

    scikit-learn is a very active open source project that implements a variety of state-of-the art machine learning algorithms. The goal of this project and tutorial is to take the algorithms out of the academic papers and make them work on a selection of real world tasks to unleash the value of your data.

    We will focus on providing hints to perform the right data preprocessing steps and on how to select algorithms and parameters suitable for the task at hand. We will also introduce tools and methodologies to measure the performance of the trained models as objectively as possible.

    At 1:20pm to 4:40pm, Thursday 8th March

    In F1, Santa Clara Convention Center

    Coverage video