Monthly Archives: November 2014

Handling configurations in Python

After years of trying different strategies for handling configurations in python, I’ve finally settled on a solution which ticks all my boxes. This:

  • allows both file and command-line arguments
  • is based on existing formats (json or yaml)
  • is easy to document (both in the config file, and in the module’s doctstring)
  • makes use of the awesome docopt
  • allows nested configurations
  • allows reference to environment variables
  • allows reference to variables elsewhere in the config file

Check it out here