id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 2034500760,PR_kwDOAMm_X85hnplA,8536,Speed up localize,14371165,open,0,,,2,2023-12-10T19:24:40Z,2024-05-04T20:20:01Z,,MEMBER,,1,pydata/xarray/pulls/8536," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8536/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1746734270,PR_kwDOAMm_X85SdWic,7902,Test array api protocol,14371165,open,0,,,2,2023-06-07T21:50:55Z,2024-01-28T10:36:37Z,,MEMBER,,1,pydata/xarray/pulls/7902," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7902/reactions"", ""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 1}",,,13221727,pull 1377088142,I_kwDOAMm_X85SFLKO,7050,Type annotation guidelines,14371165,open,0,,,2,2022-09-18T15:04:54Z,2022-09-23T01:55:19Z,,MEMBER,,,,"Dask has a pretty nice guideline for type hinting, see https://github.com/dask/community/issues/255. Notable for us is to avoid adding typing in docstrings to avoid duplicating information.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7050/reactions"", ""total_count"": 4, ""+1"": 4, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 957201551,MDU6SXNzdWU5NTcyMDE1NTE=,5655,Allow .attrs to use dict-likes,14371165,open,0,,,2,2021-07-31T08:31:55Z,2022-01-09T03:32:04Z,,MEMBER,,,," **Is your feature request related to a problem? Please describe.** Reading attributes from h5py-files is rather slow. So instead of retrieving it immediately I wanted to create a lazy dict-class that only retrieves the attribute values when necessary. But this is difficult to achieve since xarray keeps forcing the attrs to dicts in a lot of places. **Describe the solution you'd like** * Replace in https://github.com/pydata/xarray/blob/dddac11b01330791ffab4dfc72d226e71821973e/xarray/core/variable.py#L865 and https://github.com/pydata/xarray/blob/dddac11b01330791ffab4dfc72d226e71821973e/xarray/core/dataset.py#L798 with a `asdict(value)` function that checks if the input is a valid dict-like, if not convert to dict. Things that might be good to check: * `MutableMapping` * `hasattr(dict_like, ""copy"")` * `isinstance(dict_like, dict) == True` * Remove unneccessary conversions to dict. For example https://github.com/pydata/xarray/blob/dddac11b01330791ffab4dfc72d226e71821973e/xarray/core/merge.py#L523 should not be necessary as attrs from variables/dataarrays/datasets have already been forced to dicts when they were initialized. **Describe alternatives you've considered** * One could lazify with dicts as well, for example by replacing the value with a function. This however won't look good in reprs, that's why having a convienence class is nice. * `dict(LazyDict)` always forces to dict, it does not let it pass through unchanged even if `isinstance(LazyDict, dict) == True`. Interesting reading: https://stackoverflow.com/questions/16669367/setup-dictionary-lazily https://stackoverflow.com/questions/3387691/how-to-perfectly-override-a-dict ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5655/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue