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.

Release files for confuse 2.3.0

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.0
File Size Uploaded
confuse-2.3.0.tar.gz 7.9 MB Details

Built distribution (wheel)

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

Total release size: 8.0 MB

Release files / confuse-2.3.0.tar.gz

Download URL confuse-2.3.0.tar.gz
Size 7.9 MB
Tags Source
SHA-256 checksum
How to use checksums
66123bd4b38dec9ae36dd9407a090fd764245fd717cbaa986a68e3a05056920e
BLAKE2b-256 checksum
How to use checksums
4189d4451e170e9c02dd981cfd517b051658aa4d5a53060e57808bec63cf785b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

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

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 Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.3.0 This release

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

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