{ "info": { "author": "Christopher Rink", "author_email": "chrisrink10@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# bindr\n\n![PyPI](https://img.shields.io/pypi/v/bindr.svg?style=flat-square) ![python](https://img.shields.io/pypi/pyversions/bindr.svg?style=flat-square) ![TravisCI](https://img.shields.io/travis/chrisrink10/bindr.svg?style=flat-square) ![Coveralls github](https://img.shields.io/coveralls/github/chrisrink10/bindr.svg?style=flat-square) ![license](https://img.shields.io/github/license/chrisrink10/bindr.svg?style=flat-square)\n\nBind dictionary data into named tuples and dataclasses automatically\nfor typed attribute access throughout the rest of your codebase.\n\n```python\nfrom bindr import bind\nfrom typing import Dict, List, NamedTuple\nfrom yaml import safe_load\n\nclass Config(NamedTuple):\n class SMSServiceConfig(NamedTuple):\n host: str\n port: int\n username: str\n password: str\n\n class S3Config(NamedTuple):\n default_bucket: str\n default_region: str\n max_item_size: int\n\n support_emails: List[str]\n api_key: str\n timeout_ms: int\n pi: float\n sms_providers: List[SMSServiceConfig]\n s3_settings: S3Config\n accounts: Dict[str, str]\n\nconfig = bind(Config, safe_load(\"config.yaml\"))\nconfig.s3_settings.max_item_size # <-- int\n```\n\n## Installation\n\nBindr is developed on [GitHub](https://github.com/chrisrink10/bindr) and \nhosted on [PyPI](https://pypi.python.org/pypi/bindr). You can fetch Bindr \nusing a simple:\n\n```bash\npip install bindr\n```\n\n## Why does this exist?\n\nBindr is not meant to serve as a replacement for [12Factor](https://12factor.net/)\nmethodology. There are certain niche cases where you might want to read\nin a structured file (such as JSON or YAML) and bind it directly to a\ntyped object outside of application configuration (as demonstrated in the\nexample above). In fact, application configuration created as a dictionary\n(perhaps from environment variables) is still a valid use case for a bound \nobject.\n\nBindr exists as an alternative to the automatic binding syntax offered\nby [PyYAML](https://pyyaml.org/). The default object deserialization syntax\nin PyYAML is a leaky abstraction. Declarative data formats such as YAML \nshould not be concerned with the details of how objects are deserialized \nin your application code.\n\nObjects generated via Bindr will give you typed objects that can be passed\naround and verified by MyPy and hinted in PyCharm, which is a distinct\nadvantage over accessing multiple levels deep of nested dictionaries.\n\n## License\n\nMIT License\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/chrisrink10/bindr", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "bindr", "package_url": "https://pypi.org/project/bindr/", "platform": "", "project_url": "https://pypi.org/project/bindr/", "project_urls": { "Homepage": "http://github.com/chrisrink10/bindr" }, "release_url": "https://pypi.org/project/bindr/0.1.1/", "requires_dist": null, "requires_python": ">=3.6.0", "summary": "Data binding", "version": "0.1.1" }, "last_serial": 4509300, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ef5f9592d8f4a01c07d19aba9afa2db4", "sha256": "3db02ef14b7036f9da4fe1637fdf4cd5fc2d638c5bdeeb1739f10d6c9c4fbb47" }, "downloads": -1, "filename": "bindr-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ef5f9592d8f4a01c07d19aba9afa2db4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 4925, "upload_time": "2018-11-20T15:09:17", "url": "https://files.pythonhosted.org/packages/34/d9/3a6b101084c78bfd672e0530ce328e25138eeb70d49ce61d2680d68745f0/bindr-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6edd6ebd0f1792d92edffc07eb0e734", "sha256": "8c58a600874e6bb6702e6e7f36889db13b40379f768ac7333dc36012a48c1f12" }, "downloads": -1, "filename": "bindr-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f6edd6ebd0f1792d92edffc07eb0e734", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5060, "upload_time": "2018-11-20T15:09:18", "url": "https://files.pythonhosted.org/packages/a9/cc/029147edc914b1b850b4138a905a7878da1f63bede88699792fd4f8e6886/bindr-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "efe003e0839cbb7d91c2e18eccdfa3a6", "sha256": "73b57e43321d7321a0ef69cc817c67b7f06bd7d6c5b8c2465eacaea97fe33fc6" }, "downloads": -1, "filename": "bindr-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "efe003e0839cbb7d91c2e18eccdfa3a6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 5185, "upload_time": "2018-11-20T20:41:52", "url": "https://files.pythonhosted.org/packages/9d/ac/9ea4ae1f6f193470f614a2c34172daebcebc0a2e069b3d9ec432465e623f/bindr-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88fa53d589ffcbc127a04a29ce2a8803", "sha256": "56fa0a9147c41414df869388040c285ee77fc9ec810b1aae43f1d455bd41f5fa" }, "downloads": -1, "filename": "bindr-0.1.1.tar.gz", "has_sig": false, "md5_digest": "88fa53d589ffcbc127a04a29ce2a8803", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5322, "upload_time": "2018-11-20T20:41:53", "url": "https://files.pythonhosted.org/packages/27/cd/64b4baa29484cc173740e9f4c8a4d53bd3c38a23f56c42ccb70830cf33ed/bindr-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "efe003e0839cbb7d91c2e18eccdfa3a6", "sha256": "73b57e43321d7321a0ef69cc817c67b7f06bd7d6c5b8c2465eacaea97fe33fc6" }, "downloads": -1, "filename": "bindr-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "efe003e0839cbb7d91c2e18eccdfa3a6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 5185, "upload_time": "2018-11-20T20:41:52", "url": "https://files.pythonhosted.org/packages/9d/ac/9ea4ae1f6f193470f614a2c34172daebcebc0a2e069b3d9ec432465e623f/bindr-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88fa53d589ffcbc127a04a29ce2a8803", "sha256": "56fa0a9147c41414df869388040c285ee77fc9ec810b1aae43f1d455bd41f5fa" }, "downloads": -1, "filename": "bindr-0.1.1.tar.gz", "has_sig": false, "md5_digest": "88fa53d589ffcbc127a04a29ce2a8803", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5322, "upload_time": "2018-11-20T20:41:53", "url": "https://files.pythonhosted.org/packages/27/cd/64b4baa29484cc173740e9f4c8a4d53bd3c38a23f56c42ccb70830cf33ed/bindr-0.1.1.tar.gz" } ] }