pecan.configuration – Pecan Configuration Engine

The pecan.configuration module provides an implementation of a Python-based configuration engine for Pecan applications.

class pecan.configuration.Config(conf_dict={}, filename='')

Bases: object

Base class for Pecan configurations.

Create a Pecan configuration object from a dictionary or a filename.

  • conf_dict – A python dictionary to use for the configuration.
  • filename – A filename to use for the configuration.

Converts recursively the Config object into a valid dictionary.

Parameters:prefix – A string to optionally prefix all key elements in the returned dictonary.

Updates this configuration with a dictionary.

Parameters:conf_dict – A python dictionary to update this configuration with.
class pecan.configuration.ConfigDict

Bases: dict


Creates a configuration dictionary from a dictionary.

Parameters:conf_dict – The configuration dictionary.

Creates a configuration dictionary from a file.

Parameters:filepath – The path to the file.

If the PECAN_CONFIG environment variable exists and it points to a valid path it will return that, otherwise it will raise a RuntimeError.


Initializes the default configuration and exposes it at pecan.configuration.conf, which is also exposed at pecan.conf.

pecan.configuration.set_config(config, overwrite=False)

Updates the global configuration.

Parameters:config – Can be a dictionary containing configuration, or a string which represents a (relative) configuration filename.