In between other holiday-related activities I have had some time to work on some personal projects a bit over the past week. The result includes new releases of virtualenvwrapper, virtualenvwrapper.project, and a new product called sphinxcontrib-spelling.
virtualenvwrapper updates Version 2.6.1 of virtualenvwrapper includes a few fixes to make it work better under Python 2.4 and correct some problems with Cygwin. It also includes a major overhaul of the testing infrastructure to use tox instead of the home-grown scripts I was using for testing with multiple versions of Python.
Use the ConfigParser module to manage user-editable configuration files for an application. The configuration files are organized into sections, and each section can contain name-value pairs for configuration data. Value interpolation using Python formatting strings is also supported, to build values that depend on one another (this is especially handy for URLs and message strings).
Read more at pymotw.com: ConfigParser
The sqlite3 module provides a DB-API 2.0 compliant interface to the SQLite relational database. SQLite is an in-process database, designed to be embedded in applications, instead of using a separate database server program such as MySQL, PostgreSQL, or Oracle. SQLite is fast, rigorously tested, and flexible, making it suitable for prototyping and production deployment for some applications.
Read more at pymotw.com: sqlite3
The random module provides a fast pseudorandom number generator based on the Mersenne Twister algorithm. Originally developed to produce inputs for Monte Carlo simulations, Mersenne Twister generates numbers with nearly uniform distribution and a large period, making it suited for a wide range of applications.
Read more at pymotw.com: random
The select module provides access to platform-specific I/O monitoring functions. The most portable interface is the POSIX function select(), which is available on Unix and Windows. The module also includes poll(), a Unix-only API, and several options that only work with specific variants of Unix.
Read more at pymotw.com: select
The socket module exposes the low-level C API for communicating over a network using the BSD socket interface. It includes the socket class, for handling the actual data channel, and functions for network-related tasks such as converting a server’s name to an address and formatting data to be sent across the network.
Read more at pymotw.com: socket
Brian Jones posted a solution to the Oblong Spiral Puzzle recently. I don’t normally mess with puzzles, but after looking at his solution I thought I would take a stab at it and see if I could come up with a solution in Python that was a little less complicated.
The Puzzle The complete definition of the puzzle is on the Code Golf site. The challenge is to fill in an n x m array with a sequence of numbers starting at the upper left, and working around the outside, spiraling inwards.
In Python 2.7 sysconfig has been extracted from distutils to become a stand-alone module. It includes functions for determining the settings used to compile and install the current interpreter.
Read more at pymotw.com: sysconfig
pdb implements an interactive debugging environment for Python programs. It includes features to let you pause your program, look at the values of variables, and watch program execution step-by-step, so you can understand what your program actually does and find bugs in the logic.
Read more at pymotw.com: pdb
Regular expressions are text matching patterns described with a formal syntax. The patterns are interpreted as a set of instructions, which are then executed with a string as input to produce a matching subset or modified version of the original. The term “regular expressions” is frequently shortened to as “regex” or “regexp” in conversation. Expressions can include literal text matching, repetition, pattern-composition, branching, and other sophisticated rules. A large number of parsing problems are easier to solve with a regular expression than by creating a special-purpose lexer and parser.