Skip to main content

Painless YAML configuration.

Project description

https://github.com/beetbox/confuse/workflows/Build/badge.svg?branch=master http://img.shields.io/pypi/v/confuse.svg

Confuse is a configuration library for Python that uses YAML. It takes care of defaults, overrides, type checking, command-line integration, human-readable errors, and standard OS-specific locations.

What It Does

Here’s what Confuse brings to the table:

  • An utterly sensible API resembling dictionary-and-list structures but providing transparent validation without lots of boilerplate code. Type config['num_goats'].get(int) to get the configured number of goats and ensure that it’s an integer.

  • Combine configuration data from multiple sources. Using layering, Confuse allows user-specific configuration to seamlessly override system-wide configuration, which in turn overrides built-in defaults. An in-package config_default.yaml can be used to provide bottom-layer defaults using the same syntax that users will see. A runtime overlay allows the program to programmatically override and add configuration values.

  • Look for configuration files in platform-specific paths. Like $XDG_CONFIG_HOME or ~/.config on Unix; “Application Support” on macOS; %APPDATA% on Windows. Your program gets its own directory, which you can use to store additional data. You can transparently create this directory on demand if, for example, you need to initialize the configuration file on first run. And an environment variable can be used to override the directory’s location.

  • Integration with command-line arguments via argparse or optparse from the standard library. Use argparse’s declarative API to allow command-line options to override configured defaults.

Installation

Confuse is available on PyPI and can be installed using pip:

pip install confuse

Using Confuse

Confuse’s documentation describes its API in detail.

Credits

Confuse was made to power beets. Like beets, it is available under the MIT license.

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

confuse-1.4.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

confuse-1.4.0-py2.py3-none-any.whl (21.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file confuse-1.4.0.tar.gz.

File metadata

  • Download URL: confuse-1.4.0.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.24.0

File hashes

Hashes for confuse-1.4.0.tar.gz
Algorithm Hash digest
SHA256 92fc0451c6e2c2732ac363d0f59d7ea608abddbed062dda8e98e9a8c986ce464
MD5 b9fc4c5bbbbb2d563cfca33fef0e54e7
BLAKE2b-256 4bce172ed195a71fe9a02c01f96ee042b999477bf4e6eb142bc3a33366e65b4d

See more details on using hashes here.

File details

Details for the file confuse-1.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: confuse-1.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.24.0

File hashes

Hashes for confuse-1.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2346b9c8f8c5aece8342e2eb07be9a09b78ca82c40736ec64272e5613580100c
MD5 8b4f647c7bb2880a460a35a90c1a64a0
BLAKE2b-256 6d55b4726d81e5d6509fa3441f770f8a9524612627dc1b2a7d6209d1d20083fe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page