Skip to main content

Overview

profig is a straightforward configuration library for Python.

https://travis-ci.org/dhagrow/profig.svg?branch=master

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

Resources

Metadata

Release files for profig 0.5.1

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

Source distribution (sdist)

Source distribution for profig 0.5.1
File Size Uploaded Provenance Actions
profig-0.5.1.tar.gz 17.9 kB Without provenance Details for profig-0.5.1.tar.gz

Release files / profig-0.5.1.tar.gz

Download URL profig-0.5.1.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cb9c094325a93505fc6325d13f3e679b281093223f143a96a6df8ad9c2bfc9a6
BLAKE2b-256 checksum
How to use checksums
c581a14c49aee6202242fa95f8b3a9b1b12089ffcce939b2bdf36dd240e09bfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Security for profig 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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