by beetbox

beetbox / confuse

painless YAML config files for Python

254 Stars 40 Forks Last release: Not found MIT License 323 Commits 9 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Confuse: painless YAML config files

.. image:: :target:

.. image:: :target:

Confuse is a configuration library for Python that uses

_. 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

    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

    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

    on Unix; "Application Support" on macOS;
    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

    _ or
    _ from the standard library. Use argparse's declarative API to allow command-line options to override configured defaults.


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


.. code-block:: sh

pip install confuse

Using Confuse

Confuse's documentation
_ describes its API in detail.


Confuse was made to power

. Like beets, it is available under the
MIT license

.. _ConfigParser: .. _YAML: .. _optparse: .. _argparse: .. _logging: .. _Confuse's documentation: .. _MIT license: .. _beets:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.