environ-config


Nameenviron-config JSON
Version 23.2.0 PyPI version JSON
download
home_page
SummaryBoilerplate-free configuration with env variables.
upload_time2023-04-24 20:01:40
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords app cfg config env
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # *environ-config*: Application Configuration With Env Variables

[![Documentation](https://img.shields.io/badge/Docs-Read%20The%20Docs-black)](https://environ-config.readthedocs.io/)
[![License: Apache 2.0](https://img.shields.io/badge/license-Apache--2.0-C06524)](https://github.com/hynek/environ-config/blob/main/LICENSE)
[![PyPI version](https://img.shields.io/pypi/v/environ-config)](https://pypi.org/project/environ-config/)
[![Downloads / Month](https://static.pepy.tech/personalized-badge/environ-config?period=month&units=international_system&left_color=grey&right_color=blue&left_text=Downloads%20/%20Month)](https://pepy.tech/project/environ-config)

<!-- teaser-begin -->

*environ-config* allows you to configure your applications using environment variables – as recommended in [*The Twelve-Factor App*](https://12factor.net/config) methodology – with elegant, boilerplate-free, and declarative code:

```pycon
>>> import environ
>>> # Extracts secrets from Vault-via-envconsul: 'secret/your-app':
>>> vault = environ.secrets.VaultEnvSecrets(vault_prefix="SECRET_YOUR_APP")
>>> @environ.config(prefix="APP")
... class AppConfig:
...    @environ.config
...    class DB:
...        name = environ.var("default_db")
...        host = environ.var("default.host")
...        port = environ.var(5432, converter=int)  # Use attrs's converters and validators!
...        user = environ.var("default_user")
...        password = vault.secret()
...
...    env = environ.var()
...    lang = environ.var(name="LANG")  # It's possible to overwrite the names of variables.
...    db = environ.group(DB)
...    awesome = environ.bool_var()
>>> cfg = environ.to_config(
...     AppConfig,
...     environ={
...         "APP_ENV": "dev",
...         "APP_DB_HOST": "localhost",
...         "LANG": "C",
...         "APP_AWESOME": "yes",  # true and 1 work too, everything else is False
...         # Vault-via-envconsul-style var name:
...         "SECRET_YOUR_APP_DB_PASSWORD": "s3kr3t",
... })  # Uses os.environ by default.
>>> cfg
AppConfig(env='dev', lang='C', db=AppConfig.DB(name='default_db', host='localhost', port=5432, user='default_user', password=<SECRET>), awesome=True)
>>> cfg.db.password
's3kr3t'

```

`AppConfig.from_environ({...})` is equivalent to the code above, depending on your taste.


## Features

- Declarative & boilerplate-free.

- Nested configuration from flat environment variable names.

- Default & mandatory values: enforce configuration structure without writing a line of code.

- Built on top of [*attrs*](https://www.attrs.org/) which gives you data validation and conversion for free.

- Pluggable secrets extraction.
  Ships with:

  - [HashiCorp Vault](https://www.vaultproject.io) support via [*envconsul*](https://github.com/hashicorp/envconsul).
  - [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) (needs [*boto3*](https://pypi.org/project/boto3/))
  - INI files, because secrets in env variables are icky.

- Helpful debug logging that will tell you which variables are present and what *environ-config* is looking for.

- Built-in dynamic help documentation generation.

<!-- teaser-end -->

You can find the full documentation including a step-by-step tutorial on [Read the Docs](https://environ-config.readthedocs.io/).


## Project Information

*environ-config* is maintained by [Hynek Schlawack](https://hynek.me/) and is released under the [Apache License 2.0](https://github.com/hynek/environ-config/blob/main/LICENSE) license.
It targets Python 3.7 and newer, and PyPy.
Development takes place on [GitHub](https://github.com/hynek/environ-config).

The development is kindly supported by [Variomedia AG](https://www.variomedia.de/).

*environ-config* wouldn't be possible without the [*attrs* project](https://www.attrs.org).


## *environ-config* for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of *structlog* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/pypi-environ-config?utm_source=pypi-environ-config&utm_medium=pypi)


## Release Information

### Fixed

- Type hints for `environ.config()` now allow for arguments (e.g. `@environ.config(prefix="")`).
  [#56](https://github.com/hynek/environ-config/issues/56)


 ---

 [**Full Changelog**](https://www.structlog.org/en/stable/changelog.html)
 
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "environ-config",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "app,cfg,config,env",
    "author": "",
    "author_email": "Hynek Schlawack <hs@ox.cx>",
    "download_url": "https://files.pythonhosted.org/packages/b3/1f/aff64afe6692596238c564dada1631cf472124cdeb57654f5f95f32cbefb/environ_config-23.2.0.tar.gz",
    "platform": null,
    "description": "# *environ-config*: Application Configuration With Env Variables\n\n[![Documentation](https://img.shields.io/badge/Docs-Read%20The%20Docs-black)](https://environ-config.readthedocs.io/)\n[![License: Apache 2.0](https://img.shields.io/badge/license-Apache--2.0-C06524)](https://github.com/hynek/environ-config/blob/main/LICENSE)\n[![PyPI version](https://img.shields.io/pypi/v/environ-config)](https://pypi.org/project/environ-config/)\n[![Downloads / Month](https://static.pepy.tech/personalized-badge/environ-config?period=month&units=international_system&left_color=grey&right_color=blue&left_text=Downloads%20/%20Month)](https://pepy.tech/project/environ-config)\n\n<!-- teaser-begin -->\n\n*environ-config* allows you to configure your applications using environment variables \u2013 as recommended in [*The Twelve-Factor App*](https://12factor.net/config) methodology \u2013 with elegant, boilerplate-free, and declarative code:\n\n```pycon\n>>> import environ\n>>> # Extracts secrets from Vault-via-envconsul: 'secret/your-app':\n>>> vault = environ.secrets.VaultEnvSecrets(vault_prefix=\"SECRET_YOUR_APP\")\n>>> @environ.config(prefix=\"APP\")\n... class AppConfig:\n...    @environ.config\n...    class DB:\n...        name = environ.var(\"default_db\")\n...        host = environ.var(\"default.host\")\n...        port = environ.var(5432, converter=int)  # Use attrs's converters and validators!\n...        user = environ.var(\"default_user\")\n...        password = vault.secret()\n...\n...    env = environ.var()\n...    lang = environ.var(name=\"LANG\")  # It's possible to overwrite the names of variables.\n...    db = environ.group(DB)\n...    awesome = environ.bool_var()\n>>> cfg = environ.to_config(\n...     AppConfig,\n...     environ={\n...         \"APP_ENV\": \"dev\",\n...         \"APP_DB_HOST\": \"localhost\",\n...         \"LANG\": \"C\",\n...         \"APP_AWESOME\": \"yes\",  # true and 1 work too, everything else is False\n...         # Vault-via-envconsul-style var name:\n...         \"SECRET_YOUR_APP_DB_PASSWORD\": \"s3kr3t\",\n... })  # Uses os.environ by default.\n>>> cfg\nAppConfig(env='dev', lang='C', db=AppConfig.DB(name='default_db', host='localhost', port=5432, user='default_user', password=<SECRET>), awesome=True)\n>>> cfg.db.password\n's3kr3t'\n\n```\n\n`AppConfig.from_environ({...})` is equivalent to the code above, depending on your taste.\n\n\n## Features\n\n- Declarative & boilerplate-free.\n\n- Nested configuration from flat environment variable names.\n\n- Default & mandatory values: enforce configuration structure without writing a line of code.\n\n- Built on top of [*attrs*](https://www.attrs.org/) which gives you data validation and conversion for free.\n\n- Pluggable secrets extraction.\n  Ships with:\n\n  - [HashiCorp Vault](https://www.vaultproject.io) support via [*envconsul*](https://github.com/hashicorp/envconsul).\n  - [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) (needs [*boto3*](https://pypi.org/project/boto3/))\n  - INI files, because secrets in env variables are icky.\n\n- Helpful debug logging that will tell you which variables are present and what *environ-config* is looking for.\n\n- Built-in dynamic help documentation generation.\n\n<!-- teaser-end -->\n\nYou can find the full documentation including a step-by-step tutorial on [Read the Docs](https://environ-config.readthedocs.io/).\n\n\n## Project Information\n\n*environ-config* is maintained by [Hynek Schlawack](https://hynek.me/) and is released under the [Apache License 2.0](https://github.com/hynek/environ-config/blob/main/LICENSE) license.\nIt targets Python 3.7 and newer, and PyPy.\nDevelopment takes place on [GitHub](https://github.com/hynek/environ-config).\n\nThe development is kindly supported by [Variomedia AG](https://www.variomedia.de/).\n\n*environ-config* wouldn't be possible without the [*attrs* project](https://www.attrs.org).\n\n\n## *environ-config* for Enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of *structlog* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/pypi-environ-config?utm_source=pypi-environ-config&utm_medium=pypi)\n\n\n## Release Information\n\n### Fixed\n\n- Type hints for `environ.config()` now allow for arguments (e.g. `@environ.config(prefix=\"\")`).\n  [#56](https://github.com/hynek/environ-config/issues/56)\n\n\n ---\n\n [**Full Changelog**](https://www.structlog.org/en/stable/changelog.html)\n ",
    "bugtrack_url": null,
    "license": "",
    "summary": "Boilerplate-free configuration with env variables.",
    "version": "23.2.0",
    "split_keywords": [
        "app",
        "cfg",
        "config",
        "env"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "da286ad9ff2b4dc27bd12ab46c57adfae7f34f42bf17595b5426b667f3f7bb61",
                "md5": "9a0c56cfc48a9afae61f9e1e8388a22b",
                "sha256": "20a60f90a0a9e80d7d5ed92060a8fbb9b7b016ba34bda85361ec376340013be9"
            },
            "downloads": -1,
            "filename": "environ_config-23.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9a0c56cfc48a9afae61f9e1e8388a22b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 19502,
            "upload_time": "2023-04-24T20:01:38",
            "upload_time_iso_8601": "2023-04-24T20:01:38.135749Z",
            "url": "https://files.pythonhosted.org/packages/da/28/6ad9ff2b4dc27bd12ab46c57adfae7f34f42bf17595b5426b667f3f7bb61/environ_config-23.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b31faff64afe6692596238c564dada1631cf472124cdeb57654f5f95f32cbefb",
                "md5": "e70874ad380c6604b3ac5ae8338dd150",
                "sha256": "e83fa15efbd7ab7130268c33992d9d42747232315d05586e5276c96ee89020f9"
            },
            "downloads": -1,
            "filename": "environ_config-23.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e70874ad380c6604b3ac5ae8338dd150",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 44948,
            "upload_time": "2023-04-24T20:01:40",
            "upload_time_iso_8601": "2023-04-24T20:01:40.272940Z",
            "url": "https://files.pythonhosted.org/packages/b3/1f/aff64afe6692596238c564dada1631cf472124cdeb57654f5f95f32cbefb/environ_config-23.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-24 20:01:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "environ-config"
}
        
Elapsed time: 0.08500s