skip to navigation
skip to content

jwp_python_command 1.1.1

Python command creation tools

Downloads ↓

python_command provides modules to facilitate the creation of a Python command. This is primarily used to create contexts for which scripts are to be ran within.

The package is comprised of three modules:

name.jwp.python.command.option
Provides optparse options: -m, -c, --python-context, --pdb-pm
name.jwp.python.command.loader
Provides loaders for, well, loading Python code. The loader interfaces from PEP302 were chosen for working with pkgutil.get_loader. The implementation of this may have been mangled a bit with file_loader and single_loader, but it was the best seemingly standard interface for such a task.
name.jwp.python.command.runtime
Provides the 'execution' class to create the execution context, and an ExtendedConsole class that provides some basic backslash commands to the Python interpreter.

Example:

# The 'jwpython' script is a synonym for: # (yes, lame name) $ python -m name.jwp.python.command.runtime -c 'print "foo"' foo

$ python -m name.jwp.python.command.runtime -m timeit 10000000 loops, best of 3: 0.0252 usec per loop

The recreated implementation of the Python command interface is done for the reason of creating contextual Python commands. While running name.jwp.python.command.runtime is completely redundant, the package provides a means for Python commands to be created with great ease.

The notable use-case is the pb_python command that takes standard PostgreSQL options and runs a Python command with an already established connection set as a builtin. Scripts written to be executed by the command only need to reference that object for database access.

Additionally, the runtime module provides an enhanced Python console and a postmortem option(--pdb-pm or --python-postmortem=pdb.pm)

 
File Type Py Version Uploaded on Size # downloads
jwp_python_command-1.1.1-py2.5.egg (md5) Python Egg 2.5 2008-05-30 28KB 616
jwp_python_command-1.1.1.tar.gz (md5) Source 2008-05-30 11KB 477

Log in to rate this package.