Cement2, Python CLI framework nears beta

Wynn Netherland Wynn Netherland

Cement2, the next version of the Python application framework is almost ready for a beta release. I love Command Line Interfaces, and Cement2 is a slick way to create a CLI in Python. The canonical Hello World CLI is just five lines:

from cement2.core import foundation
app = foundation.lay_cement('helloworld')
print('Hello World')

With the single call to lay_cement, this Python script is a full-fledged CLI complete with usage and help information:

$ python helloworld.py --help
usage: helloworld.py [-h] [--debug] [--quiet]

optional arguments:
  -h, --help  show this help message and exit
  --debug     toggle debug output
  --quiet     suppress all output

I especially like how Cement separates interfaces and handlers, allowing for swappable implementations of features based on command line arguments. There is also a robust plugin architecture for those that want to extend it. Be sure and check out the Portland branch for the source as Cement2 is still under active development.

0:00 / 0:00