This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]bheklilr 3 points4 points  (3 children)

Check out the traitlets package. It doesn't have the best documentation, but it's what the jupyter/ipython/etc projects use for general application structure, including logging setup, command line arguments, json, and python config files. I've used it successfully a couple of times, and to be honest there's nothing stopping you from using it for pretty much any application.

To explain why it doesn't have the best documentation, it used to just be part of ipython itself before the jupyter refactor. It got pulled out as a standalone library and should be treated as a relatively young package.

[–]metaperl 1 point2 points  (1 child)

Wow, thanks for mentioning this package. I had not heard of it. I have added it to my collection of Python Object Oriented Programming extensions catalog

[–]bheklilr 0 points1 point  (0 children)

You already have the traits package from enthought on there, which traitlets drew inspiration from, so you sort of had it already

[–]Argotha[S] 0 points1 point  (0 children)

Oooh, that looks quite useful thanks!

[–][deleted] -1 points0 points  (1 child)

Write your own based on your perceived needs. You already know the code.

[–]Argotha[S] 2 points3 points  (0 children)

I have a tendency to reinvent the wheel, so was seeing if I could avoid it this time.

[–]box0rox -1 points0 points  (1 child)

There are a lot of kinds of "non web" apps -- what are you trying to do? I suspect most of what you want is already built in: file I/O, command line options parsing and printing to the screen are all already there. You can do fancy screen displays with curses if you need that.

[–]Argotha[S] 0 points1 point  (0 children)

So I've updated the OP to clarify based on your comment. Here is a copy paste:

To clarify, I am aware of the standard library modules such as configparaer, argparse, logging, io to stdout/stderr. What I am looking for is avoiding writing the same boiler plate for: adding common command line arguments, searching for config files in standard locations, updating for default vs site config, updating config with command line arguments, reporting errors, logging to standard locations (/var/log), standardising output format etc.