Registry / serialization / bestconfig

bestconfig

JSON →
library1.3.6pypypi✓ verified 89d ago

BestConfig is a Python library for easy project configuration management. It supports loading configuration from YAML, JSON, Python files, environment variables, and CLI arguments. Version 1.3.6 is the latest release.

pip install bestconfig
INSTALL
IMPORT
SIG · BESTCONFIG
B
bestconfig
serializationpythonv1.3.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Config
✓ from bestconfig import Config
✗ from bestconfig import config
The main class is Config with capital C, not lowercase config

Create a Config object; automatically loads from config.yml, config.json, environment variables, and CLI args.

from bestconfig import Config config = Config() print(config.get('key', default='default_value')) print(config.key)
Debug
Known issues
gotchaConfig raises KeyError if accessing a missing key with attribute syntax. Use .get() with a default to avoid exceptions.
fix
Use config.get('missing_key', default='fallback') instead of config.missing_key
affects: all
deprecatedThe method Config.get_config() is deprecated in favor of direct attribute access or .get().
fix
Replace config.get_config('key') with config.key or config.get('key')
affects: >=1.3.0
gotchaEnvironment variable overrides: Prefix env vars with your app name to avoid conflicts. By default, all env vars are loaded.
fix
Set Config(env_prefix='MYAPP_') to only load variables starting with 'MYAPP_'
affects: all
Errors
Common errors & fixes
KeyError: 'key'
Trying to access a config key that does not exist using attribute syntax.
fix
Use config.get('key', default) or check with 'key' in config
AttributeError: 'Config' object has no attribute 'some_key'
Typo or key not loaded (e.g., file not found or env var missing).
fix
Ensure the key exists in your config files or use .get() to avoid AttributeError
FileNotFoundError: [Errno 2] No such file 'config.yml'
Default config file is missing. BestConfig looks for config.yml, config.json, etc.
fix
Create a config.yml or pass a custom path to Config(file='my_config.yml')
Upgrade
Version history
1.3.6latest on PyPI · released Apr 17, 2023
Audit
Dependencies
pyyamloptionalUsed for YAML configuration file support
python-json-loggeroptionalUsed for JSON logging integration
Agent activity
29 hits · last 30 days
node
26
OpenAI (training)
1
Resources
bestconfig — pip install bestconfig · libregistry