When to use horetu

I intend for horetu to work for Python in general, so it is easier to explain when it won’t work.

Apathy regarding interface details

Horetu is only good if you are okay with whatever interface that you get. It is fine for stuff where the interface is secondary, but it is bad if the main novelty is the interface, as you would probably want more control than horetu provides. For example, if you want to design keyboard shortcuts to make interactions with your interface very fast, you are probably better off not using horetu.

Hobby projects

I originally designed horetu for my own projects. Since I really like to sleep, I made it very easy to configure user interfaces in horetu, because this way I don’t have to remember how my software works, and I can spend more time sleeping. Horetu is good for hobby projects.

I think horetu would not be appropriate for work, based on my experience, because it is too reliable and easy. If you use horetu at work, your colleagues may think that you are not doing any work, because you won’t be doing any work: You will probably finish writing the user interface very quickly, and it will probably work very reliably.

If you need to write a Python interface for a job, you should use something more complicated so you are stressed out all the time. This way, your bosses/clients will feel like you are a good slave; everyone will think that your product is very sophistocated; and you will feel like you are challenging yourself.

Available interfaces

Only command line, Django management command, IRC bot, configuration file, and and web interfaces are available now.

Feel free to suggest other things, though; I am considering gtk and urwid.

Python version

horetu requires Python 3.3 or higher for inspect.signature(). If you want something similar that works in an old Python version, see Similar modules.

Alternatives for command-line interfaces

Here are some other approaches producing command-line argument parsers.

Low-level

At the lowest level, you can look at the value of sys.argv and parse them however you want. These are always a list of str elements.

Standard parser modules

Python comes with a few standard libraries for building command-line argument parsers.

Other modules

There are also several third-party interface creators and command-line argument parsers.

These have nice syntax for subcommands.

These are more complicated

Here’s a fuller list.

  • opterator
  • CLIArgs
  • commandline
  • cmd2
  • argh
  • aaargh
  • opster
  • clint
  • click
  • docopt
  • cliff
  • clap
  • cement
  • all of the standard command-line parsing modules

References

Similar modules

After writing horetu, I discovered plac, argh, and fire, which work similarly to :py:func:horetu.cli. All of these work in Python 2, and the main reason to use one of these instead of horetu is to support Python 2. If you are using Python 3.3 or higher, you should probably use horetu as it is mostly better.

But plac has some other features that horetu doesn’t, so you should consider using plac if you want these features.

  • Does not depend on docstring
  • Processes variable keyword arguments (**kwargs)
  • Can create interactive programs
  • Has some helpers for parallel processing
  • Supports socket interfaces in addition to command-line interfaces

These are also very similar to horetu but and lack features.