Lastest release
Background
Phyles is a set of somewhat eclectic functions that makes the implementation of utilities (little programs that can be controlled by config files) easier. It started as a mass of boilerplate that I would copy into almost every utility I wrote. I finally decided to consolidate this code into a package and add some schema-based validation of config files and to document it fully.
Features
Phyles provides support for YAML-based config files as well as a means for validating the config files. Phyles also provides several facilities for making utilities more user friendly, including automatically generated banners, automatically documented configuration templates, and graceful recovery from configuration errors.
Home Page & Repository
The phyles home page is http://phyles.bravais.net, and the source code is maintained at github: https://github.com/jcstroud/phyles.
Example
About 90% of the convenience that phyles offers can be summarized by a few lines of code. From the example utility in the tutorial (http://pythonhosted.org/phyles):
These few lines find a schema specification from the package contents (line 1), parses command line arguments (line 3), validates a config file (lines 2 & 3), overrides configuration settings therein (line 3), and runs the main function of the utility in a try-except block that ensures graceful exit in the event that an anticipated exception is raised (line 4).
Schema are specified in YAML, terse, and hopefully intuitive. Following is the example from the tutorial:
Phyles will automatically generate a documented sample config files for users if they run the utility with the --template (or -t) command line option. In the tutorial, calling the example script (barbecue-time) with:
barbecue_time -t
produces the following output, which is valid for the above schema:
As one final example, another valid config file for this schema is: