This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A configuration library.

Project Description

profig is a straightforward configuration library for Python.

Motivation

Why another configuration library? The simple answer is that none of the available options give me everything I want, with an API that I enjoy using. This library provides a lot of powerful functionality, but never at the cost of simplicity.

Features

  • Automatic value conversion.
  • Section nesting.
  • Dict-like access.
  • Single-file module with no dependencies.
  • Extensible input/output formats.
  • Built-in support for INI files and the Windows registry.
  • Preserves ordering and comments of INI files.
  • Full Unicode support.
  • Supports Python 2.7+ and 3.2+.

Installation

profig installs using easy_install or pip:

$ pip install profig

Example

Basic usage is cake. Let’s assume our config file looks like this:

[server]
host = 192.168.1.1
port = 9090

First, we specify the defaults and types to expect:

>>> cfg = profig.Config('server.cfg')
>>> cfg.init('server.host', 'localhost')
>>> cfg.init('server.port', 8080)

Then, we sync our current state with the state of the config file:

>>> cfg.sync()

As expected, we can access the updated values without undue effort, either directly:

>>> cfg['server.host']
'192.168.1.1'

Or by section. Notice that the type of the port option is preserved:

>>> server_cfg = cfg.section('server')
>>> server_cfg['port']
9090
Release History

Release History

This version
History Node

0.4.1

History Node

0.4.0

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.9

History Node

0.2.8

History Node

0.2.7

History Node

0.2.6

History Node

0.2.5

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
profig-0.4.1.tar.gz (17.8 kB) Copy SHA256 Checksum SHA256 Source Jan 22, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting