| Name | antares-dotenv JSON |
| Version |
1.0.1
JSON |
| download |
| home_page | None |
| Summary | A minimal utility to load environment variables with automatic type casting. |
| upload_time | 2025-09-05 14:43:57 |
| maintainer | None |
| docs_url | None |
| author | Antares Mugisho |
| requires_python | <4.0,>=3.11 |
| license | MIT |
| keywords |
|
| VCS |
|
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Antares-Dotenv
A minimalistic and developer-friendly way to handle environment variables in Python. Just import `env` and start using it. No more boilerplate code for loading and parsing.
## Installation
```bash
pip install antares-dotenv
```
## Usage
Create a `.env` file in your project root:
```
# .env
# Strings
APP_NAME=My Awesome App
# Integers
PORT=8000
# Booleans
DEBUG=True
# Lists (comma-separated)
ALLOWED_HOSTS=localhost,127.0.0.1
# JSON
DATABASE_CONFIG={"user": "admin", "password": "secret"}
```
Now you can access these variables in your Python code:
```python
# main.py
from antares_dotenv import env
# String
app_name = env("APP_NAME", default="My App")
print(f"App Name: {app_name}")
# Integer (auto-parsed)
port = env("PORT")
print(f"Port: {port} (type: {type(port).__name__})")
# Boolean (auto-parsed)
debug_mode = env("DEBUG")
print(f"Debug Mode: {debug_mode} (type: {type(debug_mode).__name__})")
# List (auto-parsed)
allowed_hosts = env("ALLOWED_HOSTS")
print(f"Allowed Hosts: {allowed_hosts} (type: {type(allowed_hosts).__name__})")
# JSON (auto-parsed to dict)
db_config = env("DATABASE_CONFIG")
print(f"Database User: {db_config['user']}")
# Using a default value for a missing key
secret_key = env("SECRET_KEY", default="a-very-secret-key")
print(f"Secret Key: {secret_key}")
```
## Why Antares-Dotenv?
`antares-dotenv` is designed to reduce boilerplate and simplify your code.
**Before (with `python-dotenv` and `os`):**
```python
import os
from dotenv import load_dotenv
load_dotenv()
port = int(os.getenv("PORT"))
debug = os.getenv("DEBUG").lower() == 'true'
hosts = os.getenv("ALLOWED_HOSTS").split(',')
```
**After (with `antares-dotenv`):**
```python
from antares_dotenv import env
port = env("PORT")
debug = env("DEBUG")
hosts = env("ALLOWED_HOSTS")
```
`antares-dotenv` automatically handles the type casting for you, making your code cleaner and more readable.
*-- For personnal purposes*
Raw data
{
"_id": null,
"home_page": null,
"name": "antares-dotenv",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": null,
"author": "Antares Mugisho",
"author_email": "antaresmugisho@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/fe/7fd8b7688de856bf1718391e5b178e277c6841f965bf2b8fea1573dc6b91/antares_dotenv-1.0.1.tar.gz",
"platform": null,
"description": "# Antares-Dotenv\n\nA minimalistic and developer-friendly way to handle environment variables in Python. Just import `env` and start using it. No more boilerplate code for loading and parsing.\n\n## Installation\n\n```bash\npip install antares-dotenv\n```\n\n## Usage\n\nCreate a `.env` file in your project root:\n\n```\n# .env\n\n# Strings\nAPP_NAME=My Awesome App\n\n# Integers\nPORT=8000\n\n# Booleans\nDEBUG=True\n\n# Lists (comma-separated)\nALLOWED_HOSTS=localhost,127.0.0.1\n\n# JSON\nDATABASE_CONFIG={\"user\": \"admin\", \"password\": \"secret\"}\n```\n\nNow you can access these variables in your Python code:\n\n```python\n# main.py\n\nfrom antares_dotenv import env\n\n# String\napp_name = env(\"APP_NAME\", default=\"My App\")\nprint(f\"App Name: {app_name}\")\n\n# Integer (auto-parsed)\nport = env(\"PORT\")\nprint(f\"Port: {port} (type: {type(port).__name__})\")\n\n# Boolean (auto-parsed)\ndebug_mode = env(\"DEBUG\")\nprint(f\"Debug Mode: {debug_mode} (type: {type(debug_mode).__name__})\")\n\n# List (auto-parsed)\nallowed_hosts = env(\"ALLOWED_HOSTS\")\nprint(f\"Allowed Hosts: {allowed_hosts} (type: {type(allowed_hosts).__name__})\")\n\n# JSON (auto-parsed to dict)\ndb_config = env(\"DATABASE_CONFIG\")\nprint(f\"Database User: {db_config['user']}\")\n\n# Using a default value for a missing key\nsecret_key = env(\"SECRET_KEY\", default=\"a-very-secret-key\")\nprint(f\"Secret Key: {secret_key}\")\n```\n\n## Why Antares-Dotenv?\n\n`antares-dotenv` is designed to reduce boilerplate and simplify your code.\n\n**Before (with `python-dotenv` and `os`):**\n\n```python\nimport os\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\nport = int(os.getenv(\"PORT\"))\ndebug = os.getenv(\"DEBUG\").lower() == 'true'\nhosts = os.getenv(\"ALLOWED_HOSTS\").split(',')\n```\n\n**After (with `antares-dotenv`):**\n\n```python\nfrom antares_dotenv import env\n\nport = env(\"PORT\")\ndebug = env(\"DEBUG\")\nhosts = env(\"ALLOWED_HOSTS\")\n```\n\n`antares-dotenv` automatically handles the type casting for you, making your code cleaner and more readable.\n\n\n*-- For personnal purposes*",
"bugtrack_url": null,
"license": "MIT",
"summary": "A minimal utility to load environment variables with automatic type casting.",
"version": "1.0.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b3f3a0b098c6c30fcc8728dea02fb3eedad6144e8bbfb970cfc00bf2132ad320",
"md5": "d5043beea8fc5c249b6ab51585ef81bb",
"sha256": "06957593de6b29aaa2efbd287eafef66f2a44c0c7d0eebed47b4e8bc0055c830"
},
"downloads": -1,
"filename": "antares_dotenv-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d5043beea8fc5c249b6ab51585ef81bb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 3510,
"upload_time": "2025-09-05T14:43:56",
"upload_time_iso_8601": "2025-09-05T14:43:56.272601Z",
"url": "https://files.pythonhosted.org/packages/b3/f3/a0b098c6c30fcc8728dea02fb3eedad6144e8bbfb970cfc00bf2132ad320/antares_dotenv-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eafe7fd8b7688de856bf1718391e5b178e277c6841f965bf2b8fea1573dc6b91",
"md5": "e9579d3bb1f66bc2a306d3319de780b0",
"sha256": "7a185441e5eff984b0bdec9bf1bfc7a1fd66b25430508d3ef7d8bc50564ca032"
},
"downloads": -1,
"filename": "antares_dotenv-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "e9579d3bb1f66bc2a306d3319de780b0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 3404,
"upload_time": "2025-09-05T14:43:57",
"upload_time_iso_8601": "2025-09-05T14:43:57.615745Z",
"url": "https://files.pythonhosted.org/packages/ea/fe/7fd8b7688de856bf1718391e5b178e277c6841f965bf2b8fea1573dc6b91/antares_dotenv-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-05 14:43:57",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "antares-dotenv"
}