dynaconf


Namedynaconf JSON
Version 3.2.5 PyPI version JSON
download
home_pagehttps://github.com/dynaconf/dynaconf
SummaryThe dynamic configurator for your Python Project
upload_time2024-03-18 20:29:02
maintainer
docs_urlNone
authorBruno Rocha
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <!-- [![Dynaconf](docs/img/logo_400.svg?sanitize=true)](http://dynaconf.com) -->

<p align="center"><img src="/art/header.png?v2" alt="dynaconf. new logo"></p>

> **dynaconf** - Configuration Management for Python.

[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square)](/LICENSE) [![PyPI](https://img.shields.io/pypi/v/dynaconf.svg)](https://pypi.python.org/pypi/dynaconf) [![PyPI](https://img.shields.io/pypi/pyversions/dynaconf.svg)]() ![PyPI - Downloads](https://img.shields.io/pypi/dm/dynaconf.svg?label=pip%20installs&logo=python) [![CI](https://github.com/dynaconf/dynaconf/actions/workflows/main.yml/badge.svg)](https://github.com/dynaconf/dynaconf/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/dynaconf/dynaconf/branch/master/graph/badge.svg)](https://codecov.io/gh/dynaconf/dynaconf) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/3fb2de98464442f99a7663181803b400)](https://www.codacy.com/gh/dynaconf/dynaconf/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=dynaconf/dynaconf&amp;utm_campaign=Badge_Grade)  ![GitHub stars](https://img.shields.io/github/stars/dynaconf/dynaconf.svg) ![GitHub Release Date](https://img.shields.io/github/release-date/dynaconf/dynaconf.svg) ![GitHub commits since latest release](https://img.shields.io/github/commits-since/dynaconf/dynaconf/latest.svg) ![GitHub last commit](https://img.shields.io/github/last-commit/dynaconf/dynaconf.svg) [![Code Style Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black/)

![GitHub issues](https://img.shields.io/github/issues/dynaconf/dynaconf.svg) [![User Forum](https://img.shields.io/badge/users-forum-blue.svg?logo=googlechat)](https://github.com/dynaconf/dynaconf/discussions) [![Join the chat at https://gitter.im/dynaconf/dev](https://badges.gitter.im/dynaconf/dev.svg)](https://gitter.im/dynaconf/dev?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![ Matrix](https://img.shields.io/badge/dev-room-blue.svg?logo=matrix)](https://matrix.to/#/#dynaconf:matrix.org)

## Features

- Inspired by the [12-factor application guide](https://12factor.net/config)
- 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

### Install

```bash
$ pip install dynaconf
```

#### Initialize Dynaconf on project root directory

```plain
$ 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

```plain
.
├── 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 settings (optional)
```

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

```py
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}`

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

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

```toml
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.

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


On your code import the `settings` object

```py
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](https://github.com/dynaconf/dynaconf/discussions) learn more about how to get involved on [CONTRIBUTING.md guide](CONTRIBUTING.md)

## 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](https://twitter.com/caneco) for the logo.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dynaconf/dynaconf",
    "name": "dynaconf",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Bruno Rocha",
    "author_email": "rochacbruno@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3b/1f/577263ba18254578b7235b2b1ea55e1a62ca537d3acfc3033e93a9631759/dynaconf-3.2.5.tar.gz",
    "platform": "any",
    "description": "<!-- [![Dynaconf](docs/img/logo_400.svg?sanitize=true)](http://dynaconf.com) -->\n\n<p align=\"center\"><img src=\"/art/header.png?v2\" alt=\"dynaconf. new logo\"></p>\n\n> **dynaconf** - Configuration Management for Python.\n\n[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square)](/LICENSE) [![PyPI](https://img.shields.io/pypi/v/dynaconf.svg)](https://pypi.python.org/pypi/dynaconf) [![PyPI](https://img.shields.io/pypi/pyversions/dynaconf.svg)]() ![PyPI - Downloads](https://img.shields.io/pypi/dm/dynaconf.svg?label=pip%20installs&logo=python) [![CI](https://github.com/dynaconf/dynaconf/actions/workflows/main.yml/badge.svg)](https://github.com/dynaconf/dynaconf/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/dynaconf/dynaconf/branch/master/graph/badge.svg)](https://codecov.io/gh/dynaconf/dynaconf) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/3fb2de98464442f99a7663181803b400)](https://www.codacy.com/gh/dynaconf/dynaconf/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=dynaconf/dynaconf&amp;utm_campaign=Badge_Grade)  ![GitHub stars](https://img.shields.io/github/stars/dynaconf/dynaconf.svg) ![GitHub Release Date](https://img.shields.io/github/release-date/dynaconf/dynaconf.svg) ![GitHub commits since latest release](https://img.shields.io/github/commits-since/dynaconf/dynaconf/latest.svg) ![GitHub last commit](https://img.shields.io/github/last-commit/dynaconf/dynaconf.svg) [![Code Style Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black/)\n\n![GitHub issues](https://img.shields.io/github/issues/dynaconf/dynaconf.svg) [![User Forum](https://img.shields.io/badge/users-forum-blue.svg?logo=googlechat)](https://github.com/dynaconf/dynaconf/discussions) [![Join the chat at https://gitter.im/dynaconf/dev](https://badges.gitter.im/dynaconf/dev.svg)](https://gitter.im/dynaconf/dev?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![ Matrix](https://img.shields.io/badge/dev-room-blue.svg?logo=matrix)](https://matrix.to/#/#dynaconf:matrix.org)\n\n## Features\n\n- Inspired by the [12-factor application guide](https://12factor.net/config)\n- Settings management (default values, validation, parsing, templating)\n- Protection of sensitive information (passwords/tokens)\n- Multiple file formats `toml|yaml|json|ini|py` and also customizable loaders.\n- Full support for environment variables to override existing settings (dotenv support included).\n- Optional layered system for multi environments `[default, development, testing, production]`\n- Built-in support for Hashicorp Vault and Redis as settings and secrets storage.\n- Built-in extensions for **Django** and **Flask** web frameworks.\n- CLI for common operations such as `init, list, write, validate, export`.\n- full docs on https://dynaconf.com\n\n### Install\n\n```bash\n$ pip install dynaconf\n```\n\n#### Initialize Dynaconf on project root directory\n\n```plain\n$ cd path/to/your/project/\n\n$ dynaconf init -f toml\n\n\u2699\ufe0f  Configuring your Dynaconf environment\n------------------------------------------\n\ud83d\udc0d The file `config.py` was generated.\n\n\ud83c\udf9b\ufe0f  settings.toml created to hold your settings.\n\n\ud83d\udd11 .secrets.toml created to hold your secrets.\n\n\ud83d\ude48 the .secrets.* is also included in `.gitignore`\n  beware to not push your secrets to a public repo.\n\n\ud83c\udf89 Dynaconf is configured! read more on https://dynaconf.com\n```\n\n> **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.\n\n#### Dynaconf init creates the following files\n\n```plain\n.\n\u251c\u2500\u2500 config.py       # This is from where you import your settings object (required)\n\u251c\u2500\u2500 .secrets.toml   # This is to hold sensitive data like passwords and tokens (optional)\n\u2514\u2500\u2500 settings.toml   # This is to hold your application settings (optional)\n```\n\nOn the file `config.py` Dynaconf init generates the following boilerpate\n\n```py\nfrom dynaconf import Dynaconf\n\nsettings = Dynaconf(\n    envvar_prefix=\"DYNACONF\",  # export envvars with `export DYNACONF_FOO=bar`.\n    settings_files=['settings.yaml', '.secrets.yaml'],  # Load files in the given order.\n)\n```\n\n> **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\n\n\n#### Using Dynaconf\n\nPut your settings on `settings.{toml|yaml|ini|json|py}`\n\n```toml\nusername = \"admin\"\nport = 5555\ndatabase = {name='mydb', schema='main'}\n```\n\nPut sensitive information on `.secrets.{toml|yaml|ini|json|py}`\n\n```toml\npassword = \"secret123\"\n```\n\n> **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.\n\n\nOptionally you can now use environment variables to override values per execution or per environment.\n\n```bash\n# override `port` from settings.toml file and automatically casts as `int` value.\nexport DYNACONF_PORT=9900\n```\n\n\nOn your code import the `settings` object\n\n```py\nfrom path.to.project.config import settings\n\n# Reading the settings\n\nsettings.username == \"admin\"  # dot notation with multi nesting support\nsettings.PORT == 9900  # case insensitive\nsettings['password'] == \"secret123\"  # dict like access\nsettings.get(\"nonexisting\", \"default value\")  # Default values just like a dict\nsettings.databases.name == \"mydb\"  # Nested key traversing\nsettings['databases.schema'] == \"main\"  # Nested key traversing\n```\n\n## More\n\n- Settings Schema Validation\n- Custom Settings Loaders\n- Vault Services\n- Template substitutions\n- etc...\n\nThere is a lot more you can do, **read the docs:** http://dynaconf.com\n\n## Contribute\n\nMain discussions happens on [Discussions Tab](https://github.com/dynaconf/dynaconf/discussions) learn more about how to get involved on [CONTRIBUTING.md guide](CONTRIBUTING.md)\n\n## More\n\nIf you are looking for something similar to Dynaconf to use in your Rust projects: https://github.com/rubik/hydroconf\n\nAnd a special thanks to [Caneco](https://twitter.com/caneco) for the logo.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The dynamic configurator for your Python Project",
    "version": "3.2.5",
    "project_urls": {
        "Homepage": "https://github.com/dynaconf/dynaconf"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6b19b995a140fa4984047b44653036b655ed52680a2293a481614539bc01a07",
                "md5": "e157f0014b02ec5afb4f5d085e2f5c90",
                "sha256": "12202fc26546851c05d4194c80bee00197e7c2febcb026e502b0863be9cbbdd8"
            },
            "downloads": -1,
            "filename": "dynaconf-3.2.5-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e157f0014b02ec5afb4f5d085e2f5c90",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 230804,
            "upload_time": "2024-03-18T20:28:58",
            "upload_time_iso_8601": "2024-03-18T20:28:58.619156Z",
            "url": "https://files.pythonhosted.org/packages/d6/b1/9b995a140fa4984047b44653036b655ed52680a2293a481614539bc01a07/dynaconf-3.2.5-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b1f577263ba18254578b7235b2b1ea55e1a62ca537d3acfc3033e93a9631759",
                "md5": "45a52268b7048037984acd9581508486",
                "sha256": "42c8d936b32332c4b84e4d4df6dd1626b6ef59c5a94eb60c10cd3c59d6b882f2"
            },
            "downloads": -1,
            "filename": "dynaconf-3.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "45a52268b7048037984acd9581508486",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 271954,
            "upload_time": "2024-03-18T20:29:02",
            "upload_time_iso_8601": "2024-03-18T20:29:02.462494Z",
            "url": "https://files.pythonhosted.org/packages/3b/1f/577263ba18254578b7235b2b1ea55e1a62ca537d3acfc3033e93a9631759/dynaconf-3.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-18 20:29:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dynaconf",
    "github_project": "dynaconf",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "dynaconf"
}
        
Elapsed time: 0.23262s