Cheap Settings
A lightweight, low footprint settings system
cheap-settings is a Python package for providing a very simple, very low impact, configuration. The Python configuration & settings landscape is virtually overflowing with clever, advanced, flexible solutions that cover many needs. However, what I needed was a bit different from any config/settings package that I was aware of.
The main thing that distinguishes cheap_settings from any alternative solutions is simplicity: it is extremely simple (& ergonomic) to use, & it intentionally limits its scope & feature set to be simple to understand.
Additionally, it supports circumstances where it is difficult to bring your config file with you. All of your config is defined in the code or in the environment.
Quick Start
from cheap_settings import CheapSettings
class MySettings(CheapSettings):
host: str = "localhost"
port: int = 8080
debug: bool = False
# Access settings
print(f"Server: {MySettings.host}:{MySettings.port}")
# Override with environment variables
# HOST=production.com PORT=443 DEBUG=true python myapp.py
Environment variables automatically override defaults with proper type conversion.
Installation
pip install cheap-settings
Features
- Simple: Just inherit from
CheapSettingsand define typed attributes - Environment variables: Automatic override with type conversion
- Command line: Optional CLI argument parsing
- Type safe: Full type hints and IDE support
- Inheritance: Settings classes can inherit from each other
- Pickleable: Works with Ray and other frameworks requiring serialization
- Zero dependencies: No external requirements
- Performance: Optional static snapshots for speed-critical code
Why Cheap Settings?
You want to configure something. You don't want to spend time configuring the configuration system. You just want it to work with minimal ceremony.
That's exactly what cheap-settings provides.