Useful packages and modules to extend the Python standard library.
The PLIB.STDLIB package contains a number of useful packages and modules that extend the Python standard library.
Note: PLIB.STDLIB works with Python 2.7. If you are using Python 3, see the PLIB3.STDLIB package, available at https://pypi.python.org/pypi/plib3.stdlib.
The setup.py script for PLIB.STDLIB uses the setuputils helper module, which helps to automate away much of the boilerplate in Python setup scripts. This module is available as a separate release at https://pypi.python.org/pypi/setuputils.
The PLIB.STDLIB Packages and Modules
The following modules or sub-packages are available in the plib.stdlib namespace:
- The builtins module contains some funtions that should be Python builtins, but aren’t. :) Importing the module adds those functions to the built-in namespace; this is mostly useful for interactive shells. The functions can also be imported directly from plib.stdlib.builtins, to make it easier to understand where the functions are coming from in module code.
- The classes sub-package provides some miscellaneous useful classes.
- The classtools module provides some utilities for working with classes and class attributes.
- The cmdline module provides utilities useful for command line programs and interactive shells.
- The coll sub-package provides various collection classes, including abstract collections built on the collections ABCs from the standard library.
- The comm sub-package provides utilities for managing and communicating with child threads and processes.
- The decotools module provides functions and factories for working with decorators.
- The extensions sub-package provides a namespace for functions (and possibly, in the future, other objects) exported from an extension module written using the Python/C API. The general philosophy of PLIB is to do everything possible in pure Python, so the only functions that appear in this sub-package are those which by their very nature cannot be done in pure Python.
- The fdtools module provides utilities for working with file descriptors.
- The imp module provides the import_from_module function, which should be in the standard library importlib module but isn’t. :)
- The ini sub-package implements an abstract ‘INI file’ API that uses ConfigParser on POSIX systems, and the Windows registry on Windows systems. This API allows the configuration file structure to be declared using Python lists and dicts.
- The iters module provides various functions dealing with or returning iterables.
- The localize module provides useful functions for getting locale-specific information.
- The mail module provides a useful shortcut function for sending email from programs.
- The mathlib module provides some additional math functions to supplement those in the standard library.
- The net module provides utilities for getting information about networks.
- The options module provides an easier-to-use overlay for the argparse module which allows you to express your option configuration in the form of Python lists, tuples, and dicts.
- The ostools module provides utilities for working with the operating system.
- The postinstall module provides utilities for use by post-install scripts.
- The proc module provides a shortcut function for getting the output of a subprocess.
- The sigtools module provides a low-level implementation of the self-pipe trick for signal handling.
- The strings module provides functions and constants for working with strings.
- The systools module exposes some useful variables giving information about the Python runtime system and PLIB itself.
- The timer module provides functions for timing code, with an alternate API to the standard library’s timeit module that is easier to use when timing functions that you already have as objects, instead of source code strings.
- The tztools module provides some useful tzinfo subclasses based on those in the Python docs for the datetime module, and a function to return the local system timezone name.
- The util sub-package provides the ModuleProxy class, which is used by a number of PLIB sub-packages. See the docstrings for the class and the sub-packages using it for more information.
To install PLIB.STDLIB, you can simply run:
$ python setup.py install
at a shell prompt from the directory into which you unzipped the source tarball (the same directory that this README file is in). This will install PLIB and then run each of the post-install scripts in the scripts directory.