{"id":19165497,"url":"https://github.com/ghaztools/environmentloader","last_synced_at":"2026-02-25T11:39:14.021Z","repository":{"id":247290504,"uuid":"825463883","full_name":"GhazTools/EnvironmentLoader","owner":"GhazTools","description":"Environment Loader Package","archived":false,"fork":false,"pushed_at":"2024-07-24T02:43:36.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-29T22:31:34.349Z","etag":null,"topics":["env","pypi","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/environment-loader/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GhazTools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T21:04:44.000Z","updated_at":"2024-07-24T02:43:38.000Z","dependencies_parsed_at":"2024-07-24T04:57:55.887Z","dependency_job_id":null,"html_url":"https://github.com/GhazTools/EnvironmentLoader","commit_stats":null,"previous_names":["ghaztools/environmentloader"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/GhazTools/EnvironmentLoader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhazTools%2FEnvironmentLoader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhazTools%2FEnvironmentLoader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhazTools%2FEnvironmentLoader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhazTools%2FEnvironmentLoader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GhazTools","download_url":"https://codeload.github.com/GhazTools/EnvironmentLoader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GhazTools%2FEnvironmentLoader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29819451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T05:36:42.804Z","status":"ssl_error","status_checked_at":"2026-02-25T05:36:31.934Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["env","pypi","python"],"created_at":"2024-11-09T09:28:03.521Z","updated_at":"2026-02-25T11:39:13.975Z","avatar_url":"https://github.com/GhazTools.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EnvironmentLoader\n\n## Why I Made This?\nIt's often hard to find the right place to load your environment or ensure that there are no typos in your environment varaibles. This makes it so that you no longer have to worry about typos and on the first call of getting your environment variables the environment is loaded. Two birds one stone.\n\n## Description\nThe Environment class provides a structured way to manage environment variables in your Python application. By defining an enumeration of required environment keys, you can easily load, verify, and access these variables from a .env file or your system environment. This ensures that all necessary environment variables are available and properly set before your application runs.\n\n## Features\nSetup Environment Keys: Define the required environment keys using an enumeration.\nLoad Environment Variables: Load environment variables from a .env file or system environment.\nVerify Environment Variables: Ensure all required environment variables are present.\nAccess Environment Variables: Safely access the values of environment variables.\nInstallation\nInstall the environment-loader package:\n\n```bash\npython3 -m pip install environment-loader\n```\n\nSave the environment.py file in your project directory.\n\nUsage\nDefine your environment keys:\n\n```python\nfrom enum import Enum\n\nclass EnvironmentKeys(Enum):\n    DATABASE_URL = \"DATABASE_URL\"\n    SECRET_KEY = \"SECRET_KEY\"\n    API_KEY = \"API_KEY\"\nSetup and load environment variables:\n```\n\n```python\nCopy code\nfrom environment import Environment\n\n# Set up environment with keys and optional path to .env file\nEnvironment.setup_environment(environment_keys=EnvironmentKeys)\n\n# Load environment variables\nEnvironment.load_environment_variables()\n\n# Access a specific environment variable\ndatabase_url = Environment.get_environment_variable(EnvironmentKeys.DATABASE_URL)\nsecret_key = Environment.get_environment_variable(EnvironmentKeys.SECRET_KEY)\napi_key = Environment.get_environment_variable(EnvironmentKeys.API_KEY)\n\nprint(f\"Database URL: {database_url}\")\nprint(f\"Secret Key: {secret_key}\")\nprint(f\"API Key: {api_key}\")\nExample\n.env file\n```\nCreate a .env file in your project root with the following content:\n\n```env\nDATABASE_URL=postgres://user:password@localhost:5432/mydatabase\nSECRET_KEY=supersecretkey\nAPI_KEY=1234567890abcdef\n```\n\n\n```python\nfrom enum import Enum\nfrom environment import Environment\n\n# Define your environment keys\nclass EnvironmentKeys(Enum):\n    DATABASE_URL = \"DATABASE_URL\"\n    SECRET_KEY = \"SECRET_KEY\"\n    API_KEY = \"API_KEY\"\n\n# Set up the environment keys and path to .env file\nEnvironment.setup_environment(environment_keys=EnvironmentKeys, environment_path=\".env\")\n\n# Load the environment variables\nEnvironment.load_environment_variables()\n\n# Access and use the environment variables\ndatabase_url = Environment.get_environment_variable(EnvironmentKeys.DATABASE_URL)\nsecret_key = Environment.get_environment_variable(EnvironmentKeys.SECRET_KEY)\napi_key = Environment.get_environment_variable(EnvironmentKeys.API_KEY)\n\nprint(f\"Database URL: {database_url}\")\nprint(f\"Secret Key: {secret_key}\")\nprint(f\"API Key: {api_key}\")\n```\n\n\n# Conclusion\nThe Environment class simplifies the management of environment variables in your Python application. By defining required keys and verifying their presence, you can ensure that your application has all the necessary configuration before it runs.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghaztools%2Fenvironmentloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghaztools%2Fenvironmentloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghaztools%2Fenvironmentloader/lists"}