{ "info": { "author": "Yeray D\u00edaz D\u00edaz", "author_email": "yeraydiazdiaz@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# `envfiles`: Simple layered loading of env files for your [12-factor](https://12factor.net/) app\n\nYou've set up your app to configure itself from environment variables,\nawesome, well done. Now all you need to do is to export *all of them* before\nrunning your app. Oh, and also they need to be slightly different in Docker,\nand tests, and for local development...\n\nWouldn't it be neat if we could layer env files? Imagine a `base.env`:\n\n```\nCACHE_ENABLED=1\nDATABASE_HOST=localhost\nDATABASE_NAME=myapp\n```\n\nA `test.env` that overrides it:\n\n```\n# >> base.env\nCACHE_ENABLED=0\nDATABASE_NAME=myapp_test\n```\n\nNote the first line `# >> base.env`, the `# >> ` is an arbitrary prefix, the\n`base.env` is a path *relative to the file being read*.\n\nThen define *one* environment variable, for example `ENV_FILE`, containing a\nrelative path to the env file you want to load:\n\n```python\nimport envfiles\n\nenv_vars = envfiles.load_env_files(os.getenv(\"ENV_FILE\"))\nassert env_vars == {\n \"CACHE_ENABLED\": \"0\",\n \"DATABASE_HOST\": \"localhost\",\n \"DATABASE_NAME\": \"myapp_test\",\n}\n```\n\nNote `envfiles` will *not* mess with your `os.environ`, or attempt parsing or\n(de)serializing variables. The output is a dictionary of strings to strings,\nwhat you do with it is entirely your business.\n\nYou can simply update `os.environ` with\nthe result of `envfiles` and let your configuration library/code pick it up.\nDo note that if you do this the actual environment variables will be overridden\nby the result of `envfiles`.\n\nInstead, I suggest updating the results with `os.environ` and passing it to\n[`environ-config`](https://github.com/hynek/environ-config) \ud83d\udc9a\n\n```python\nimport environ\nimport envfiles\nfrom settings import MyConfig # your environ-config Config class\n\nenv_vars = envfiles.load(os.getenv(\"ENV_FILE\"))\n\nenv_vars.update(os.environ)\nconfig = environ.to_config(MyConfig, environ=env_vars)\n```\n\n## Why?\n\nFrustration, mostly. I've had this issue more times than I can count. I've tried\ndifferent libraries but none of them supported layering or sort of did but\nmessed with the `os.environ` in surprising ways.\n\nThe idea behind `envfiles` is to just read layered env files and let you\nuse whatever configuration solution you want. Configuration is the first\nthing your app does, it should be as quick and straightforward as possible.\n\n## Alternatives\n\nIf `envfiles` is not what you were looking for here are some other options you\nmay want to consider, all of them more mature and featured than `envfiles`:\n\n- [`dotenv`](https://github.com/theskumar/python-dotenv)\n- [`environs`](https://github.com/sloria/environs)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yeraydiazdiaz/envfiles", "keywords": "environment,variables,12-factor", "license": "Apache 2.0", "maintainer": "Yeray D\u00edaz D\u00edaz", "maintainer_email": "yeraydiazdiaz@gmail.com", "name": "envfiles", "package_url": "https://pypi.org/project/envfiles/", "platform": "", "project_url": "https://pypi.org/project/envfiles/", "project_urls": { "Homepage": "https://github.com/yeraydiazdiaz/envfiles" }, "release_url": "https://pypi.org/project/envfiles/0.1.0/", "requires_dist": [ "pytest ; extra == 'dev'", "pytest-mock ; extra == 'dev'", "pytest-cov ; extra == 'dev'", "black ; extra == 'dev'", "flake8 ; extra == 'dev'", "ipython ; extra == 'dev'", "mypy ; extra == 'dev'", "pdbpp ; extra == 'dev'", "pip-tools ; extra == 'dev'", "twine ; extra == 'dev'", "setuptools ; extra == 'dev'", "wheel ; extra == 'dev'", "isort ; extra == 'dev'", "devtools[pygments] ; extra == 'dev'", "nox ; extra == 'dev'", "pytest ; extra == 'test'", "pytest-mock ; extra == 'test'", "pytest-cov ; extra == 'test'" ], "requires_python": ">=3.6.*", "summary": "Simple layered loading of env files for your 12-factor app.", "version": "0.1.0" }, "last_serial": 5967580, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e64774c936d5e29e96ee0836fb828ba8", "sha256": "2306d5df224e3bfa4314d9f10083f976124a2f4196061e76faeb2cd21bdd3d90" }, "downloads": -1, "filename": "envfiles-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e64774c936d5e29e96ee0836fb828ba8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.*", "size": 8367, "upload_time": "2019-10-13T14:46:57", "url": "https://files.pythonhosted.org/packages/02/03/6ca40bdaa2e5ffe9f670f9aef7ef5b052685ae8e31bb5313ae6d303898ee/envfiles-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0c46a85c6d4c81095f7da4674ddd910", "sha256": "920e6416babe29202eae126ec8f1abd7a8355aedfc2f26858b9716ebe6d563d8" }, "downloads": -1, "filename": "envfiles-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c0c46a85c6d4c81095f7da4674ddd910", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.*", "size": 8930, "upload_time": "2019-10-13T14:46:59", "url": "https://files.pythonhosted.org/packages/9f/1a/5ec27b47e1ee4f1cda637c8c004754db227caeee4edc629dada437d24e4f/envfiles-0.1.0.tar.gz" } ], "0.1.0.dev0": [ { "comment_text": "", "digests": { "md5": "e098766bd0c1b4789d16a3ce3015a54e", "sha256": "f12094a92da78b29b4d64baafbd2d87663acca81dd410ec7968c545a49027194" }, "downloads": -1, "filename": "envfiles-0.1.0.dev0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e098766bd0c1b4789d16a3ce3015a54e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7.*", "size": 8415, "upload_time": "2019-10-13T14:18:06", "url": "https://files.pythonhosted.org/packages/bb/f6/dba5669f0db020a29bd17998cf3f8cc50f3d145216370848a6527917616c/envfiles-0.1.0.dev0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4c4235da7449399e4907bed80887e727", "sha256": "6da491e730adb5441fb98204cd0e41da9749c22a8a531c9cea97d1e1f9d49332" }, "downloads": -1, "filename": "envfiles-0.1.0.dev0.tar.gz", "has_sig": false, "md5_digest": "4c4235da7449399e4907bed80887e727", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7.*", "size": 8897, "upload_time": "2019-10-13T14:18:09", "url": "https://files.pythonhosted.org/packages/a6/df/453e82cd17aaacd167a1028a3cf0e0d90d701f9a04d27efb885d28b090c9/envfiles-0.1.0.dev0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e64774c936d5e29e96ee0836fb828ba8", "sha256": "2306d5df224e3bfa4314d9f10083f976124a2f4196061e76faeb2cd21bdd3d90" }, "downloads": -1, "filename": "envfiles-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e64774c936d5e29e96ee0836fb828ba8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.*", "size": 8367, "upload_time": "2019-10-13T14:46:57", "url": "https://files.pythonhosted.org/packages/02/03/6ca40bdaa2e5ffe9f670f9aef7ef5b052685ae8e31bb5313ae6d303898ee/envfiles-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0c46a85c6d4c81095f7da4674ddd910", "sha256": "920e6416babe29202eae126ec8f1abd7a8355aedfc2f26858b9716ebe6d563d8" }, "downloads": -1, "filename": "envfiles-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c0c46a85c6d4c81095f7da4674ddd910", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.*", "size": 8930, "upload_time": "2019-10-13T14:46:59", "url": "https://files.pythonhosted.org/packages/9f/1a/5ec27b47e1ee4f1cda637c8c004754db227caeee4edc629dada437d24e4f/envfiles-0.1.0.tar.gz" } ] }