export python functions from files to the command line
Python
Latest commit f09005c Nov 17, 2015 @vascop add coveralls
Permalink
Failed to load latest commit information.
runp some more tests Nov 17, 2015
tests some more tests Nov 17, 2015
.travis.yml add coveralls Nov 17, 2015
MANIFEST.in initial commit Nov 17, 2015
README.rst add coveralls Nov 17, 2015
setup.py initial commit Nov 17, 2015

README.rst

runp

https://coveralls.io/repos/vascop/runp/badge.svg?branch=master&service=github

runp exports Python functions from files to the command line. You don't need to change your existing code.

If you have a file named myfile.py with:

def foo():
    """beeps a lot"""
    print "beep beep"

def bar(text):
    """Prints things

    Args:
        text (str): The text to print
    """
    print text

And you want to run it in the command line just do:

$ runp myfile.py foo
beep beep

You can also pass arguments to your functions:

$ runp myfile.py bar:"this is sweet!"
this is sweet!

Functions with names starting with _ are hidden.

You can list available functions with:

$ runp myfile.py -l
Available functions:
foo    beeps a lot
bar    Prints things

And get info on a specific function:

$ runp myfile.py -d bar
Displaying docstring for function bar in module myfile

bar(text)
    Prints things

    Args:
        text (str): The text to print

Syntax for calling functions is:

$ runp myfile.py function_name:arg1value,arg2=arg2value

The concept, syntax for commands and initial code are heavily inspired by fabric's task system.