Skip to main content

getconf

The getconf project provides simple configuration helpers for Python project.

It aims at unifying configuration setup across development and production systems, respecting the standard procedures in each system:

  • Allow userspace configuration on development systems

  • Allow multiple different configurations for continuous integration systems

  • Use standard configuration space in /etc on traditional production servers

  • Handle environment-based configuration for cloud-based platforms

getconf supports Python 2.6, 2.7, 3.3, and is distributed under the two-clause BSD licence.

Installation

Intall the package from PyPI, using pip:

pip install getconf

Or from GitHub:

$ git clone git://github.com/Polyconseil/getconf

Introduction

All configuration values are accessed through getconf.ConfigGetter object:

import getconf
config = getconf.ConfigGetter('fubar', '/etc/fubar/settings.ini', './local_settings.ini')

The above line declares:

  • Use the fubar namespace (mostly used for environment-based configuration, as a prefix for environment variables)

  • Look, in turn, at /etc/fubar/settings.ini (for produciton) and ./local_settings.ini (for development)

Once the getconf.ConfigGetter has been configured, it can be used to retrieve settings:

debug = config.getbool('debug', False)
db_host = config.get('db.host')
db_port = config.getint('db.port', 5432)
allowed_hosts = config.getlist('django.allowed_hosts', ['*'])

All settings have a type (default is text), and accept a default value. They use namespaces for easier reading.

With the above setup, getconf will try to provide db.host by inspecting the following options in order (it stops at the first defined value):

  • From the environment variable FUBAR_DB_HOST, if defined

  • If a FUBAR_CONFIG environment variable is defined, from the host key of the [db] section of that file

  • From the host key in the [db] section of ./local_settings.ini

  • From the host key in the [db] section of /etc/fubar/settings.ini

  • From the default provided value

Metadata

Release files for getconf 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for getconf 1.0.0
File Size Uploaded
getconf-1.0.0.tar.gz 12.0 kB Details

Release files / getconf-1.0.0.tar.gz

Download URL getconf-1.0.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8617777fa5b76ec055d409c9ab7d9e355e44bd277f56a0e7f47f118236ebd6fd
BLAKE2b-256 checksum
How to use checksums
15512d47f2d887bb3c9bdcf21c5a0205b114796473d97d7d3deeb9b6d548ed8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.11.1

2 release files

1.11.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.2

1 release file

1.4.1

2 release files

1.4.0

2 release files

1.3.0

1 release file

1.2.1

1 release file

1.1.0

1 release file

1.0.1

1 release file

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page