Skip to main content

A flexible, intuitive native-python configuration system.

Project description

npconf is a flexible configuration system whose configuration files are plain python modules. The identifiers (left-hand side) are declared by the administrator/developer and are hierarchical. A typical configuration file might be:

myapp.subcomponent.value = 1
myapp.enabled = True

The user needn’t define “myapp”. It’s automatically included in globals().

The administrator/developer can disallow user-defined attributes. This is mostly intended to prevent typos in the configuration files. In other words, if is not defined before reading the configuration files, no file will be allowed to set

The configuration attributes are normally declared by a program before it reads any configuration files. They can be declared at init time:

import npconf

root = npconf.ConfigValue(name='myapp', data={'enabled': 'false'})
# and/or updated after init:
root.update(data={'thing': None})

# to add another level to the hierarchy:

subcomponent = npconf.ConfigValue(
        'foo': 'banana',
root.update({'subcomponent': subcomponent})

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (7.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page