dynaconf


Namedynaconf JSON
Version 3.2.6 PyPI version JSON
download
home_pagehttps://github.com/dynaconf/dynaconf
SummaryThe dynamic configurator for your Python Project
upload_time2024-07-19 16:24:39
maintainerNone
docs_urlNone
authorBruno Rocha
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements mkdocs mkdocstrings pymdown-extensions mkdocs-material mkdocs-git-revision-date-plugin mkdocs-autorefs Jinja2
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": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Bruno Rocha",
    "author_email": "rochacbruno@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/56/1a/324f1bf234cc4f98445305fd8719245318466e310e05caea7ef052748ecd/dynaconf-3.2.6.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\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The dynamic configurator for your Python Project",
    "version": "3.2.6",
    "project_urls": {
        "Homepage": "https://github.com/dynaconf/dynaconf"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e214c8a7d861262139688fa465d2e27ff7113764d6fa03b15b9c7b666729ea2e",
                "md5": "1c6c0558bfce82dc78fdcf2026750b3d",
                "sha256": "3911c740d717df4576ed55f616c7cbad6e06bc8ef23ffca444b6e2a12fb1c34c"
            },
            "downloads": -1,
            "filename": "dynaconf-3.2.6-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1c6c0558bfce82dc78fdcf2026750b3d",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 231063,
            "upload_time": "2024-07-19T16:24:36",
            "upload_time_iso_8601": "2024-07-19T16:24:36.786067Z",
            "url": "https://files.pythonhosted.org/packages/e2/14/c8a7d861262139688fa465d2e27ff7113764d6fa03b15b9c7b666729ea2e/dynaconf-3.2.6-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "561a324f1bf234cc4f98445305fd8719245318466e310e05caea7ef052748ecd",
                "md5": "e2099450ccbf959a6294c0c173c06852",
                "sha256": "74cc1897396380bb957730eb341cc0976ee9c38bbcb53d3307c50caed0aedfb8"
            },
            "downloads": -1,
            "filename": "dynaconf-3.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "e2099450ccbf959a6294c0c173c06852",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 229209,
            "upload_time": "2024-07-19T16:24:39",
            "upload_time_iso_8601": "2024-07-19T16:24:39.064592Z",
            "url": "https://files.pythonhosted.org/packages/56/1a/324f1bf234cc4f98445305fd8719245318466e310e05caea7ef052748ecd/dynaconf-3.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-19 16:24:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dynaconf",
    "github_project": "dynaconf",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "mkdocs",
            "specs": []
        },
        {
            "name": "mkdocstrings",
            "specs": []
        },
        {
            "name": "pymdown-extensions",
            "specs": []
        },
        {
            "name": "mkdocs-material",
            "specs": []
        },
        {
            "name": "mkdocs-git-revision-date-plugin",
            "specs": []
        },
        {
            "name": "mkdocs-autorefs",
            "specs": []
        },
        {
            "name": "Jinja2",
            "specs": [
                [
                    ">",
                    "3.0.0"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "dynaconf"
}
        
Elapsed time: 0.26462s