Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install clue-script

How to install clue_script

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install clue-script
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3.1 Available View build log
0.3 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
Windows (64-bit)
0.3.1 Available View build log
0.3 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
Mac OS X (10.5+)
0.3.1 Available View build log
0.3 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
Linux (32-bit)
0.3.1 Available View build log
0.3 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
Linux (64-bit)
0.3.1 Available View build log
0.3 Available View build log
0.2.4 Available View build log
0.2.3 Available View build log
web
 
Author
License
BSD
Dependencies
Imports
Lastest release
version 0.3.1 on Jul 28th, 2011

Overview

clue_script is used for defining subcommands with a special focus on web-style apps. The functionality is inspired by the Django manage.py script.

Requirements

  • Python 2.6 or 2.7 (not tested with Python 3.x)
runserver support (optional)
  • Paste
  • argparse (if deploying on Python < 2.7)

Usage

A simple example to add a command that prints "hello world":

from clue_script import command, Commander

@command
def helloworld():
    print 'hello world'

if __name__ == '__main__':
    Commander.scan(globals()).run()

To do a more complicated command you can use something similar to Python 2.7's argparse (also available on 2.6).

import argparse
from clue_script import command, Commander

@command
def foo(*argv):
    parser = argparse.ArgumentParser()
    parser.add_argument('-x', help='simple test',
                        default='yes', metavar='x')
    ns = parser.parse_args(argv)
    # do something

if __name__ == '__main__':
    Commander.scan(globals()).run()

Provided Commands

There are currently two provided command factories.

  1. make_reloadable_server_command (see above note about requirements for runserver)
  2. make_syncdb_command

A typical web app could use these commands as follows:

if __name__ == '__main__':
    def createtables(session):
        models.Base.metadata.create_all(session.bind)

    settings = init_settings()
    commander = script.Commander([script.make_reloadable_server_command(make_app),
                                  script.make_syncdb_command(settings['spitter.db_session_factory'],
                                                             createtables)])
    commander.scan(globals())
    commander.run()

Running the script with no args will yield something similar to:

Commands:
    runserver     Run a reloadable development web server.
    syncdb        Update the database.

Credits

  • Developed and maintained by Rocky Burt <rocky AT serverzen DOT com>

Changes

0.3.1 (Jul-27-2011)
  • Fixed silly bug where print_usage() was being called wrong
0.3 (Jul-10-2011)
  • Added rfoo support for launching a shell to connect with live-running server http://code.google.com/p/rfoo/
  • Improved formatting of command usage
  • Removed mostly useless make_syncdb command
  • Made Commander.commands a little more exposed
0.2.4 (Mar-3-2011)
  • Fixed problem where the non-reloader portion would shut down the app if code was changed
0.2.3 (Feb-20-2011)
  • Renamed from Khufu-Script to clue_script
0.2.2 (Feb-16-2011)
  • Updated project urls
0.2.1 (Jan-26-2011)
  • Fixed scan() method to return commander instance
0.2 (Jan-3-2011)
  • first release

Subscribe to package updates

Last updated Jul 28th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.