Skip to main content

Configuration utility to ease navigation of local and system configurations

Installation

From the project root directory:

$ python setup.py install

Or install with pip:

$ pip install confutil

Usage

Example:

from confutil import Config
conf = Config('spam')
password = conf['password']

That will pull the first password value from a search through this sequence:

  • ./.spam.conf

  • ./.spam.cfg

  • ~/.spam.conf

  • ~/.spam.cfg

  • ~/.config/.spam.conf

  • ~/.config/.spam.cfg

  • ~/.config/spam/config.conf

  • ~/.config/spam/config.cfg

  • ~/.config/spam/config

  • /etc/.spam.conf

  • /etc/.spam.cfg

  • /etc/spam/config.conf

  • /etc/spam/config.cfg

  • /etc/spam/config

To write out a loaded configuration:

from confutil import Config
c = Config('myapp')
c.write('output_path.cfg')

To print a derived configuration from the current directory, run:

$ confutil $PROJECT_NAME

To output it to a new file, run:

$ confutil $PROJECT_NAME -o output_path.cfg

Release Notes

0.1.3:

Add get_in(key) and get_as(key, type=str)

0.0.1:

Project created

Metadata

Release files for confutil 0.1.4

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

Source distribution (sdist)

Source distribution for confutil 0.1.4
File Size Uploaded
confutil-0.1.4.tar.gz 5.4 kB Details

Release files / confutil-0.1.4.tar.gz

Download URL confutil-0.1.4.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
65849a582468464bec64104cd4f893e8def20cd4dca114a84c9b228a73ecf3b0
BLAKE2b-256 checksum
How to use checksums
d77f92ae734a9b2f893958b0ea05c2179e948e7b98d0234073a20b1634ba1dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.1

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