Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

command line python app and frameworks

I'm going to be writing a fairly sophisticated command line app in python. I'd like to leverage something other than just pure python, maybe a framework or something that makes the services and code management within the app easier. I guess in my mind, I'm thinking MVC, as the app will have several different commands (controllers) which call different sources for data (JSON requests, REST requests, etc., e.g. the "Models" in MVC), and then display results in different formats (the View).

I think MVC works well for this, but I'm not really doing a web app. I want something that doesn't necessarily require a web server, but has the advantages of a framework to force some coding standards.

Does anyone have any tips or suggestions? I know I could build something from scratch with Python, but I'm just curious if there's something else out there I could utilize.

Thanks, Dustin

like image 336
dustin999 Avatar asked Oct 12 '11 17:10

dustin999


People also ask

What are command line apps?

Command Line Applications (aka CLI applications or simply CLIs - for Command Line Interface) are programs that you interact with entirely through your terminal and shell. They have no graphics or visual interface beyond what you see in your terminal after you run the program.

Is Python good for CLI?

Python is usually regarded as a glue code language, because of it's flexibility and works well with existing programs. Most Python codes are written as scripts and command-line interfaces (CLI).


1 Answers

This is a bit late, however posting for anyone else who stumbles across this:

Cement is an Advanced CLI Application Framework for Python. Getting started is easy, and it is extremely flexible for customizing almost every piece of it from logging to config file parsing. Cement2 (code name portland) is currently in beta, but is very close to a stable release:

http://cement.readthedocs.org/en/portland/

Additionally, if you are creating a REST command line client, also checkout dRest:

http://drest.readthedocs.org/en/latest/

It too is very easy to get started with, and is also extremely flexible for customization from the request handler, to how serialization happens on both the sending and receiving ends.

I'd be happy to answer any questions about either.

like image 71
derks Avatar answered Sep 21 '22 11:09

derks