{ "info": { "author": "Ian Baldwin", "author_email": "ianbldwn@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Documentation" ], "description": "# Envclasses\n\n[![CircleCI](https://circleci.com/gh/sandal-tan/py-envclasses.svg?style=svg)](https://circleci.com/gh/sandal-tan/py-envclasses)\n\nEnvclasses are a thin wrapper around dataclasses which allows for the values to be defined via environment variables\nrather than explicitly in code. Values are typed and are able to be defaulted. \n\n## Motivation\n\nI got tired of writing code that was configured through environment variables, referencing the environment variable \nwhen I needed to instantiate something. This made it difficult to keep up with how I could configure that software that\nI was writing as I would have to comb through the code and make sure that the documentation was up to date. \n\nEnvclasses are an attempt to reduce the sprawl of configuration through environment variables and centralize\nconfiguration into a single, document-able class. They are both inspired by, and built on top of dataclasses, which is\nwhy their structure is so similar.\n\n## Usage\n\nDefining an environment class is simple:\n\n```python\n\nfrom envclasses import EnvClassMeta\n\nclass ApplicationConfig(metaclass=EnvClassMeta):\n\n db_url: str\n db_username: str\n db_password: str\n port: int = 5050\n mode: str = 'development'\n\n\nconfig = ApplicationConfig()\n```\n\nThe provided metaclass will turn the `ApplicationConfig` into a dataclass with fields defined from `os.environ`.\nThe metaclass will prioritize upper-case versions of fields before lower-case, that is to say `DB_URL` would be\nprioritized over `db_url`. Mixed-case variants are not considered.\n\nIf values are not defined, the metaclass will wait until all fields have been tested to report which are missing. In the\nevent that we should ignore missing fields, the environment variable `env_ignore_missing` should be defined as `true` or\n`yes`.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sandal-tan/pyenvclasses", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyenvclasses", "package_url": "https://pypi.org/project/pyenvclasses/", "platform": "", "project_url": "https://pypi.org/project/pyenvclasses/", "project_urls": { "Homepage": "https://github.com/sandal-tan/pyenvclasses" }, "release_url": "https://pypi.org/project/pyenvclasses/2019.9.10/", "requires_dist": null, "requires_python": "~=3.7", "summary": "Dataclass wrapper to facilitate application configuration from the environment.", "version": "2019.9.10" }, "last_serial": 5811861, "releases": { "2019.9.10": [ { "comment_text": "", "digests": { "md5": "20dba3df941f5bacf2bcb3d3fc6bec36", "sha256": "1d3e4e8eeef7db36de75888d4c8e0dcbb3ce7580c2a30fa0ae867426160202c0" }, "downloads": -1, "filename": "pyenvclasses-2019.9.10.tar.gz", "has_sig": false, "md5_digest": "20dba3df941f5bacf2bcb3d3fc6bec36", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.7", "size": 3951, "upload_time": "2019-09-10T22:45:27", "url": "https://files.pythonhosted.org/packages/72/dd/622e23165e1ddbc610a8bf33ae9654e3da4305f220570c961cf9aed28a5e/pyenvclasses-2019.9.10.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "20dba3df941f5bacf2bcb3d3fc6bec36", "sha256": "1d3e4e8eeef7db36de75888d4c8e0dcbb3ce7580c2a30fa0ae867426160202c0" }, "downloads": -1, "filename": "pyenvclasses-2019.9.10.tar.gz", "has_sig": false, "md5_digest": "20dba3df941f5bacf2bcb3d3fc6bec36", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.7", "size": 3951, "upload_time": "2019-09-10T22:45:27", "url": "https://files.pythonhosted.org/packages/72/dd/622e23165e1ddbc610a8bf33ae9654e3da4305f220570c961cf9aed28a5e/pyenvclasses-2019.9.10.tar.gz" } ] }