All Projects → rochacbruno → Dynaconf

rochacbruno / Dynaconf

Licence: mit
Configuration Management for Python ⚙

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Dynaconf

climatecontrol
Python library for loading settings and config data from files and environment variables
Stars: ✭ 20 (-99.04%)
Mutual labels:  config, yaml, settings, configuration, environment-variables, configuration-management, app-config, environment-configuration, 12factorapp
sitri
Sitri - powerful settings & configs for python
Stars: ✭ 20 (-99.04%)
Mutual labels:  config, vault, configuration, environment-variables, configuration-management, app-config
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (-95.87%)
Mutual labels:  config, yaml, configuration, environment-variables, configuration-management
Simple Settings
A simple way to manage your project settings.
Stars: ✭ 165 (-92.07%)
Mutual labels:  config, configuration-management, settings, configuration, yaml
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (-59.85%)
Mutual labels:  config, configuration-management, configuration, yaml
Fig
A minimalist Go configuration library
Stars: ✭ 142 (-93.18%)
Mutual labels:  configuration-management, environment-variables, configuration, yaml
Node Convict
Featureful configuration management library for Node.js
Stars: ✭ 1,855 (-10.9%)
Mutual labels:  config, configuration-management, environment-variables, configuration
cfg-rs
A Configuration Library for Rust Applications
Stars: ✭ 18 (-99.14%)
Mutual labels:  config, yaml, settings, configuration
superconfig
Access environment variables. Also includes presence validation, type coercion and default values.
Stars: ✭ 33 (-98.41%)
Mutual labels:  config, configuration, environment-variables, configuration-management
goodconf
Transparently load variables from environment or JSON/YAML file.
Stars: ✭ 80 (-96.16%)
Mutual labels:  config, yaml, configuration, environment-variables
Koanf
Light weight, extensible configuration management library for Go. Built in support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.
Stars: ✭ 450 (-78.39%)
Mutual labels:  config, configuration-management, configuration, yaml
Ohai
Ohai profiles your system and emits JSON
Stars: ✭ 641 (-69.21%)
Mutual labels:  hacktoberfest, configuration-management, configuration
Gomplate
A flexible commandline tool for template rendering. Supports lots of local and remote datasources.
Stars: ✭ 1,270 (-39%)
Mutual labels:  hacktoberfest, config, vault
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (-69.12%)
Mutual labels:  config, configuration-management, configuration
Environs
simplified environment variable parsing
Stars: ✭ 631 (-69.69%)
Mutual labels:  hacktoberfest, environment-variables, configuration
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (-63.54%)
Mutual labels:  config, configuration, yaml
Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (-56.05%)
Mutual labels:  config, configuration-management, configuration
Mconfig
MCONFIG is a lightweight Golang library for integrating configs files like (json, yml, toml) and environment variables into one config struct.
Stars: ✭ 28 (-98.66%)
Mutual labels:  config, environment-variables, yaml
Night Config
Powerful java configuration library for toml, yaml, hocon, json and in-memory configurations
Stars: ✭ 93 (-95.53%)
Mutual labels:  configuration-management, configuration, yaml
Konfig
Composable, observable and performant config handling for Go for the distributed processing era
Stars: ✭ 597 (-71.33%)
Mutual labels:  config, vault, configuration

dynaconf. new logo

dynaconf - Configuration Management for Python.

MIT License PyPI PyPI PyPI - Downloads CI codecov Codacy Badge GitHub issues GitHub stars GitHub Release Date GitHub commits since latest release GitHub last commit Code Style Black Discussion Discussion

Foo

Features

  • Inspired by the 12-factor application guide
  • Settings management (default values, validation, parsing, templating)
  • Protection of sensitive information (passwords/tokens)
  • Multiple file formats toml|yaml|json|ini|py and also customizable loaders.
  • Full support for environment variables to override existing settings (dotenv support included).
  • Optional layered system for multi environments [default, development, testing, production]
  • Built-in support for Hashicorp Vault and Redis as settings and secrets storage.
  • Built-in extensions for Django and Flask web frameworks.
  • CLI for common operations such as init, list, write, validate, export.
  • full docs on https://dynaconf.com

Quick start

DEMO: You can see a working demo here: https://github.com/rochacbruno/learndynaconf

Install

$ pip install dynaconf

Initialize Dynaconf on project root directory

$ cd path/to/your/project/

$ dynaconf init -f toml

⚙️  Configuring your Dynaconf environment
------------------------------------------
🐍 The file `config.py` was generated.

🎛️  settings.toml created to hold your settings.

🔑 .secrets.toml created to hold your secrets.

🙈 the .secrets.* is also included in `.gitignore`
  beware to not push your secrets to a public repo.

🎉 Dynaconf is configured! read more on https://dynaconf.com

TIP: You can select toml|yaml|json|ini|py on dynaconf init -f <fileformat> toml is the default and also the most recommended format for configuration.

Dynaconf init creates the following files

.
├── config.py       # This is from where you import your settings object (required)
├── .secrets.toml   # This is to hold sensitive data like passwords and tokens (optional)
└── settings.toml   # This is to hold your application setttings (optional)

On the file config.py Dynaconf init generates the following boilerpate

from dynaconf import Dynaconf

settings = Dynaconf(
    envvar_prefix="DYNACONF",  # export envvars with `export DYNACONF_FOO=bar`.
    settings_files=['settings.yaml', '.secrets.yaml'],  # Load files in the given order.
)

TIP: You can create the files yourself instead of using the init command as shown above and you can give any name you want instead of the default config.py (the file must be in your importable python path) - See more options that you can pass to Dynaconf class initializer on https://dynaconf.com

Using Dynaconf

Put your settings on settings.{toml|yaml|ini|json|py}

username = "admin"
port = 5555
database = {name='mydb', schema='main'}

Put sensitive information on .secrets.{toml|yaml|ini|json|py}

password = "secret123"

IMPORTANT: dynaconf init command puts the .secrets.* in your .gitignore to avoid it to be exposed on public repos but it is your responsibility to keep it safe in your local environment, also the recommendation for production environments is to use the built-in support for Hashicorp Vault service for password and tokens.

Optionally you can now use environment variables to override values per execution or per environment.

# override `port` from settings.toml file and automatically casts as `int` value.
export DYNACONF_PORT=9900

On your code import the settings object

from path.to.project.config import settings

# Reading the settings

settings.username == "admin"  # dot notation with multi nesting support
settings.PORT == 9900  # case insensitive
settings['password'] == "secret123"  # dict like access
settings.get("nonexisting", "default value")  # Default values just like a dict
settings.databases.name == "mydb"  # Nested key traversing
settings['databases.schema'] == "main"  # Nested key traversing

More

  • Settings Schema Validation
  • Custom Settings Loaders
  • Vault Services
  • Template substitutions
  • etc...

There is a lot more you can do, read the docs: http://dynaconf.com

Contribute

Main discussions happens on Discussions Tab learn more about how to get involved on CONTRIBUTING.md guide

More

If you are looking for something similar to Dynaconf to use in your Rust projects: https://github.com/rubik/hydroconf

And a special thanks to Caneco for the logo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].