html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/pull/4896#issuecomment-857182694,https://api.github.com/repos/pydata/xarray/issues/4896,857182694,MDEyOklzc3VlQ29tbWVudDg1NzE4MjY5NA==,14808389,2021-06-08T21:41:37Z,2021-06-08T21:41:37Z,MEMBER,"thanks for the reviews, @shoyer, @dcherian, @max-sixty","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-856873157,https://api.github.com/repos/pydata/xarray/issues/4896,856873157,MDEyOklzc3VlQ29tbWVudDg1Njg3MzE1Nw==,2448579,2021-06-08T15:30:34Z,2021-06-08T15:30:34Z,MEMBER,"> let's merge this as-is
Works for me. Once merged perhaps @huard or @DamienIrving can help us iterate on `context`","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-856793544,https://api.github.com/repos/pydata/xarray/issues/4896,856793544,MDEyOklzc3VlQ29tbWVudDg1Njc5MzU0NA==,14808389,2021-06-08T13:59:18Z,2021-06-08T13:59:18Z,MEMBER,let's merge this as-is (unless there are any comments on the current state?) and I'll add the construction of the `context` objects in a new PR.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-849236342,https://api.github.com/repos/pydata/xarray/issues/4896,849236342,MDEyOklzc3VlQ29tbWVudDg0OTIzNjM0Mg==,1217238,2021-05-27T01:08:10Z,2021-05-27T01:08:10Z,MEMBER,"> Also, how do we best construct that object without a lot of overhead? We need to get at least the function name, but if we pass that manually it's one more place to update when renaming something (not that we do that very often). Using `inspect` is possible but might be too complicated:
Rather than introspection, I think we should try to be fully explicit about the function being called. Trying to introspect it from stack-frames is madness :)
So in that case, we would need to pass down the context information from the top level functions in xarray, e.g., everything that takes a `combine_attrs` argument.
In terms of the overall interface, one other concern I have is about the information we make available to users of this API. I can imagine that they might not only want attributes but also the complete xarray objects on which the function is being called. If that's the case, then they would also need more information from the global context.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-849183582,https://api.github.com/repos/pydata/xarray/issues/4896,849183582,MDEyOklzc3VlQ29tbWVudDg0OTE4MzU4Mg==,14808389,2021-05-26T23:22:38Z,2021-05-27T00:09:15Z,MEMBER,"there's two remaining issues: should we use a `namedtuple` / a `dataclass` for `Context` instead of the custom class? We basically want a struct without methods (for now?).
Also, how do we best construct that object without a lot of overhead? We need to get at least the function name, but if we pass that manually it's one more place to update when renaming something (not that we do that very often). Using `inspect` is possible but might be too complicated:
```python
In [5]: import inspect
...:
...: def current_function_name():
...: frame = inspect.currentframe()
...: try:
...: caller = frame.f_back
...: name = caller.f_code.co_name
...: finally:
...: del frame
...: del caller
...:
...: return name
...:
...: def func():
...: print(current_function_name())
...:
...: def another_func():
...: print(current_function_name())
...:
...: class A:
...: def method(self):
...: print(current_function_name())
...:
...: f = func
...:
...: func()
...: another_func()
...: f()
...:
...: a = A()
...: a.method()
func
another_func
func
method
```
With this we can only get the name of the definition so this might break for injected methods, but I guess for injected methods it would be difficult to manually pass the function name, anyways.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-822788888,https://api.github.com/repos/pydata/xarray/issues/4896,822788888,MDEyOklzc3VlQ29tbWVudDgyMjc4ODg4OA==,14808389,2021-04-19T21:13:53Z,2021-04-19T21:13:53Z,MEMBER,"not sure. There are a few questions about the signature of the user functions (see https://github.com/pydata/xarray/pull/4896#issuecomment-779862647 and https://github.com/pydata/xarray/issues/3891#issuecomment-818377781), which I would like to answer before including this in a release (I might be wrong, but I think changing the signature after releasing is pretty hard)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-822030670,https://api.github.com/repos/pydata/xarray/issues/4896,822030670,MDEyOklzc3VlQ29tbWVudDgyMjAzMDY3MA==,5635139,2021-04-18T17:45:15Z,2021-04-18T17:45:15Z,MEMBER,Shall we merge?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-780680130,https://api.github.com/repos/pydata/xarray/issues/4896,780680130,MDEyOklzc3VlQ29tbWVudDc4MDY4MDEzMA==,14808389,2021-02-17T16:29:58Z,2021-02-17T16:29:58Z,MEMBER,"sounds reasonable, but that would require a bigger change than just extending `merge_attrs` (which currently ignores `encoding`)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808
https://github.com/pydata/xarray/pull/4896#issuecomment-779862647,https://api.github.com/repos/pydata/xarray/issues/4896,779862647,MDEyOklzc3VlQ29tbWVudDc3OTg2MjY0Nw==,2448579,2021-02-16T14:13:43Z,2021-02-16T14:13:43Z,MEMBER,"One thing to think about is `.encoding`.
IIUC we want to treat `.encoding` like `.attrs` eventually, so we need to design the signature of this `callable` to handle that especially since `.encoding` can contain ""useful"" attributes like `""coordinates""` and `""bounds""` after #2844.
One option would be
```
def my_combine_attrs(list_of_attrs_dicts, list_of_encoding_dicts):
attrs = ...
encoding = ...
return attrs, encoding","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,806811808