html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app
https://github.com/simonw/datasette/issues/446#issuecomment-489167692,https://api.github.com/repos/simonw/datasette/issues/446,489167692,MDEyOklzc3VlQ29tbWVudDQ4OTE2NzY5Mg==,9599,2019-05-03T17:02:24Z,2019-05-03T17:02:24Z,OWNER,"I looked at using namedtuples for this but hey have one major constraint: there isn't a clean way to convert them to dictionary-style JSON: https://bugs.python.org/issue30343
So something that uses a class which knows how to be rendered as JSON would be a better fit.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",440134714,
https://github.com/simonw/datasette/issues/446#issuecomment-489204605,https://api.github.com/repos/simonw/datasette/issues/446,489204605,MDEyOklzc3VlQ29tbWVudDQ4OTIwNDYwNQ==,9599,2019-05-03T18:59:51Z,2019-05-03T18:59:59Z,OWNER,"Potential design:
```python
from collections import OrderedDict
class DataSpec:
__slots__ = []
def __init__(self, **kwargs):
if list(kwargs.keys()) != self.__slots__:
raise TypeError(
""{}() has required arguments {} (got {})"".format(
self.__class__.__name__, self.__slots__, list(kwargs.keys())
)
)
for key in self.__slots__:
setattr(self, key, kwargs[key])
def __repr__(self):
return ""<{} {}>"".format(self.__class__.__name__, dict(self.as_dict()))
def as_dict(self):
return OrderedDict([(key, getattr(self, key)) for key in self.__slots__])
class Output(DataSpec):
__slots__ = [""body"", ""content_type"", ""status_code""]
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",440134714,
https://github.com/simonw/datasette/issues/446#issuecomment-489209255,https://api.github.com/repos/simonw/datasette/issues/446,489209255,MDEyOklzc3VlQ29tbWVudDQ4OTIwOTI1NQ==,9599,2019-05-03T19:15:23Z,2019-05-03T19:16:34Z,OWNER,"The `register_output_renderer()` hook currently returns a dictionary with `body`, `content_type` and `status_code` keys but each of these keys are optionaly. I'm tempted to make all three required to better fit this model - @russss any objections?
Alternative would be to support default values for properties of the `DataSpec` subclass - maybe:
`__defaults__ = {""body"": """", ""content_type"": ""text/plain"", ""status_code"": 200}`","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",440134714,
https://github.com/simonw/datasette/issues/446#issuecomment-489221481,https://api.github.com/repos/simonw/datasette/issues/446,489221481,MDEyOklzc3VlQ29tbWVudDQ4OTIyMTQ4MQ==,45057,2019-05-03T19:58:31Z,2019-05-03T19:58:31Z,CONTRIBUTOR,"In this particular case I don't think there's an issue making all those required. However, I suspect we might have to allow optional values at some point - my preferred solution to russss/datasette-geo#2 would need one.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",440134714,
https://github.com/simonw/datasette/issues/446#issuecomment-489222223,https://api.github.com/repos/simonw/datasette/issues/446,489222223,MDEyOklzc3VlQ29tbWVudDQ4OTIyMjIyMw==,45057,2019-05-03T20:01:19Z,2019-05-03T20:01:29Z,CONTRIBUTOR,"Also I have a slight preference against (ab)using `__slots__` to enforce fields, although I have done it myself in the past. It would be possible to do this with `__setattr__` instead, although that's an implementation detail and I'm not too fussed about it.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",440134714,
https://github.com/simonw/datasette/issues/446#issuecomment-498838841,https://api.github.com/repos/simonw/datasette/issues/446,498838841,MDEyOklzc3VlQ29tbWVudDQ5ODgzODg0MQ==,9599,2019-06-04T20:51:37Z,2019-06-04T20:51:37Z,OWNER,"So the Python 3.7 way to do this would be dataclasses, but I still want to support 3.5.
This excellent essay has made me think attrs might be the way to go: https://www.revsys.com/tidbits/dataclasses-and-attrs-when-and-why/","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",440134714,
https://github.com/simonw/datasette/issues/446#issuecomment-702459432,https://api.github.com/repos/simonw/datasette/issues/446,702459432,MDEyOklzc3VlQ29tbWVudDcwMjQ1OTQzMg==,9599,2020-10-02T00:08:47Z,2020-10-02T00:08:47Z,OWNER,"I've decided not to bother with this, especially having redesigned some hooks to return Datasette standard `Response` objects.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",440134714,