{ "info": { "author": "Aron Griffis", "author_email": "aron@scampersand.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "==============\nenvbash-python\n==============\n\n|PyPI| |Build Status| |Coverage Report| |Python Versions|\n\nPython module for sourcing a bash script to augment the environment.\nSupports Python 2.7 and 3.4+\n\nRationale\n---------\n\n`12-factor apps `__ require `configuration loaded\nfrom the environment `__.\n\nThat's `easy on a platform like\nHeroku `__, where the\nenvironment is preset by the user with commands like\n``heroku config:set``. But it's messier in development and non-Heroku\ndeployments, where the environment might need to be loaded from a file.\n\nThis package provides a mechanism for sourcing a Bash script to update\nPython's environment (``os.environ``). Commonly the external file is called\n``env.bash``, hence the name of this project.\n\nInstallation\n------------\n\nInstall from PyPI_:\n\n.. code:: sh\n\n pip install envbash\n\nUsage\n-----\n\nCall ``load_envbash`` to source a Bash script into the current Python process.\nAny variables that are set in the script, regardless of whether they are\nexplicitly exported, will be added to the process environment.\n\nFor example, given ``env.bash`` with the following content:\n\n.. code:: sh\n\n FOO='bar baz qux'\n\nThis can be loaded into Python:\n\n.. code:: python\n\n import os\n from envbash import load_envbash\n\n load_envbash('env.bash')\n\n print(os.environ['FOO']) #=> bar baz qux\n\nFAQ\n---\n\nHow is this different from `dotenv `__?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nBoth projects aim to solve the same problem, but differ in approach. In\nparticular, dotenv uses an ad hoc config syntax whereas envbash uses\nBash.\n\ndotenv's syntax becomes a problem with multi-line strings. dotenv intends for\nthe ``.env`` file to be readable by the shell, but the dotenv format for\nmulti-line strings isn't compatible with the shell.\n\nIf the point is to have a configuration language that's well-suited to\nenvironment variables, it's hard to beat pure Bash, and it's guaranteed\nto source properly into the shell.\n\nShould I commit ``env.bash`` to source control?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nNo, definitely not. The purpose of ``env.bash`` is to store development\nconfiguration that isn't suitable for committing to the repository,\nwhether that's secret keys or developer-specific customizations. In\nfact, you should add the following line to ``.gitignore``:\n\n::\n\n /env.bash\n\nIs it necessary to explicitly ``export`` variables in ``env.bash``?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nNo, envbash prefixes sourcing your ``env.bash`` with ``set -a`` which\ncauses all newly-set variables to be exported automatically. If you\nwould rather explicitly export variables, you can ``set +a`` at the top\nof your ``env.bash``.\n\nHow do I put a multi-line string into ``env.bash``?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou can put newlines directly into a multi-line string in Bash, so for\nexample this works:\n\n.. code:: bash\n\n PRIVATE_KEY=\"\n -----BEGIN RSA PRIVATE KEY-----\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n -----END RSA PRIVATE KEY-----\"\n\nDoes envbash override my environment settings?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nBy default your local environment settings win, so you can override the\ncontent of ``env.bash`` by explicitly exporting variables in your shell.\n\nYou can change this behavior. This makes sense for a deployed instance\nthat gets full configuration from ``env.bash`` and needs to be protected\nfrom the calling environment.\n\n.. code:: python\n\n load_envbash('env.bash', override=True)\n\nCan I remove settings from the environment?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nBy default envbash doesn't remove settings, but you can change this\nbehavior.\n\n.. code:: python\n\n load_envbash('env.bash', remove=True)\n\nThis will cause any variables that you explicitly ``unset`` in\n``env.bash`` to be removed from Python's ``os.environ`` as well.\n\nHow do I source ``env.bash`` into my guest shell environment?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nAssuming that your source directory is available on the default\n``/vagrant`` mount point in the guest, you can add add this line at the\nbottom of ``/home/vagrant/.bash_profile``:\n\n::\n\n set -a; source /vagrant/env.bash; set +a\n\nNote that this means that settings are loaded on ``vagrant ssh`` so you\nneed to exit the shell and rerun ``vagrant ssh`` to refresh if you\nchange settings.\n\nWhat about Ruby?\n~~~~~~~~~~~~~~~~~~\n\nSee `envbash-ruby `__\n\nLegal\n-----\n\nCopyright 2017-2018 `Scampersand LLC `_\n\nReleased under the `MIT license `_\n\n.. _PyPI: https://pypi.python.org/pypi/envbash\n\n.. |Build Status| image:: https://img.shields.io/travis/scampersand/envbash-python/master.svg?style=plastic\n :target: https://travis-ci.org/scampersand/envbash-python?branch=master\n\n.. |Coverage Report| image:: https://img.shields.io/codecov/c/github/scampersand/envbash-python/master.svg?style=plastic\n :target: https://codecov.io/gh/scampersand/envbash-python/branch/master\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/envbash.svg?style=plastic\n :target: PyPI_\n\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/envbash.svg?style=plastic\n :target: PyPI_\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/scampersand/envbash-python", "keywords": "bash,environment,environ,env", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "envbash", "package_url": "https://pypi.org/project/envbash/", "platform": "", "project_url": "https://pypi.org/project/envbash/", "project_urls": { "Homepage": "https://github.com/scampersand/envbash-python" }, "release_url": "https://pypi.org/project/envbash/1.1.2/", "requires_dist": null, "requires_python": "", "summary": "Source env.bash script to update environment", "version": "1.1.2" }, "last_serial": 4306786, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "ae1f4caa6bbfc0d9773963211dc060d8", "sha256": "c0c478903b8a2fb88e93a83f5f027f7e3bec8ec565d7ddece1da6f4e9f670416" }, "downloads": -1, "filename": "envbash-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ae1f4caa6bbfc0d9773963211dc060d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3736, "upload_time": "2017-02-04T21:52:06", "url": "https://files.pythonhosted.org/packages/b7/70/34462a5c110385759ed17e131642a962e95b6f9fbadd8822157b352c1ecd/envbash-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "26fe9d56ca87807772879cd279642eba", "sha256": "4f8c23490e45c0048f66ba36bcd62af338f86100a4f9a0cee614ba60ce67a282" }, "downloads": -1, "filename": "envbash-1.1.0.tar.gz", "has_sig": false, "md5_digest": "26fe9d56ca87807772879cd279642eba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3780, "upload_time": "2017-02-08T01:46:01", "url": "https://files.pythonhosted.org/packages/43/40/5ec739cf16e2a41c91143f7e467ff906e6b0c2b90af59d9f6504fcad05e6/envbash-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "be68b991dadb4add562e67a119e15411", "sha256": "68f0b738ce1fcfda6886820619f4333f328220a17bb2ab2607d02e3d8b0dd9ae" }, "downloads": -1, "filename": "envbash-1.1.1.tar.gz", "has_sig": false, "md5_digest": "be68b991dadb4add562e67a119e15411", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3838, "upload_time": "2017-02-08T21:22:00", "url": "https://files.pythonhosted.org/packages/ab/79/205776a4c5a2dc92b88e67ed6f6ea2ddc96b4c6b26ff4233b1a86269d4a3/envbash-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "e7d489a8a0fc18b67dd62f4af6d7d2e1", "sha256": "45b4902118542e4de7fca98065a54f5298d9e9b1a63bfc95e054d4e65c934330" }, "downloads": -1, "filename": "envbash-1.1.2-py3-none-any.whl", "has_sig": true, "md5_digest": "e7d489a8a0fc18b67dd62f4af6d7d2e1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8194, "upload_time": "2018-09-25T01:19:37", "url": "https://files.pythonhosted.org/packages/6b/e2/2af41e6fc86af77023b733a204bc66f5b646818c566b8e6f82917f2cd0d6/envbash-1.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f2ea0026819b6f0dbbc91e4454790ce", "sha256": "833d7394e05362addcaf28ff0ffa5a6e9786f55d0115b84a94cf932aacca52fc" }, "downloads": -1, "filename": "envbash-1.1.2.tar.gz", "has_sig": true, "md5_digest": "6f2ea0026819b6f0dbbc91e4454790ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5197, "upload_time": "2018-09-25T01:19:42", "url": "https://files.pythonhosted.org/packages/e7/d6/a6da872d68689f36c61196340a8d4eb905f78d0e427c33c26f4835c45c8f/envbash-1.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e7d489a8a0fc18b67dd62f4af6d7d2e1", "sha256": "45b4902118542e4de7fca98065a54f5298d9e9b1a63bfc95e054d4e65c934330" }, "downloads": -1, "filename": "envbash-1.1.2-py3-none-any.whl", "has_sig": true, "md5_digest": "e7d489a8a0fc18b67dd62f4af6d7d2e1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8194, "upload_time": "2018-09-25T01:19:37", "url": "https://files.pythonhosted.org/packages/6b/e2/2af41e6fc86af77023b733a204bc66f5b646818c566b8e6f82917f2cd0d6/envbash-1.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f2ea0026819b6f0dbbc91e4454790ce", "sha256": "833d7394e05362addcaf28ff0ffa5a6e9786f55d0115b84a94cf932aacca52fc" }, "downloads": -1, "filename": "envbash-1.1.2.tar.gz", "has_sig": true, "md5_digest": "6f2ea0026819b6f0dbbc91e4454790ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5197, "upload_time": "2018-09-25T01:19:42", "url": "https://files.pythonhosted.org/packages/e7/d6/a6da872d68689f36c61196340a8d4eb905f78d0e427c33c26f4835c45c8f/envbash-1.1.2.tar.gz" } ] }