Skip to main content

Confuse: painless YAML config files

https://github.com/beetbox/confuse/actions/workflows/main.yml/badge.svg https://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, environment variable support, 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.

  • Include configuration values from environment variables. Values undergo automatic type conversion, and nested dicts and lists are supported.

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.

Metadata

Release files for confuse 2.3.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 confuse 2.3.1
File Size Uploaded Provenance Actions
confuse-2.3.1.tar.gz 7.9 MB With provenance Details for confuse-2.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for confuse 2.3.1
File Interpreter ABI Platform Actions
confuse-2.3.1-py3-none-any.whl Python 3 none any Details for confuse-2.3.1-py3-none-any.whl

Total release size: 8.0 MB

Release files / confuse-2.3.1.tar.gz

Download URL confuse-2.3.1.tar.gz
Size 7.9 MB
Tags Source
SHA-256 checksum
How to use checksums
b51cd33c36319cf8ab4bade81d16df3e7135af01ffa3f51a60e131b9d5156cd3
BLAKE2b-256 checksum
How to use checksums
036ae5d29ede8bbeceee09be1f23659ca321d0bd1c1b4449063a709e97bc3d38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / confuse-2.3.1-py3-none-any.whl

Download URL confuse-2.3.1-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad1372537f880de14a27c44b7ddace00f33fe435a2ee9c18693a34dedba86afe
BLAKE2b-256 checksum
How to use checksums
fed6ceef2352759a3bebb81117bd7b4a495c1765d6f2c76e3d48ac74a21b673d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for confuse 2.3.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for confuse-2.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

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