{ "info": { "author": "Yasser Toruno", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "# envio\nEnvironment variable parser library for python.\n\nMostly created as a reference for how basic package creation works. Many\nsimilar projects exist; the goal of this one to make the most basic\nimplementation possible and also establish the minimum amount of boilerplate\nto create a package for submission.\n\n## Installation\n\nrun `pip install envio`\n\n## Usage\n\nBasic usage\n\n```python\nimport envio\n\n# Fetch the envirnment variable MYARG and use value 'yay' if not found\nMYARG = envio.get_var('MYARG', default='yay')\n\n# If a default is not specified, then an exception will be raised if the\n# environment variable does not exist. This is how we can specify required\n# variables.\nMYARG = envio.get_var('MYARG') # MYARG is required\n```\n\nEnvironment variables can also be coerced into multiple different types\n\n```python\n# coerce required variable MYINT into an integer\nMYINT = envio.get_var('MYINT', var_type=int)\n\nMYFLOAT = envio.get_var('MYFLOAT', var_type=float)\n\n# Acceptable inputs for boolean values include:\n# case insensitive versions of 'true' and 'false'\n# case insensitive words 'on' and 'off'\n# '1' and '0'\n# case insensitive letters 't' and 'f'\nMYBOOL = envio.get_var('MYBOOL', var_type=bool)\n\n# Dictionaries are also supported but require the environment variable to be\n# a valid json string. Below is an example of how to specify a simple dict\n# through a json string.\nMYDICT = envio.get_var('MYDICT', var_type='json', default='{\"hello\": \"world\"}')\n```\n\nVariables can also be coerced into lists by using the *many=True* argument.\n\n```python\n# e.g MYLIST <-- '1,hello, 7, 12.0'\n# the following will parse as\n# MYLIST = ['1', 'hello', '7', '12.0']\nMYLIST = envio.get_var('MYLIST', many=True)\n\n# list parsing can be combined with type coercion. This will enforce that\n# every member of the list be parsed as 'var_type'.\nMYINTS = envio.get_var('MYINTS', var_type=int, many=True)\n\n# The delimmiter used for parsing lists defaults to a comma, but it can be\n# changed with an optional 'delimmiter' param.\nMYINTS = envio.get_var('MYINTS', var_type=int, many=True, delimmiter='||', default='1||2||3')\n\n# using 'var_type'=json also allows the parsing of integers, lists of integers\n# and the like. It allows mixed types in lists and should be used carefully.\n# the example below will produce [1, 2, '3']\nMYLIST = envio.get_var('MYLIST', var_type='json', default='[1, 2, \"3\"]')\n```\n\nDefault values can only be **STRING** values. This is done so that even the\ndefault value we choose has to go through the same parser as if we had gotten\nit as an environment variable. This avoids a class of errors where an\nincompatible default can be chosen. e.g. expecting a integer but defaulting\nto a boolean.\n\n```python\n# this is the correct way to specify a default for a list of integers\nMYINTS = envio.get_var('MYINTS', var_type=int, many=True, default='1,2,3')\n```\n\n## Development\n\nYou'll want to clone the package somewhere and have either pipenv or virtualenv available on your environment.\n\nA *Pipfile* is included in this project. It comes mostly with packages used\nto run *twine* - the utility used to submit packages to pypi. It can also be\nused to install this project's distributions locally.\n\nAll commands assume the working directory is the repo root.\n\n```bash\n# install a virtual env and the pipfile requirements.\npipenv install\n# activate the virtualenv in the shell. All commands should be run after this\n# activation\npipenv shell\n\n# builds can be generated like so:\npython setup.py sdist bdist_wheel\n\n# builds can then be submitted to pypi using twine like so:\n\n# upload to test pypi\ntwine upload --repository-url https://test.pypi.org/legacy/ dist/*\n\n# upload to the actual pypi servers.\ntwine upload --repository-url https://upload.pypi.org/legacy/ dist/*\n\n# tests can be run using setup.py as well\npython setup.py test\n```\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/yassi/envio", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "envio", "package_url": "https://pypi.org/project/envio/", "platform": "", "project_url": "https://pypi.org/project/envio/", "project_urls": { "Homepage": "https://github.com/yassi/envio" }, "release_url": "https://pypi.org/project/envio/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "Environment variable parser library for python", "version": "1.0.1" }, "last_serial": 4233419, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "9d5e6afb41d9c197b2cea354ed0fa3ab", "sha256": "3310517553f4d208cb17bdb9b0435e964c603dc0351e77ff35ee165da0a8dfef" }, "downloads": -1, "filename": "envio-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9d5e6afb41d9c197b2cea354ed0fa3ab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5458, "upload_time": "2018-09-03T06:41:59", "url": "https://files.pythonhosted.org/packages/3c/9f/5105b1565c4bf6d63d8b6b555cffcec2ab1e957463e8aefe91c6c02e28ee/envio-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1678ed35796ba7a628ce3215f903ef7", "sha256": "51f2ebfdb3d8af69af0fc89d83d936caf4152c5b1773aec6c9620e810cd5c807" }, "downloads": -1, "filename": "envio-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e1678ed35796ba7a628ce3215f903ef7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5187, "upload_time": "2018-09-03T06:42:00", "url": "https://files.pythonhosted.org/packages/65/f4/631c3555a77155c73ccc9d6646abcd944119b358f60ac56692a0c8691a7d/envio-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9d5e6afb41d9c197b2cea354ed0fa3ab", "sha256": "3310517553f4d208cb17bdb9b0435e964c603dc0351e77ff35ee165da0a8dfef" }, "downloads": -1, "filename": "envio-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9d5e6afb41d9c197b2cea354ed0fa3ab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5458, "upload_time": "2018-09-03T06:41:59", "url": "https://files.pythonhosted.org/packages/3c/9f/5105b1565c4bf6d63d8b6b555cffcec2ab1e957463e8aefe91c6c02e28ee/envio-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1678ed35796ba7a628ce3215f903ef7", "sha256": "51f2ebfdb3d8af69af0fc89d83d936caf4152c5b1773aec6c9620e810cd5c807" }, "downloads": -1, "filename": "envio-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e1678ed35796ba7a628ce3215f903ef7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5187, "upload_time": "2018-09-03T06:42:00", "url": "https://files.pythonhosted.org/packages/65/f4/631c3555a77155c73ccc9d6646abcd944119b358f60ac56692a0c8691a7d/envio-1.0.1.tar.gz" } ] }