{"html_url": "https://github.com/simonw/datasette/pull/1512#issuecomment-971056169", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1512", "id": 971056169, "node_id": "IC_kwDOBm6k_c454SQp", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-17T01:39:44Z", "updated_at": "2021-11-17T01:39:44Z", "author_association": "OWNER", "body": "Closing this PR because I shipped the code in it as a separate library instead.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1055402144, "label": "New pattern for async view classes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1512#issuecomment-971055677", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1512", "id": 971055677, "node_id": "IC_kwDOBm6k_c454SI9", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-17T01:39:25Z", "updated_at": "2021-11-17T01:39:25Z", "author_association": "OWNER", "body": "https://github.com/simonw/asyncinject version 0.1a0 is now live on PyPI: https://pypi.org/project/asyncinject/", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1055402144, "label": "New pattern for async view classes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1512#issuecomment-971010724", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1512", "id": 971010724, "node_id": "IC_kwDOBm6k_c454HKk", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-17T01:12:22Z", "updated_at": "2021-11-17T01:12:22Z", "author_association": "OWNER", "body": "I'm going to extract out the `asyncinject` stuff into a separate library.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1055402144, "label": "New pattern for async view classes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1512#issuecomment-970861628", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1512", "id": 970861628, "node_id": "IC_kwDOBm6k_c453iw8", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-16T23:46:07Z", "updated_at": "2021-11-16T23:46:07Z", "author_association": "OWNER", "body": "I made the changes locally and tested them with Python 3.6 like so:\r\n```\r\ncd /tmp\r\nmkdir v\r\ncd v\r\npipenv shell --python=python3.6\r\ncd ~/Dropbox/Development/datasette\r\npip install -e '.[test]'\r\npytest tests/test_asyncdi.py\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1055402144, "label": "New pattern for async view classes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1512#issuecomment-970857411", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1512", "id": 970857411, "node_id": "IC_kwDOBm6k_c453hvD", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-16T23:43:21Z", "updated_at": "2021-11-16T23:43:21Z", "author_association": "OWNER", "body": "```\r\nE File \"/home/runner/work/datasette/datasette/datasette/utils/vendored_graphlib.py\", line 56\r\nE if (result := self._node2info.get(node)) is None:\r\nE ^\r\nE SyntaxError: invalid syntax\r\n```\r\nOh no - the vendored code I use has `:=` so doesn't work on Python 3.6! Will have to backport it more thoroughly.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1055402144, "label": "New pattern for async view classes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1512#issuecomment-970718337", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1512", "id": 970718337, "node_id": "IC_kwDOBm6k_c452_yB", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-16T22:02:30Z", "updated_at": "2021-11-16T22:02:30Z", "author_association": "OWNER", "body": "I've decided to make the clever `asyncio` dependency injection opt-in - so you can either decorate with `@inject` or you can set `inject_all = True` on the class - for example:\r\n```python\r\nimport asyncio\r\nfrom datasette.utils.asyncdi import AsyncBase, inject\r\n\r\n\r\nclass Simple(AsyncBase):\r\n def __init__(self):\r\n self.log = []\r\n\r\n @inject\r\n async def two(self):\r\n self.log.append(\"two\")\r\n\r\n @inject\r\n async def one(self, two):\r\n self.log.append(\"one\")\r\n return self.log\r\n\r\n async def not_inject(self, one, two):\r\n return one + two\r\n\r\n\r\nclass Complex(AsyncBase):\r\n inject_all = True\r\n\r\n def __init__(self):\r\n self.log = []\r\n\r\n async def b(self):\r\n self.log.append(\"b\")\r\n\r\n async def a(self, b):\r\n self.log.append(\"a\")\r\n\r\n async def go(self, a):\r\n self.log.append(\"go\")\r\n return self.log\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1055402144, "label": "New pattern for async view classes"}, "performed_via_github_app": null}