John Smith's Blog

Ramblings (mostly) about technical stuff

Alphabetically sorted list of pure Python stdlib modules

Posted by John Smith on

(This is a bit of a lame post - 99% was generated by a script - but I wanted an online copy for my own future reference.)

I was reading the notes about the new stuff in Python 3.3, and it struck me that I didn't know anything about a couple of the modules mentioned. (For the record, they were abc and sched - hopefully my ignorance of them isn't too shameful ;-)

This has motivated me to go through the Python standard library and make sure I have at least a cursory knowledge of all the modules - I'm aiming to do one per day. There is a list on python.org, but it is grouped by theme, and I'd rather have a bit of a change from one day to the next, which hopefully an alphabetically sorted list should have a fair chance of achieving.

To this end, I knocked up a basic script to churn through the stdlib directory, which I can then use as a tick list. Maybe it could be of use to someone else too? Important: the list omits libraries which are written in C - these have __doc__ properties formatted differently from the pure Python libraries, and I think the pure libraries are enough for me to be going on with for now :-)

BTW, after I'd written the script to generate this list, I found that there's a similar (but more nicely formatted) list on Doug Hellmann's site, which annoyingly didn't show up in my Google search queries when I started out on this. It does have references for the C libraries, but I also notice a few libraries in the list below that aren't on that page e.g. ast, bdb, code. As I don't (currently!) know what those libraries are, I don't know if there's a particular reason for their omission.

