vendredi 31 août 2018

Inject Configuration into Python Applications

I'm looking for patterns for parameterizing Python applications.

Approaches I can think of are:

  1. pass configuration objects or parameters down deep call hierarchies
  2. have a singleton configuration object (eg. a package that's initialized at application startup)
  3. register configurable parts of the application upon load (import), then call them once the configuration is read
  4. every configurable component parses its own configuration

They all feel weird in one way or another.

The question is: is there a better alternative, what are the pros and cons of these methods, is there a best practice and are there standard implementations that I'm not aware of?

Aucun commentaire:

Enregistrer un commentaire