# EnvEase
[Persian Immortal Studios](https://github.com/Persian-Immortal) presents, A Python package to easily work with environment variables, inspired by the method used in [Laravel](https://github.com/laravel/laravel) framework to read the `.env` file.
## Installation
You can install `envease` via pip:
```bash
pip install envease
```
## Usage
if you only want to use a single `.env` file where the python file is located then you can import the package like this:
```py
from envease import env
```
then the usage is gonna be simple:
```bash
# inside the .env file
KEY="Hello, World"
```
```py
print(env('KEY')) # prints the "Hello, World" message
```
---
else if you want to use other environment variable files than `.env` you can use the package like this:
```py
from envease import *
load_env_file('file_name')
print('KEY') # this prints the value inside the 'KEY' inside the 'file_name' file
```
---
you can even dynamically call different environment variable files
```py
from envease import *
env_files = {
"first": ".first.env",
"second": ".second.env",
"third": ".third.env",
}
load_multiple(env_files)
print(dynamic_env('first', 'KEY')) # this will print the value addressed with 'KEY' inside the .first.env file
```
> ***Notice:*** you can as well handle default values if the returned value is null!
```py
print('KEY', 'default value') # this prints the value addressed with 'KEY' inside the environment variables. if it was null it will print 'default value' as a string
print(dynamic_env('first', 'KEY'), 'default value') # this prints the value addressed with 'KEY' inside the environment variables addressed with 'first' key in the dictionary. if it was null it will print 'default value' as a string
```
---
# Contributing
Contributions are welcome! If you have any suggestions, feature requests, or bug reports, please [open an issue](https://github.com/Persian-Immortal/envease/issues/new) or submit a pull request.
# License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/Persian-Immortal/envutils",
"name": "envease",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "management,organizing,variables,variable,environment,environment variables,easy,simple,simplest,easiest",
"author": "Alireza Abedini",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/95/33/02c7eaed949bcbaa1c8605654ffe2b1bfd656975799549d0503e8724cb79/envease-1.0.1.tar.gz",
"platform": null,
"description": "# EnvEase\n[Persian Immortal Studios](https://github.com/Persian-Immortal) presents, A Python package to easily work with environment variables, inspired by the method used in [Laravel](https://github.com/laravel/laravel) framework to read the `.env` file. \n\n## Installation\nYou can install `envease` via pip:\n```bash\npip install envease\n```\n\n## Usage\nif you only want to use a single `.env` file where the python file is located then you can import the package like this:\n```py\nfrom envease import env\n```\nthen the usage is gonna be simple:\n```bash\n# inside the .env file\nKEY=\"Hello, World\"\n```\n```py\nprint(env('KEY')) # prints the \"Hello, World\" message\n```\n---\nelse if you want to use other environment variable files than `.env` you can use the package like this:\n```py\nfrom envease import *\n\nload_env_file('file_name')\nprint('KEY') # this prints the value inside the 'KEY' inside the 'file_name' file\n```\n---\nyou can even dynamically call different environment variable files\n```py\nfrom envease import *\nenv_files = {\n \"first\": \".first.env\",\n \"second\": \".second.env\",\n \"third\": \".third.env\",\n}\n\nload_multiple(env_files)\n\nprint(dynamic_env('first', 'KEY')) # this will print the value addressed with 'KEY' inside the .first.env file\n```\n> ***Notice:*** you can as well handle default values if the returned value is null!\n```py\nprint('KEY', 'default value') # this prints the value addressed with 'KEY' inside the environment variables. if it was null it will print 'default value' as a string\nprint(dynamic_env('first', 'KEY'), 'default value') # this prints the value addressed with 'KEY' inside the environment variables addressed with 'first' key in the dictionary. if it was null it will print 'default value' as a string\n```\n\n---\n\n# Contributing\nContributions are welcome! If you have any suggestions, feature requests, or bug reports, please [open an issue](https://github.com/Persian-Immortal/envease/issues/new) or submit a pull request.\n\n# License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python package to easily work with environment variables, inspired by the method used in Laravel framework to read the .env file.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/Persian-Immortal/envutils"
},
"split_keywords": [
"management",
"organizing",
"variables",
"variable",
"environment",
"environment variables",
"easy",
"simple",
"simplest",
"easiest"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58170ac443bc686a2571935d66c73205c5f4b441fb014f8ff1013e4ac3fc1143",
"md5": "d00f2e3639443d4b55189ddd01ab0b38",
"sha256": "0671e93f163503eb197b183b423d60882b937c09158f8ae62039244ccd9d93c0"
},
"downloads": -1,
"filename": "envease-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d00f2e3639443d4b55189ddd01ab0b38",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3082,
"upload_time": "2024-02-29T08:50:53",
"upload_time_iso_8601": "2024-02-29T08:50:53.183791Z",
"url": "https://files.pythonhosted.org/packages/58/17/0ac443bc686a2571935d66c73205c5f4b441fb014f8ff1013e4ac3fc1143/envease-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "953302c7eaed949bcbaa1c8605654ffe2b1bfd656975799549d0503e8724cb79",
"md5": "b03da3f6e2aafb4058d7e7854ee95ec4",
"sha256": "1755f5cfb3e7ac764cfbd0b14974a8aaffd819fc95fde370acce0db53744e159"
},
"downloads": -1,
"filename": "envease-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "b03da3f6e2aafb4058d7e7854ee95ec4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3420,
"upload_time": "2024-02-29T08:50:54",
"upload_time_iso_8601": "2024-02-29T08:50:54.652153Z",
"url": "https://files.pythonhosted.org/packages/95/33/02c7eaed949bcbaa1c8605654ffe2b1bfd656975799549d0503e8724cb79/envease-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-29 08:50:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Persian-Immortal",
"github_project": "envutils",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "envease"
}