{ "info": { "author": "Simon Brunning", "author_email": "simon@brunningonline.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Testing" ], "description": "# brunns-row\n\nConvenience wrapper for DB API and csv.DictReader rows, and similar, inspired by Greg Stein's lovely [dtuple module](https://code.activestate.com/recipes/81252-using-dtuple-for-flexible-query-result-access/).\n\n[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)\n[![Build Status](https://travis-ci.org/brunns/brunns-row.svg?branch=master&logo=travis)](https://travis-ci.org/brunns/brunns-row)\n[![PyPi Version](https://img.shields.io/pypi/v/brunns-row.svg?logo=pypi)](https://pypi.org/project/brunns-row/#history)\n[![Python Versions](https://img.shields.io/pypi/pyversions/brunns-row.svg?logo=python)](https://pypi.org/project/brunns-row/)\n[![Licence](https://img.shields.io/github/license/brunns/brunns-row.svg)](https://github.com/brunns/brunns-row/blob/master/LICENSE)\n[![GitHub all releases](https://img.shields.io/github/downloads/brunns/brunns-row/total.svg?logo=github)](https://github.com/brunns/brunns-row/releases/)\n[![GitHub forks](https://img.shields.io/github/forks/brunns/brunns-row.svg?label=Fork&logo=github)](https://github.com/brunns/brunns-row/network/members)\n[![GitHub stars](https://img.shields.io/github/stars/brunns/brunns-row.svg?label=Star&logo=github)](https://github.com/brunns/brunns-row/stargazers/)\n[![GitHub watchers](https://img.shields.io/github/watchers/brunns/brunns-row.svg?label=Watch&logo=github)](https://github.com/brunns/brunns-row/watchers/)\n[![GitHub contributors](https://img.shields.io/github/contributors/brunns/brunns-row.svg?logo=github)](https://github.com/brunns/brunns-row/graphs/contributors/)\n[![GitHub issues](https://img.shields.io/github/issues/brunns/brunns-row.svg?logo=github)](https://github.com/brunns/brunns-row/issues/)\n[![GitHub issues-closed](https://img.shields.io/github/issues-closed/brunns/brunns-row.svg?logo=github)](https://github.com/brunns/brunns-row/issues?q=is%3Aissue+is%3Aclosed)\n[![GitHub pull-requests](https://img.shields.io/github/issues-pr/brunns/brunns-row.svg?logo=github)](https://github.com/brunns/brunns-row/pulls)\n[![GitHub pull-requests closed](https://img.shields.io/github/issues-pr-closed/brunns/brunns-row.svg?logo=github)](https://github.com/brunns/brunns-row/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aclosed)\n[![](https://tokei.rs/b1/github/brunns/brunns-row)](https://github.com/brunns/brunns-row)\n\n## Setup\n\nInstall with pip:\n\n pip install brunns-row\n\n(As usual, use of a [venv](https://docs.python.org/3/library/venv.html) or [virtualenv](https://virtualenv.pypa.io) is recommended.)\n\n## Usage\n\nThe basic approach is to create a wrapper object from some kind of description - typically a \n[DBAPI cursor](https://www.python.org/dev/peps/pep-0249/#cursor-objects)'s \n[description](https://www.python.org/dev/peps/pep-0249/#description), or a \n[csv.DictReader](https://docs.python.org/3/library/csv.html#csv.DictReader)'s \n[fieldnames](https://docs.python.org/3/library/csv.html#csv.csvreader.fieldnames) attribute - then to use the wrapper's \n`wrap(row)` method to wrap each row. `wrap(row)` returns an object from which you can access the row's fields as \nattributes. A couple of simple examples:\n\n### DB API\n\n```python\ncursor = conn.cursor()\ncursor.execute(\"SELECT kind, rating FROM sausages ORDER BY rating DESC;\")\nwrapper = RowWrapper(cursor.description)\nrows = [wrapper.wrap(row) for row in cursor.fetchall()]\nfor row in rows:\n print(row.kind, row.rating)\n```\n\n### csv.DictReader\n\n```python\nreader = csv.DictReader(csv_file)\nwrapper = RowWrapper(reader.fieldnames)\nrows = [wrapper.wrap(row) for row in reader]\nfor row in rows:\n print(row.kind, row.rating)\n```\n\nAttributes names are simply the column names where possible, converted to valid identifiers where necessary by replacing \ninvalid characters with \"\\_\"s, prefixing any leading numerics with \"a\\_\", and de-duplicating where necessary by adding \nnumeric suffixes.\n\n## Developing\n\nRequires [tox](https://tox.readthedocs.io). Run `make precommit` tells you if you're OK to commit. For more options, run:\n\n make help\n\n## Releasing\n\nRequires [hub](https://hub.github.com/), [setuptools](https://setuptools.readthedocs.io), [wheel](https://pypi.org/project/wheel/) and [twine](https://twine.readthedocs.io). To release `n.n.n`:\n\n version=\"n.n.n\"\n make precommit && git commit -am\"Release $version\" && git push # If not already all pushed, which it should be.\n hub release create $version -m\"Release $version\"\n python setup.py sdist bdist_wheel\n twine upload dist/*$version*\n\nQuick version:\n\n version=\"n.n.n\"\n git commit -am\"Release $version\" && git push && hub release create $version -m\"Release $version\" && python setup.py sdist bdist_wheel && twine upload dist/*$version*\n\n\n", "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/brunns/brunns-row/", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "brunns-row", "package_url": "https://pypi.org/project/brunns-row/", "platform": "", "project_url": "https://pypi.org/project/brunns-row/", "project_urls": { "Homepage": "https://github.com/brunns/brunns-row/" }, "release_url": "https://pypi.org/project/brunns-row/2.0.0/", "requires_dist": null, "requires_python": ">=3.4", "summary": "Convenience wrapper for DB API and csv.DictReader rows, and similar.", "version": "2.0.0" }, "last_serial": 4791109, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "7594b6e3479ca1369363bed53027268e", "sha256": "fbb122af121190f23e2b5f957581b52b74a9b5068a180dcdae504eada7440041" }, "downloads": -1, "filename": "brunns_row-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7594b6e3479ca1369363bed53027268e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 4628, "upload_time": "2018-12-10T11:36:37", "url": "https://files.pythonhosted.org/packages/6d/02/8a48753bf54fabacccda21bb1d18927ac99b29e7a6bbc962db17be392faf/brunns_row-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d862dc4f23170b03b97d36012be6341e", "sha256": "67decc1d8cfd08abf57a6f44412db66045176eef2e6e63b96e6e22524b13885a" }, "downloads": -1, "filename": "brunns-row-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d862dc4f23170b03b97d36012be6341e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 3602, "upload_time": "2018-12-10T11:35:52", "url": "https://files.pythonhosted.org/packages/0c/57/57e2eb1bad2ef0b333e773bc1025d78b5fb41b17e08ba4e41d13b9f89afb/brunns-row-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "ef6472d667ca185a55cf6bc10a247fab", "sha256": "db77c46bd6921e5e4ede995aa9cd1b58fbe2580fa66ce00ff17d3826a73531cd" }, "downloads": -1, "filename": "brunns_row-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ef6472d667ca185a55cf6bc10a247fab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 4628, "upload_time": "2018-12-10T11:38:04", "url": "https://files.pythonhosted.org/packages/30/06/a42fc9b55e7ed1470d00166abfbc8241175a580069e481cb1ea17374c766/brunns_row-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "661852f3dc0791a7e8fc116118464efa", "sha256": "cbbaa4dbcbd69bd60806d4e28a5ff4d939b83f3b01ecda9264ab6cc0827f6b44" }, "downloads": -1, "filename": "brunns-row-1.0.1.tar.gz", "has_sig": false, "md5_digest": "661852f3dc0791a7e8fc116118464efa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 3816, "upload_time": "2018-12-10T11:38:05", "url": "https://files.pythonhosted.org/packages/08/95/b9c94c70a3ecbfe22ad039c518cd9bff610fe027d2abe0d4d48d1fa3c93c/brunns-row-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "8a354dd2890ac206aa42712cc2b5d18d", "sha256": "680bb033770e14c854ed91c7221bfb526a6c01ac997cd252fe50c4a4b16f4d61" }, "downloads": -1, "filename": "brunns_row-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8a354dd2890ac206aa42712cc2b5d18d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 5607, "upload_time": "2019-01-03T14:40:16", "url": "https://files.pythonhosted.org/packages/2a/7e/b3386953822ac067824e7af79550f0488535810791faee5046394edb596e/brunns_row-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f0ebcf13366389983ec4e58be952304b", "sha256": "980ea2fd528539de99188dc71c0507531ac1be3ca9cd60ecf29d844acfee9fb3" }, "downloads": -1, "filename": "brunns-row-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f0ebcf13366389983ec4e58be952304b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 4644, "upload_time": "2019-01-03T14:40:17", "url": "https://files.pythonhosted.org/packages/f5/41/08fb77714acf6da05b34cc52252eea664805a3e5c407d55cb2f13f135ae4/brunns-row-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "2aaac53991bca6b803da4c73348c7ab9", "sha256": "29e8d580396378597b7371a13a518a02c82a5699d091e9a403af224168f476fc" }, "downloads": -1, "filename": "brunns_row-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2aaac53991bca6b803da4c73348c7ab9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 5709, "upload_time": "2019-02-02T08:32:58", "url": "https://files.pythonhosted.org/packages/12/4c/6fab64094191a17628f4e2a5a7aac63bc07ab0506c715acd9edec7cd5a41/brunns_row-1.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ec7fd261a35cd27a318ab7311bf5e9b", "sha256": "fcc2e7052007fe02db8ba3b56e4d1ae566df56d112da0ee1ea7a26c120002d9e" }, "downloads": -1, "filename": "brunns-row-1.1.1.tar.gz", "has_sig": false, "md5_digest": "8ec7fd261a35cd27a318ab7311bf5e9b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 4760, "upload_time": "2019-02-02T08:32:59", "url": "https://files.pythonhosted.org/packages/a4/a9/8e771982ac1d67c7d178230695c51a8a658f17a9b93b2cd888f863f210d8/brunns-row-1.1.1.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "54bf69bb4675ec10c26e49fe9d50336b", "sha256": "873d5e8bd84eae22c2b21e4ffabfde9db658560dabe49b4623ea77f04002ee5b" }, "downloads": -1, "filename": "brunns_row-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "54bf69bb4675ec10c26e49fe9d50336b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 5612, "upload_time": "2019-02-07T14:00:10", "url": "https://files.pythonhosted.org/packages/db/78/901d1b0f4d10b50ccc711b8a6f34e9188a1a9c24032ba74fc64ccdcfb1ad/brunns_row-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e4e316af2c2b4cba91c63c0cb2445ba7", "sha256": "5cab3c5af3a3b08b2a9287493a50dabe2dc129c1816d1988101aea6b3d9baccd" }, "downloads": -1, "filename": "brunns-row-2.0.0.tar.gz", "has_sig": false, "md5_digest": "e4e316af2c2b4cba91c63c0cb2445ba7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 4633, "upload_time": "2019-02-07T14:00:11", "url": "https://files.pythonhosted.org/packages/52/f0/345346178f8a3e3b38b2af427f01572ca3890f0c3eb373e14b7116eefa58/brunns-row-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "54bf69bb4675ec10c26e49fe9d50336b", "sha256": "873d5e8bd84eae22c2b21e4ffabfde9db658560dabe49b4623ea77f04002ee5b" }, "downloads": -1, "filename": "brunns_row-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "54bf69bb4675ec10c26e49fe9d50336b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 5612, "upload_time": "2019-02-07T14:00:10", "url": "https://files.pythonhosted.org/packages/db/78/901d1b0f4d10b50ccc711b8a6f34e9188a1a9c24032ba74fc64ccdcfb1ad/brunns_row-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e4e316af2c2b4cba91c63c0cb2445ba7", "sha256": "5cab3c5af3a3b08b2a9287493a50dabe2dc129c1816d1988101aea6b3d9baccd" }, "downloads": -1, "filename": "brunns-row-2.0.0.tar.gz", "has_sig": false, "md5_digest": "e4e316af2c2b4cba91c63c0cb2445ba7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 4633, "upload_time": "2019-02-07T14:00:11", "url": "https://files.pythonhosted.org/packages/52/f0/345346178f8a3e3b38b2af427f01572ca3890f0c3eb373e14b7116eefa58/brunns-row-2.0.0.tar.gz" } ] }