distconfig3
raw JSON → 1.0.1 verified Fri May 01 auth: no python
A library for managing configuration using Zookeeper, Etcd, or Consul as backends. Version 1.0.1 is a fork of the original distconfig with Python 2.7 and six/ujson dependencies removed. Release cadence is low; no new commits since 2021.
pip install distconfig3 Common errors
error ImportError: No module named 'etcd' ↓
cause Missing optional dependency for etcd backend.
fix
pip install python-etcd
error AttributeError: module 'collections' has no attribute 'Mapping' ↓
cause Using Python 3.10+ where collections.Mapping is removed; version 1.0.1 fixed this by using collections.abc.
fix
Upgrade to distconfig3>=1.0.1.
Warnings
deprecated The original distconfig library is unmaintained; distconfig3 is a fork that removes Python 2.7 support. No further updates expected. ↓
fix Consider migrating to a more active configuration library if needed.
gotcha Backend classes (e.g., EtcdBackend) are not directly exposed; must use the backend name string. ↓
fix Use backend='etcd' (or 'consul', 'zookeeper') in DistConfig3 constructor.
gotcha Keys in the backend are expected to be under a base_path; if base_path is empty, keys may conflict. ↓
fix Always set a non-empty base_path to avoid collisions.
Imports
- DistConfig3
from distconfig3 import DistConfig3
Quickstart
import os
from distconfig3 import DistConfig3
dc = DistConfig3(
backend='etcd',
host=os.environ.get('ETCD_HOST', 'localhost'),
port=os.environ.get('ETCD_PORT', 2379),
base_path='/myapp'
)
# Assuming the key 'database.url' exists in /myapp
print(dc.get('database.url'))