{ "info": { "author": "Hynek Schlawack", "author_email": "hs@ox.cx", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "================================================================\n``environ-config``: Configuration with env variables for Python.\n================================================================\n\n.. image:: https://travis-ci.org/hynek/environ-config.svg?branch=master\n :target: https://travis-ci.org/hynek/environ-config\n :alt: CI status\n\n.. image:: https://codecov.io/gh/hynek/environ-config/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/hynek/environ-config\n :alt: Test Coverage\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/ambv/black\n :alt: Code style: black\n\n.. begin\n\n``environ-config`` allows you to configure your applications using environment variables \u2013 as recommended in `The Twelve-Factor App `_ methodology \u2013 with elegant, boilerplate-free, and declarative code:\n\n.. code-block:: pycon\n\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\n AppConfig(env='dev', lang='C', db=AppConfig.DB(name='default_db', host='localhost', port=5432, user='default_user', password=), awesome=True)\n >>> cfg.db.password\n 's3kr3t'\n\n``AppConfig.from_environ({...})`` is equivalent to the code above, depending on your taste.\n\n``@environ.config(from_environ=\"different_name_for_from_environ\", generatef_help=\"different_name_for_generate_help\")`` allows to rename generated classmethods or to prevent it's creation by passing ``None`` instead of a name.\n\n\nFeatures\n========\n\n- Declarative & boilerplate-free.\n- Nested config from flat env variable names.\n- Default & mandatory values: enforce configuration structure without writing a line of code.\n- Helpful debug logging that will tell you which variables are present and what ``environ-config`` is looking for.\n- Built on top of `attrs `_ which gives you data validation and conversion for free.\n- Pluggable secrets extraction.\n Ships with:\n\n * `HashiCorp Vault `_ support via `envconsul `_.\n * INI files, because secrets in env variables are `icky `_.\n- Pass any dict into ``environ.to_config(AppConfig, {\"your\": \"config\"})`` instead of loading from the environment.\n- Built in dynamic help documentation generation via ``environ.generate_help``.\n\n.. code-block:: pycon\n\n >>> import environ\n >>> @environ.config(prefix=\"APP\")\n ... class AppConfig:\n ... @environ.config\n ... class SubConfig:\n ... sit = environ.var(help=\"Another example message.\")\n ... amet = environ.var()\n ... lorem = environ.var('ipsum')\n ... dolor = environ.bool_var(True, help=\"An example message.\")\n ... subconfig = environ.group(SubConfig)\n ...\n >>> print(environ.generate_help(AppConfig))\n APP_LOREM (Optional)\n APP_DOLOR (Optional): An example message.\n APP_SUBCONFIG_SIT (Required): Another example message.\n APP_SUBCONFIG_AMET (Required)\n >>> print(environ.generate_help(AppConfig, display_defaults=True))\n APP_LOREM (Optional, Default=ipsum)\n APP_DOLOR (Optional, Default=True): An example message.\n APP_SUBCONFIG_SIT (Required): Another example message.\n APP_SUBCONFIG_AMET (Required)\n\n``AppConfig.generate_help({...})`` is equivalent to the code above, depending on your taste.\n\n\nProject Information\n===================\n\n``environ-config`` is released under the `Apache License 2.0 `_ license.\nIt targets Python 2.7, 3.5 and newer, and PyPy.\n\n\nRelease Information\n===================\n\n19.1.0 (2019-09-02)\n-------------------\n\n\nBackward-incompatible changes:\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Changed license from MIT to Apache License 2.\n\n\nDeprecations:\n^^^^^^^^^^^^^\n\n*none*\n\n\nChanges:\n^^^^^^^^\n\n- Added ``AppConfig.from_environ()`` to instantiate the config class.\n This is an alternative to ``environ.from_environ(AppConfig)``.\n `#5 `_\n- Added ``environ.generate_help(AppConfig)`` and ``AppConfig.generate_help()`` to create a help string based on the configuration.\n- ``environ.config(from_environ=\"fr_env\", generate_help=\"gen_hlp\")`` allows passing alternative names for class methods ``\"from_environ\"`` and ``\"generate_help\"``, or prevent their creation by pasing ``None``.\n `#7 `_\n- If ``environ.var`` is passed an ``attr.Factory``, the callable is used to generate the default value.\n `#10 `_\n\n`Full changelog `_.\n\nCredits\n=======\n\n``environ_config`` is written and maintained by `Hynek Schlawack `_.\n\nThe development is kindly supported by `Variomedia AG `_.\n\nA full list of contributors can be found in `GitHub's overview `_.\n\n``environ_config`` wouldn't be possible without the `attrs project `_.\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hynek/environ_config", "keywords": "app,config,env,cfg", "license": "MIT", "maintainer": "Hynek Schlawack", "maintainer_email": "hs@ox.cx", "name": "environ-config", "package_url": "https://pypi.org/project/environ-config/", "platform": "", "project_url": "https://pypi.org/project/environ-config/", "project_urls": { "Bug Tracker": "https://github.com/hynek/environ-config/issues", "Homepage": "https://github.com/hynek/environ_config", "Source Code": "https://github.com/hynek/environ-config" }, "release_url": "https://pypi.org/project/environ-config/19.1.0/", "requires_dist": [ "attrs (>=17.4.0)", "configparser ; python_version < \"3.0\"", "pytest ; extra == 'dev'", "coverage ; extra == 'dev'", "pytest ; extra == 'tests'", "coverage ; extra == 'tests'" ], "requires_python": "", "summary": "Boilerplate-free configuration with env variables.", "version": "19.1.0" }, "last_serial": 5769832, "releases": { "17.1.0": [ { "comment_text": "", "digests": { "md5": "fb68b9fd2b098ec16b2b833abb1afe63", "sha256": "aec5d85a7d0bb788c01c13fe537e0628b175dafb67a5cc5650ed5f407c3e5508" }, "downloads": -1, "filename": "environ_config-17.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "fb68b9fd2b098ec16b2b833abb1afe63", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9623, "upload_time": "2017-12-14T13:57:25", "url": "https://files.pythonhosted.org/packages/04/43/4b79076e141761f3b069a11c3095f706ca32bba16230b67287cecf401530/environ_config-17.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "93010e15d6172610b26b0f2e814724e2", "sha256": "ff8b466eb4fe192c04ed672430bc8cfd9d4ee087536554f928010bf94c161fbe" }, "downloads": -1, "filename": "environ_config-17.1.0.tar.gz", "has_sig": true, "md5_digest": "93010e15d6172610b26b0f2e814724e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10232, "upload_time": "2017-12-14T13:57:27", "url": "https://files.pythonhosted.org/packages/a4/36/182c10ec64cf3effe2b0f80d21a889c15aceb90308d9f5722d914852a655/environ_config-17.1.0.tar.gz" } ], "18.1.0": [ { "comment_text": "", "digests": { "md5": "0157e348b8d0af90450dc3d12ea52d9d", "sha256": "0b0847a950dde43101f17ba640ce3c801467dbe9641838f09c83703321b26667" }, "downloads": -1, "filename": "environ_config-18.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "0157e348b8d0af90450dc3d12ea52d9d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9797, "upload_time": "2018-01-04T09:08:42", "url": "https://files.pythonhosted.org/packages/97/4a/90b57bdb834259aa3c89eca03ff72cb55dd8861aba76b60006b1335713d3/environ_config-18.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c124b15a0d8a54de3b599ac7e1bd1e46", "sha256": "a556edd81edfedd049598e47b781e2164445d4001126fff9f7b7755de7542df3" }, "downloads": -1, "filename": "environ_config-18.1.0.tar.gz", "has_sig": true, "md5_digest": "c124b15a0d8a54de3b599ac7e1bd1e46", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10461, "upload_time": "2018-01-04T09:08:45", "url": "https://files.pythonhosted.org/packages/14/c9/f51d513e414537cbf6407a4783692a07bca54da115b5f47f6eaad444b417/environ_config-18.1.0.tar.gz" } ], "18.2.0": [ { "comment_text": "", "digests": { "md5": "5c251e41fb8300cf8a639db4420cb5e4", "sha256": "1bdec05c515676e0de2b794c10de4ceee9709b416945646a1f5bed5714a9cc29" }, "downloads": -1, "filename": "environ_config-18.2.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "5c251e41fb8300cf8a639db4420cb5e4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9793, "upload_time": "2018-01-12T13:28:42", "url": "https://files.pythonhosted.org/packages/1f/5c/d507de8792b716caa6949272368a46a951c260db31673376b09ba1420fdb/environ_config-18.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cd13ad3fbc363995f46c51e607259bbc", "sha256": "45600572905e9785b0911ce0a563c2a8f6e589824f50d8d3541bd413f432e13e" }, "downloads": -1, "filename": "environ_config-18.2.0.tar.gz", "has_sig": true, "md5_digest": "cd13ad3fbc363995f46c51e607259bbc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10485, "upload_time": "2018-01-12T13:28:43", "url": "https://files.pythonhosted.org/packages/38/9f/cffa1812244170ccafee0177884eab5a4bdff02002aaa9a59fbea604ff9c/environ_config-18.2.0.tar.gz" } ], "19.1.0": [ { "comment_text": "", "digests": { "md5": "5d33d5291176866c4901bb2dcad2a23e", "sha256": "539a1025aeaa015eb03fdd03201517172816ce32ace377c54cbc55c1e4f24739" }, "downloads": -1, "filename": "environ_config-19.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "5d33d5291176866c4901bb2dcad2a23e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13653, "upload_time": "2019-09-02T09:14:30", "url": "https://files.pythonhosted.org/packages/31/48/1889a568b273137e9f8fc679730aaca842365d65c69495e9775a1f2a87eb/environ_config-19.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7e522a89a545dd1ed015a2be3994cb15", "sha256": "cd5fa819f047853fb7b6c432d35976a84eacd54647a109fa2af27bafcdab7af1" }, "downloads": -1, "filename": "environ-config-19.1.0.tar.gz", "has_sig": true, "md5_digest": "7e522a89a545dd1ed015a2be3994cb15", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19897, "upload_time": "2019-09-02T09:14:32", "url": "https://files.pythonhosted.org/packages/67/6f/dfa0c96e15188b98f8b5989784fd8f47407ddbd24ae8142d5edaaaaa5336/environ-config-19.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d33d5291176866c4901bb2dcad2a23e", "sha256": "539a1025aeaa015eb03fdd03201517172816ce32ace377c54cbc55c1e4f24739" }, "downloads": -1, "filename": "environ_config-19.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "5d33d5291176866c4901bb2dcad2a23e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13653, "upload_time": "2019-09-02T09:14:30", "url": "https://files.pythonhosted.org/packages/31/48/1889a568b273137e9f8fc679730aaca842365d65c69495e9775a1f2a87eb/environ_config-19.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7e522a89a545dd1ed015a2be3994cb15", "sha256": "cd5fa819f047853fb7b6c432d35976a84eacd54647a109fa2af27bafcdab7af1" }, "downloads": -1, "filename": "environ-config-19.1.0.tar.gz", "has_sig": true, "md5_digest": "7e522a89a545dd1ed015a2be3994cb15", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19897, "upload_time": "2019-09-02T09:14:32", "url": "https://files.pythonhosted.org/packages/67/6f/dfa0c96e15188b98f8b5989784fd8f47407ddbd24ae8142d5edaaaaa5336/environ-config-19.1.0.tar.gz" } ] }