Skip to main content

Concrete Settings facilitates configuration management in big and small projects.

Project description

https://travis-ci.org/BasicWolf/concrete-settings.svg?branch=master https://basicwolf.github.io/concrete-settings/_static/img/codestyle_black.svg https://basicwolf.github.io/concrete-settings/_static/img/mypy_checked.svg

Welcome to Concrete Settings

Concrete Settings is a Python library which facilitates configuration management in big and small projects.

The library was born out of necessity to manage a huge decade-old Django-based SaaS solution with more than two hundred different application settings scattered around settings.py. What does this setting do? What type is it? Why does it have such a weird format? Is this the final value, or it changes somewhere on the way? Sometimes developers spent hours seeking answers to these questions.

Concrete Settigns tackles these problems altogether. It was designed to be developer and end-user friendly. The settings are defined via normal Python code with few tricks which significantly improve readability and maintainability.

Take a look at a small example of Settings class with one boolean setting DEBUG. A developer defines the settings in application code, while an end-user chooses to store the configuration in a YAML file:

# settings.py

from concrete_settings import Settings

class AppSettings(Settings):

    #: Turns debug mode on/off
    DEBUG: bool = False


app_settings = AppSettings()
app_settings.update('/path/to/user/settings.yml')
app_settings.is_valid(raise_exception=True)
# settings.yml

DEBUG: true

Accessing settings:

>>>  print(app_settings.DEBUG)
True

>>> print(AppSettings.DEBUG.__doc__)
Turns debug mode on/off

As you can see, settings are defined in classes. Python mechanism of inheritance and nesting apply here, so settings can be mixed (multiple inheritance) and be nested (settings as class fields). Settings are type-annotated and are validated. Documentation matters! Each settings can be documented in Sphinx-style comments #: written above its definition. An instance of Settings can be updated i.e. read from any kind of source: YAML, JSON or Python files, environmental variables, Python dicts, and you can add more!

Finally, Concrete Settings comes with batteries like Django 3.0 support out of the box.

Concrete Settings are here to improve configuration handling whether you are starting from scratch, or dealing with an old legacy Cthulhu. Are you ready to try it out?

pip install concrete-settings and welcome to the documentation!

Awesome configuration projects

Concrete Settings is not the first and surely is not the last library to handle configuration in Python projects.

  • goodconf - Define configuration variables and load them from environment or JSON/YAML file. Also generates initial configuration files and documentation for your defined configuration.

  • profig - is a straightforward configuration library for Python. Its objective is to make the most common tasks of configuration handling as simple as possible.

  • everett - is a Python configuration library with the following goals: flexible configuration from multiple configured environments; easy testing with configuration and easy documentation of configuration for users.

  • python-decouple - strict separation of settings from code. Decouple helps you to organize your settings so that you can change parameters without having to redeploy your app.

Why should you trust Concrete Settings instead of picking some other library? Concrete Settings tries to make configuration definition, processing and maintenance smooth and transparent for developers. Its implicit definition syntax eliminates extra code and allows you to focus on what is important.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

concrete-settings-0.0.5.tar.gz (25.8 kB view hashes)

Uploaded Source

Built Distribution

concrete_settings-0.0.5-py3-none-any.whl (31.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page