{ "info": { "author": "Bruno Reni\u00e9", "author_email": "", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "Env-cmd\n=======\n\nA simple wrapper for executing virtualenv commands and passing them environment variables via a config file.\n\nUse case\n--------\n\nLet's say you deploy a Django site named \"example.com\". You follow all\nthe best practices and deploy it as a Python package, installed in an\nisolated virtualenv at ``/usr/share/python/example-com`` (as `dh_virtualenv\n`_ would do).\n\nConfiguration is read from environment variables in the Django settings.\n\nWhen you want to run a Django management command on your server, you would\ntype::\n\n ENV_VAR_1=value ENV_VAR_2=other \u2026 /usr/share/python/example-com/bin/django-admin \n\nYou could use `envdir `_ or bash's\n``source`` command to expose your environment variables, but **Env-cmd** eases\nthat further. It allows you to read a configuration file, expose values in\nthe environment and run a command simply by adding a setuptools entry point\nin your ``setup.py``. With the entry point symlinked to ``/usr/bin``, your\ncommand becomes::\n\n example-com django-admin \n\nEnv-cmd:\n\n* Reads a configuration file using the default location provided, or an\n override.\n* Exposes configuration values as environment variables.\n* Resolves the path of your virtualenv.\n* Shells out to the virtualenv command.\n\nInstallation\n------------\n\n::\n\n pip install env-cmd\n\nUsage\n-----\n\nIn ``/cli.py``:\n\n.. code-block:: python\n\n import env_cmd\n\n read_environ = env_cmd.read_environ(\n 'PRCONFIG', # name of the env var that allows overriding of the\n # config path.\n '/etc/yourproject.conf', # default config path.\n {'SOME_ENV_VARIABLE': 'DEFAULT_VALUE', # Some default environment\n 'OTHER_VARIABLE': 'OTHER VALUE'}, # variables.\n )\n main = env_cmd.main(read_environ)\n\nIn your ``setup.py``:\n\n.. code-block:: python\n\n setup(\n \u2026\n entry_points={'console_scripts': ['yourproject=yourproject.cli:main']},\n )\n\nThen symlink ``/path/to/virtualenv/bin/yourproject`` to\n``/usr/bin/yourproject``.\n\nYou can run a command from your virtualenv with::\n\n yourproject \n\nOverride the default config path with::\n\n PRCONFIG=/path/to/config.conf yourproject \n\nConfiguration syntax is the following::\n\n KEY=value\n OTHER=some other value\n QUOTED=\"quotes are stripped.\"\n ALSO='single quotes too'\n WHITESPACE= is stripped as well.\n # comments work like this\n\n # empty lines are skipped\n\nIf you run a web server with `Gunicorn `_, you can\nuse the ``on_reload`` hook to read configuration on server reload, allowing\nzero-downtime configuration updates:\n\n.. code-block:: python\n\n # gunicorn.conf.py\n import os\n\n from yourproject import read_environ\n\n def on_reload(server):\n server.log.info(\"Reading environ\")\n os.environ = read_environ()\n server.log.info(os.environ)\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/brutasse/env-cmd", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "env-cmd", "package_url": "https://pypi.org/project/env-cmd/", "platform": "any", "project_url": "https://pypi.org/project/env-cmd/", "project_urls": { "Homepage": "https://github.com/brutasse/env-cmd" }, "release_url": "https://pypi.org/project/env-cmd/1.1/", "requires_dist": null, "requires_python": "", "summary": "A simple wrapper for executing virtualenv commands and passing them environment variables via a config file.", "version": "1.1" }, "last_serial": 4035882, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "93a8ee5fc253c4c6a0727e9116b76eba", "sha256": "bf758a9ac57bef72dc594dc455ab88b2c0b5e40d4a61f9911c173c359429a2c3" }, "downloads": -1, "filename": "env_cmd-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "93a8ee5fc253c4c6a0727e9116b76eba", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5253, "upload_time": "2017-05-09T09:20:03", "url": "https://files.pythonhosted.org/packages/0e/52/4ddf95643f442beed2433d847f2bd85275c7d08ca30565bc64fb63a8ecff/env_cmd-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9515fae120cb0cb0b2a710abf2729c22", "sha256": "1b805bb89422673d1d158d29b6762301e7c04f7088fbaef927b52ba3fff2f683" }, "downloads": -1, "filename": "env-cmd-1.0.tar.gz", "has_sig": false, "md5_digest": "9515fae120cb0cb0b2a710abf2729c22", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4067, "upload_time": "2017-05-09T09:20:05", "url": "https://files.pythonhosted.org/packages/3b/f1/c8af64eab3a6739f507597a9a73f7982521a826c663dac09dcdc339d3192/env-cmd-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "a7caa929cb5465af5517746f0e5e9277", "sha256": "628a061097bc9054955eac3e8bdaeb7399e5ffaa9997f9cac73532c61cedaf85" }, "downloads": -1, "filename": "env_cmd-1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a7caa929cb5465af5517746f0e5e9277", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3099, "upload_time": "2018-07-06T09:36:32", "url": "https://files.pythonhosted.org/packages/08/5e/37eba25ca32befe998230c6bc661e3c67ca57b6db464a9e6ec3eb56d64bb/env_cmd-1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fdebcfdf8c286c04705f224e9b5055b8", "sha256": "c94f2d3ca10d65bf0d3104154a7d5ac13abbae0aa3247847537a1af58ff33f21" }, "downloads": -1, "filename": "env-cmd-1.1.tar.gz", "has_sig": false, "md5_digest": "fdebcfdf8c286c04705f224e9b5055b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4073, "upload_time": "2018-07-06T09:36:33", "url": "https://files.pythonhosted.org/packages/e3/27/90ff01179657e80f404418347c245880364858dedaa8d43f436d7d2d42e9/env-cmd-1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a7caa929cb5465af5517746f0e5e9277", "sha256": "628a061097bc9054955eac3e8bdaeb7399e5ffaa9997f9cac73532c61cedaf85" }, "downloads": -1, "filename": "env_cmd-1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a7caa929cb5465af5517746f0e5e9277", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3099, "upload_time": "2018-07-06T09:36:32", "url": "https://files.pythonhosted.org/packages/08/5e/37eba25ca32befe998230c6bc661e3c67ca57b6db464a9e6ec3eb56d64bb/env_cmd-1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fdebcfdf8c286c04705f224e9b5055b8", "sha256": "c94f2d3ca10d65bf0d3104154a7d5ac13abbae0aa3247847537a1af58ff33f21" }, "downloads": -1, "filename": "env-cmd-1.1.tar.gz", "has_sig": false, "md5_digest": "fdebcfdf8c286c04705f224e9b5055b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4073, "upload_time": "2018-07-06T09:36:33", "url": "https://files.pythonhosted.org/packages/e3/27/90ff01179657e80f404418347c245880364858dedaa8d43f436d7d2d42e9/env-cmd-1.1.tar.gz" } ] }