operator — Functional Interface to Built-in Operators — PyMOTW 3

Programming using iterators occasionally requires creating small functions for simple expressions. Sometimes, these can be implemented as lambda functions, but for some operations new functions are not needed at all. The operator module defines functions that correspond to built-in operations for arithmetic, comparison, and other operations corresponding to standard object APIs. Read more… This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

pickle — Object Serialization — PyMOTW 3

The pickle module implements an algorithm for turning an arbitrary Python object into a series of bytes. This process is also called serializing the object. The byte stream representing the object can then be transmitted or stored, and later reconstructed to create a new object with the same characteristics. Read more… This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

os — Portable access to operating system specific features — PyMOTW 3

The os module provides a wrapper for platform specific modules such as posix , nt , and mac . The API for functions available on all platforms should be the same, so using the os module offers some measure of portability. Read more… This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

uuid — Universally Unique Identifiers — PyMOTW 3

RFC 4122 defines a system for creating universally unique identifiers for resources in a way that does not require a central registrar. UUID values are 128 bits long and, as the reference guide says, “can guarantee uniqueness across space and time.” They are useful for generating identifiers for documents, hosts, application clients, and other situations where a unique value is necessary. The RFC is specifically focused on creating a Uniform Resource Name namespace and covers three main algorithms:

Regular Expressions Are Nothing to Fear

Last week at PyATL I gave an introductory talk about regular expressions. The talk was a bit less pre-written than my usual because I wanted it to be more interactive, so there is no longer blog post to go with the slides but there are some speaker notes. For some similar examples with more code, see PyMOTW: re. The slides are available here and via the repository on github.

itertools — Iterator Functions — PyMOTW 3

The functions provided by itertools are inspired by similar features of functional programming languages such as Clojure, Haskell, APL, and SML. They are intended to be fast and use memory efficiently, and also to be hooked together to express more complicated iteration-based algorithms. Read more… This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

getopt — Command Line Option Parsing — PyMOTW 3

The getopt module is the original command line option parser that supports the conventions established by the Unix function getopt() . It parses an argument sequence, such as sys.argv and returns a sequence of tuples containing (option, argument) pairs and a sequence of non-option arguments. Read more… This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

pkgutil — Package Utilities — PyMOTW 3

The pkgutil module includes functions for changing the import rules for Python packages and for loading non-code resources from files distributed within a package. Read more… This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

Driving OpenStack via Ansible

Last week I spoke at the Atlanta OpenStack meetup about “Driving OpenStack via Ansible,” in which I introduced Ansible as a tool and talked about its ability to integrate with OpenStack. As part of the presentation I used two playbooks to launch VMs on a cloud and configure them with different applications. We walked through the playbooks and talked about what they were doing, the things that tripped me up while writing them, and then brainstormed ways to use Ansible in situations that have come up for members of the meetup.

One playbook uses my role to install ZNC, the popular IRC “bouncer,” for maintaining a persistent chat presence. The other demo was based on a playbook with the roles needed to configure a server for OpenStack development, ready to run devstack.

The slides are available, and you can download the playbooks from the github repository and try them yourself.

We used Dreamhost’s public cloud, DreamCompute, for the demo at the meetup. Thanks to the DreamHost crew for providing those resources!