{"id":16489159,"url":"https://github.com/va1/smart-getenv","last_synced_at":"2026-03-05T09:03:21.735Z","repository":{"id":34046819,"uuid":"37822878","full_name":"Va1/smart-getenv","owner":"Va1","description":"Wrapper for os.getenv that achieves return values of a specified type","archived":false,"fork":false,"pushed_at":"2019-03-03T22:32:16.000Z","size":11,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T14:43:54.840Z","etag":null,"topics":["env","environment-variables","python","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Va1.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-21T19:35:03.000Z","updated_at":"2020-10-15T10:45:15.000Z","dependencies_parsed_at":"2022-07-14T03:10:32.802Z","dependency_job_id":null,"html_url":"https://github.com/Va1/smart-getenv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Va1%2Fsmart-getenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Va1%2Fsmart-getenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Va1%2Fsmart-getenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Va1%2Fsmart-getenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Va1","download_url":"https://codeload.github.com/Va1/smart-getenv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245104460,"owners_count":20561377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","environment-variables","python","python3"],"created_at":"2024-10-11T13:43:22.210Z","updated_at":"2026-03-05T09:03:21.257Z","avatar_url":"https://github.com/Va1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Python smart getenv\n===================\n\nSince environment variables in os.environ are strings, it often appears inconvenient to store and retrieve other\ndata types such as bool or list. The package provides a single function that wraps os.getenv and allows\nyou to specify the desired variable type.\n\nTested and supported types: str, int, float, list. tuple, dict.\n\n`PyPi page`_\n\nUsage\n-----\n\nInstall:\n\n.. code:: bash\n\n    $ pip install smart-getenv\n\n\nPrepare the variables:\n\n.. code:: bash\n\n    $ export BOOLEAN=true\n    $ export LIST=a,b,c\n    $ export TRICKY_LIST=d:e:f\n    $ export DICT=\"{'foo':'bar'}\"\n\nGet them:\n\n.. code:: python\n\n    \u003e\u003e\u003e from smart_getenv import getenv\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e getenv('BOOLEAN', type=str)\n    'true'\n    \u003e\u003e\u003e getenv('BOOLEAN', type=bool)\n    True\n    \u003e\u003e\u003e getenv('LIST', type=list)\n    ['a', 'b', 'c']\n    \u003e\u003e\u003e getenv('LIST', type=tuple)\n    ('a', 'b', 'c')\n    \u003e\u003e\u003e getenv('TRICKY_LIST', type=list, separator=':')\n    ['d', 'e', 'f']\n    \u003e\u003e\u003e getenv('DICT', type=dict)\n    {'foo': 'bar'}\n    \u003e\u003e\u003e getenv('LOST', default='default value anyone?')\n    'default value anyone?'\n\nRun tests:\n\n.. code:: bash\n\n    $ python tests.py\n\n.. _PyPi page: https://pypi.python.org/pypi/smart-getenv\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fva1%2Fsmart-getenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fva1%2Fsmart-getenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fva1%2Fsmart-getenv/lists"}