abc
Abstract Base Classes (ABCs) according to PEP 3119.
_abcoll
Abstract Base Classes (ABCs) for collections, according to PEP 3119.
aifc
Stuff to parse AIFF-C and AIFF files.
antigravity
{Undocumented}
anydbm
Generic interface to all dbm clones.
argparse
Command-line parsing library
ast
ast
asynchat
A class supporting chat-style (command/response) protocols.
asyncore
Basic infrastructure for asynchronous socket service clients and servers.
atexit
allow programmer to define multiple exit functions to be executed upon normal program termination.
audiodev
Classes for manipulating audio devices (currently only for Sun and SGI)
base64
RFC 3548: Base16, Base32, Base64 Data Encodings
BaseHTTPServer
HTTP server base class.
Bastion
ification utility.
bdb
Debugger basics
binhex
Macintosh binhex compression/decompression.
bisect
Bisection algorithms.
bsddb
Support for Berkeley DB 4.1 through 4.8 with a simple interface.
calendar
Calendar printing functions
cgi
Support module for CGI (Common Gateway Interface) scripts.
CGIHTTPServer
CGI-savvy HTTP Server.
cgitb
More comprehensive traceback formatting for Python scripts.
chunk
Simple class to read IFF chunks.
cmd
A generic class to build line-oriented command interpreters.
code
Utilities needed to emulate Python's interactive interpreter.
codecs
Python Codec Registry, API and helpers.
codeop
Utilities to compile possibly incomplete Python source code.
collections
{Undocumented}
colorsys
Conversion functions between RGB and other color systems.
commands
Execute shell commands via os.popen() and return status, output.
compileall
Module/script to "compile" all .py files to .pyc (or .pyo) file.
compiler
Package for parsing and compiling Python source code
config
{Not importable - ImportError}
ConfigParser
Configuration file parser.
contextlib
Utilities for with-statement contexts. See PEP 343.
Cookie
Here's a sample session to show how to use this module. At the moment, this is the only documentation.
cookielib
HTTP cookie handling for web clients.
copy
Generic (shallow and deep) copying operations.
copy_reg
Helper to provide extensibility for pickle/cPickle.
cProfile
Python interface for the 'lsprof' profiler. Compatible with the 'profile' module.
csv
CSV parsing and writing.
ctypes
create and manipulate C data types in Python
curses
curses
dbhash
Provide a (g)dbm-compatible interface to bsddb.hashopen.
decimal
This is a Py2.3 implementation of decimal floating point arithmetic based on the General Decimal Arithmetic Specification:
Demo
{Not importable - ImportError}
difflib
helpers for computing deltas between objects.
dircache
Read and cache directory listings.
dis
Disassembler of Python byte code into mnemonics.
distutils
distutils
Doc
{Not importable - ImportError}
doctest
a framework for running examples in docstrings.
DocXMLRPCServer
Self documenting XML-RPC Server.
dumbdbm
A dumb and slow but simple dbm clone.
dummy_thread
Drop-in replacement for the thread module.
dummy_threading
Faux ``threading`` version using ``dummy_thread`` instead of ``thread``.
email
A package for parsing, handling, and generating email messages.
encodings
Standard "encodings" Package
filecmp
Utilities for comparing files and directories.
fileinput
Helper class to quickly write a loop over all standard input files.
fnmatch
Filename matching with shell patterns.
formatter
Generic output formatting.
fpformat
General floating point formatting functions.
fractions
Rational, infinite-precision, real numbers.
ftplib
An FTP client class and some helper functions.
functools
Tools for working with functions and callable objects
__future__
Record of phased-in incompatible language changes.
genericpath
Path operations common to more than one OS Do not use directly. The OS specific modules import the appropriate functions from this module themselves.
getopt
Parser for command line options.
getpass
Utilities to get a password and/or the current user name.
gettext
Internationalization and localization support.
glob
Filename globbing utility.
gzip
Functions that read and write gzipped files.
hashlib
module - A common interface to many hash functions.
heapq
Heap queue algorithm (a.k.a. priority queue).
hmac
HMAC (Keyed-Hashing for Message Authentication) Python module.
hotshot
High-perfomance logging profiler, mostly written in C.
htmlentitydefs
HTML character entity references.
htmllib
HTML 2.0 parser.
HTMLParser
A parser for HTML and XHTML.
httplib
HTTP/1.1 client library
idlelib
{Undocumented}
ihooks
Import hook support.
imaplib
IMAP4 client.
imghdr
Recognize image file formats based on their first few bytes.
importlib
Backport of importlib.import_module from 3.x.
imputil
Import utilities
inspect
Get useful information from live Python objects.
io
The io module provides the Python interfaces to stream handling. The builtin open function is defined in this module.
json
JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format.
keyword
Keywords (from "graminit.c")
lib-dynload
{Not importable - SyntaxError}
lib-tk
{Not importable - SyntaxError}
lib2to3
{Undocumented}
linecache
Cache lines from files.
locale
Locale support.
logging
Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system.
_LWPCookieJar
Load / save to libwww-perl (LWP) format files.
macpath
Pathname and path-related operations for the Macintosh.
macurl2path
Macintosh-specific module for conversion between pathnames and URLs.
mailbox
Read/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.
mailcap
Mailcap file handling. See RFC 1524.
markupbase
Shared support for scanning document type declarations in HTML and XHTML.
md5
{Undocumented, with warnings - possibly deprecated?}
mhlib
MH interface -- purely object-oriented (well, almost)
mimetools
Various tools used by MIME-reading or MIME-writing programs.
mimetypes
Guess the MIME type of a file.
MimeWriter
Generic MIME writer.
mimify
Mimification and unmimification of mail messages.
modulefinder
Find modules used by a script, using introspection.
_MozillaCookieJar
Mozilla / Netscape cookie loading / saving.
multifile
A readline()-style interface to the parts of a multipart message.
multiprocessing
{Undocumented}
mutex
Mutual exclusion -- for use with module sched
netrc
An object-oriented interface to .netrc files.
new
Create new objects of various types. Deprecated.
nntplib
An NNTP client class based on RFC 977: Network News Transfer Protocol.
ntpath
Common pathname manipulations, WindowsNT/95 version.
nturl2path
Convert a NT pathname to a file URL and vice versa.
numbers
Abstract Base Classes (ABCs) for numbers, according to PEP 3141.
opcode
module - potentially shared between dis and other modules which operate on bytecodes (e.g. peephole optimizers).
optparse
A powerful, extensible, and easy-to-use option parser.
os
OS routines for Mac, NT, or Posix depending on what system we're on.
os2emxpath
Common pathname manipulations, OS/2 EMX version.
pdb
A Python debugger.
__phello__.foo
{Undocumented}
pickle
Create portable serialized representations of Python objects.
pickletools
"Executable documentation" for the pickle module.
pipes
Conversion pipeline templates.
pkgutil
Utilities to support packages.
platform
This module tries to retrieve as much platform-identifying data as possible. It makes this information available via function APIs.
plat-linux2
{Not importable - SyntaxError}
plistlib
a tool to generate and parse MacOSX .plist files.
popen2
Spawn a command with pipes to its stdin, stdout, and optionally stderr.
poplib
A POP3 client class.
posixfile
Extended file operations available in POSIX.
posixpath
Common operations on Posix pathnames.
pprint
Support to pretty-print lists, tuples, & dictionaries recursively.
profile
Class for profiling Python code.
pstats
Class for printing reports on profiled python code.
pty
Pseudo terminal utilities.
pyclbr
Parse a Python module and describe its classes and methods.
py_compile
Routine to "compile" a .py file to a .pyc (or .pyo) file.
pydoc
Generate Python documentation in HTML or text for interactive use.
pydoc_data
{Undocumented}
_pyio
Python implementation of the io module.
Queue
A multi-producer, multi-consumer queue.
quopri
Conversions to/from quoted-printable transport encoding as per RFC 1521.
random
Random variable generators.
re
Support for regular expressions (RE).
repr
Redo the builtin repr() (representation) but with limits on most sizes.
rexec
Restricted execution facilities.
rfc822
RFC 2822 message manipulation.
rlcompleter
Word completion for GNU readline 2.0.
robotparser
runpy
locating and running Python code using the module namespace
sched
A generally useful event scheduler class.
sets
Classes to represent arbitrary sets (including sets of sets).
sgmllib
A parser for SGML, using the derived class as a static DTD.
sha
{Undocumented, with warnings - possibly deprecated?}
shelve
Manage shelves of pickled objects.
shlex
A lexical analyzer class for simple shell-like syntaxes.
shutil
Utility functions for copying and archiving files and directory trees.
SimpleHTTPServer
Simple HTTP Server.
SimpleXMLRPCServer
Simple XML-RPC Server.
site
Append module search paths for third-party packages to sys.path.
site-packages
{Not importable - SyntaxError}
smtpd
An RFC 2821 smtp proxy.
smtplib
SMTP/ESMTP client class.
sndhdr
Routines to help recognizing sound files.
socket
This module provides socket operations and some related functions. On Unix, it supports IP (Internet Protocol) and Unix domain sockets. On other systems, it only supports IP. Functions specific for a socket are available as methods of the socket object.
SocketServer
Generic socket server classes.
sqlite3
{Undocumented}
sre
This file is only retained for backwards compatibility. It will be removed in the future. sre was moved to re in version 2.5.
sre_compile
Internal support module for sre
sre_constants
Internal support module for sre
sre_parse
Internal support module for sre
ssl
This module provides some more Pythonic support for SSL.
stat
Constants/functions for interpreting results of os.stat() and os.lstat().
statvfs
Constants for interpreting the results of os.statvfs() and os.fstatvfs().
string
A collection of string operations (most are no longer used).
StringIO
File-like objects that read from or write to a string buffer.
stringold
Common string manipulations.
stringprep
Library that exposes various tables found in the StringPrep RFC 3454.
_strptime
Strptime-related classes and functions.
struct
Functions to convert between Python values and C structs represented as Python strings. It uses format strings (explained below) as compact descriptions of the lay-out of the C structs and the intended conversion to/from Python values.
subprocess
Subprocesses with accessible I/O streams
sunau
Stuff to parse Sun and NeXT audio files.
sunaudio
Interpret sun audio headers.
symbol
Non-terminal symbols of Python grammar (from "graminit.h").
symtable
Interface to the compiler's internal symbol tables
sysconfig
Provide access to Python's configuration information.
tabnanny
The Tab Nanny despises ambiguous indentation. She knows no mercy.
tarfile
Read from and write to tar format archives.
telnetlib
TELNET client class.
tempfile
Temporary files.
test
{Undocumented}
textwrap
Text wrapping and filling.
this
The Zen of Python, by Tim Peters
threading
Thread module emulating a subset of Java's threading model.
_threading_local
Thread-local objects.
timeit
Tool for measuring execution time of small code snippets.
toaiff
Convert "arbitrary" sound files to AIFF (Apple and SGI's audio format).
token
Token constants (from "token.h").
tokenize
Tokenization help for Python programs.
Tools
{Not importable - ImportError}
trace
program/module to trace Python program or function execution
traceback
Extract, format and print information about Python stack traces.
tty
Terminal utilities.
types
Define names for all type symbols known in the standard interpreter.
unittest
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework.
urllib
Open an arbitrary URL.
urllib2
An extensible library for opening URLs using a variety of protocols
urlparse
Parse (absolute and relative) URLs.
user
Hook to allow user-specified customization code to run.
UserDict
A more or less complete user-defined wrapper around dictionary objects.
UserList
A more or less complete user-defined wrapper around list objects.
UserString
A user-defined wrapper around string objects
uu
Implementation of the UUencode and UUdecode functions.
uuid
UUID objects (universally unique identifiers) according to RFC 4122.
warnings
Python part of the warnings subsystem.
wave
Stuff to parse WAVE files.
weakref
Weak reference support for Python.
_weakrefset
{Undocumented}
webbrowser
Interfaces for launching and remotely controlling Web browsers.
whichdb
Guess which db package to use to open a db file.
wsgiref
a WSGI (PEP 333) Reference Library
xdrlib
Implements (a subset of) Sun XDR -- eXternal Data Representation.
xml
Extended XML support for Python
xmllib
A parser for XML, using the derived class as static DTD.
xmlrpclib
An XML-RPC client interface for Python.
zipfile
Read and write ZIP files.

There are a few entries that are slightly odd, such as robotparser and ast, which are due to the __doc__ property of those modules being formatted differently from the rest, and me being too idle to fix them.

Caveat: the list was generated in Python 2.7 running on Fedora 15, so it's possible my stdlib isn't completely standard.

About this blog

This blog (mostly) covers technology and software development.

Note: I've recently ported the content from my old blog hosted on Google App Engine using some custom code I wrote, to a static site built using Pelican. I've put in place various URL manipulation rules in the webserver config to try to support the old URLs, but it's likely that I've missed some (probably meta ones related to pagination or tagging), so apologies for any 404 errors that you get served.

RSS icon, courtesy of www.feedicons.com RSS feed for this blog

About the author

I'm a software developer who's worked with a variety of platforms and technologies over the past couple of decades, but for the past 7 or so years I've focussed on web development. Whilst I've always nominally been a "full-stack" developer, I feel more attachment to the back-end side of things.

I'm a web developer for a London-based equities exchange. I've worked at organizations such as News Corporation and Google and BATS Global Markets. Projects I've been involved in have been covered in outlets such as The Guardian, The Telegraph, the Financial Times, The Register and TechCrunch.

Twitter | LinkedIn | GitHub | My CV | Mail

Popular tags

Other sites I've built or been involved with

Work

Most of these have changed quite a bit since my involvement in them...

Personal/fun/experimentation