envia


Nameenvia JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryManage your app configuration using env variables
upload_time2023-10-18 09:31:17
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License
keywords config env
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Envia

Did you ever lose track of all environment variables you can use to configure a project? Envia is a simple utility that allows you to group them together.

## Installation

```
pip install envia
```

## Usage

You can use Envia as follows

```python
# app/config.py

from envia import EnvVar

APP_DB_VENDOR = EnvVar("APP_DB_VENDOR", default="postgres")
APP_DB_PORT = EnvVar("APP_DB_PORT", default="5432")
APP_DB_HOST = EnvVar("APP_DB_HOST")

# require() can be used to ensure early failure. 
# This fails if APP_REQUIRED_VAR is not set
APP_REQUIRED_VAR = EnvVar("APP_REQUIRED_VAR").require()

```
To use the environment values you can do

```python
# app/db.py
import app.config as cfg

def connect():
	vendor = cfg.APP_DB_VENDOR.get_required()
	port = cfg.APP_DB_PORT.get_required()
	
	# This fails APP_DB_HOST is not set
	host = cfg.APP_DB_HOST.get_required()
	
	# This returns None if APP_DB_HOST is not set
	host = cfg.APP_DB_HOST.require()
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "envia",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Erik De Smedt <contact@erikdesmedt.be>",
    "keywords": "config,env",
    "author": "",
    "author_email": "Erik De Smedt <contact@erikdesmedt.be>",
    "download_url": "https://files.pythonhosted.org/packages/38/fe/f64b7acbab24178090ab31fc9fc2a191f0c7e9306f54a30dd7965ab5e0f6/envia-0.0.2.tar.gz",
    "platform": null,
    "description": "# Envia\n\nDid you ever lose track of all environment variables you can use to configure a project? Envia is a simple utility that allows you to group them together.\n\n## Installation\n\n```\npip install envia\n```\n\n## Usage\n\nYou can use Envia as follows\n\n```python\n# app/config.py\n\nfrom envia import EnvVar\n\nAPP_DB_VENDOR = EnvVar(\"APP_DB_VENDOR\", default=\"postgres\")\nAPP_DB_PORT = EnvVar(\"APP_DB_PORT\", default=\"5432\")\nAPP_DB_HOST = EnvVar(\"APP_DB_HOST\")\n\n# require() can be used to ensure early failure. \n# This fails if APP_REQUIRED_VAR is not set\nAPP_REQUIRED_VAR = EnvVar(\"APP_REQUIRED_VAR\").require()\n\n```\nTo use the environment values you can do\n\n```python\n# app/db.py\nimport app.config as cfg\n\ndef connect():\n\tvendor = cfg.APP_DB_VENDOR.get_required()\n\tport = cfg.APP_DB_PORT.get_required()\n\t\n\t# This fails APP_DB_HOST is not set\n\thost = cfg.APP_DB_HOST.get_required()\n\t\n\t# This returns None if APP_DB_HOST is not set\n\thost = cfg.APP_DB_HOST.require()\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Manage your app configuration using env variables",
    "version": "0.0.2",
    "project_urls": {
        "Repository": "https://github.com/ErikDeSmedt/envia"
    },
    "split_keywords": [
        "config",
        "env"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "989f93f5b4b5aa4024278a96c2f57cbb4dffe37ec051931b095ecdf837963ed3",
                "md5": "17295044904ca74bb478152b7022be71",
                "sha256": "8b62a44d78b069616a49877fea5f103d449769b48269562f28dc4438fcda41a2"
            },
            "downloads": -1,
            "filename": "envia-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "17295044904ca74bb478152b7022be71",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5135,
            "upload_time": "2023-10-18T09:31:15",
            "upload_time_iso_8601": "2023-10-18T09:31:15.908053Z",
            "url": "https://files.pythonhosted.org/packages/98/9f/93f5b4b5aa4024278a96c2f57cbb4dffe37ec051931b095ecdf837963ed3/envia-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "38fef64b7acbab24178090ab31fc9fc2a191f0c7e9306f54a30dd7965ab5e0f6",
                "md5": "7e5d708d0480505de613ee7b62d2c481",
                "sha256": "4d2b5c18462f8000946a07285c48f9450e2369a6f1a94f1f405a523ac3379e45"
            },
            "downloads": -1,
            "filename": "envia-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7e5d708d0480505de613ee7b62d2c481",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4497,
            "upload_time": "2023-10-18T09:31:17",
            "upload_time_iso_8601": "2023-10-18T09:31:17.475386Z",
            "url": "https://files.pythonhosted.org/packages/38/fe/f64b7acbab24178090ab31fc9fc2a191f0c7e9306f54a30dd7965ab5e0f6/envia-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-18 09:31:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ErikDeSmedt",
    "github_project": "envia",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "envia"
}
        
Elapsed time: 0.12320s