Introduction

horetu exposes Python functions through several styles of user interfaces. The main principle behind horetu is that horetu should figures out a decent user interface based on standard Python function annotations and properties.

Install

Install from PyPI.

pip install 'horetu[all]'

Strategy for using/learning horetu

Since horetu is supposed to figure out a reasonable interface with little special configuration, you should focus first on writing conventional Python functions. Consider horetu’s special features only after your program is mostly ready.

First step

If you have not used horetu very much before, I suggest that you start by writing a function that expects str inputs and returns anything. anything or nothing, and then call one of the following functions with your function as an argument.

Some of these functions will do nothing or produce an error because you have not specified their arguments properly; if that happens, look at the function’s documentation in the Interfaces or in the Python interpreter (with help(horetu.django), for example).

Here is an example.

import horetu
def the_function(string_input):
    return string_input.split(',')
horetu.cli(the_function)

If that mostly works for you, you can just stop here.

Further reading

If you want to change something or understand how this works, here is what you should read next.

Here is the full table of contents of the documentation.

Examples

For general ideas of how to use horetu, look at some examples.

Here are some short, mostly contrived, examples.

And here are some examples from programs that I actually use.

Note that many of these examples require old versions of horetu. If an example specifies, for example, version 0.3.1, then version 0.3.2 should work, but versions 0.2.1 and 0.4.0 will probably not work.

Name

Tom occasionaly bangs arbitrarily on a Dvorak keyboard in search of inspiration. One day, Horetus, the god of configuration option parsing, spoke to Tom and told him to make a module that would automatically assemble a command-line interface for specified Python functions.

After Tom implemented this command-line interface, Horetus spoke again to Tom, this time through q3k in Warsaw Hackerspace. Tom then extended horetu so it would produce a configuration file parser as well.

This sort of unanticipated extension of existing software is why Tom is wary of descriptive names for software.