pull_requests: 406619093
This data as json
id | node_id | number | state | locked | title | user | body | created_at | updated_at | closed_at | merged_at | merge_commit_sha | assignee | milestone | draft | head | base | author_association | auto_merge | repo | url | merged_by |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
406619093 | MDExOlB1bGxSZXF1ZXN0NDA2NjE5MDkz | 3988 | closed | 0 | built-in accessor documentation | 14808389 | We currently use `property` to attach our built-in accessors (`plot`, `dt` and `str`) to the `DataArray` and `Dataset` classes. However, because `property` returns itself when trying to access it as a class attribute, this does not work when generating the documentation (`sphinx` inspects classes, not class instances). This adds a `property`-like descriptor that works on both classes and instance objects (the name could be more descriptive) and uses that to document the `Dataset.plot.*` and `DataArray.plot.*` methods (see the [rendered documentation](https://xarray-keewis.readthedocs.io/en/accessor-documentation/api.html)). I have not been able to get `sphinx` to work with `_PlotMethods.__slots__`, though. A few questions / comments on this: 1. I noticed we have `DataArray.plot.__call__` and `xarray.plot.plot` but not `DataArray.plot.plot`. Is that something that is worth adding? 2. The functions decorated with the custom property define docstrings which currently are lost. Should we patch them on their return values? 3. Right now, the error message when accidentally trying to call e.g. `xr.DataArray.plot.line()` is not very helpful: ```pytb AttributeError: 'NoneType' object has no attribute 'dims' ``` 4. Now that we can document the accessors, we need to think about how to structure `api.rst`. For `plot` and `str`, we could just list methods / attributes in subsections of `DataArray` / `Dataset` (or keep the `Plotting` / `str` / ... sections and add class subsections?), but `dt` is more complicated since it dispatches for `datetime` and `timedelta` - [x] Closes #3625 - [x] Passes `isort -rc . && black . && mypy . && flake8` - [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API Edit: err, it seems I used the branch I pushed to the main repository for a documentation preview for this... | 2020-04-21T11:39:36Z | 2020-06-13T17:52:51Z | 2020-06-13T17:52:46Z | 2020-06-13T17:52:46Z | e26b80f3b813d84520eef4d371a2609fd09182e3 | 0 | 4940b53e253a639cc75e4fbe6599fdc4c81c3e55 | e8bd8665e8fd762031c2d9c87987d21e113e41cc | MEMBER | 13221727 | https://github.com/pydata/xarray/pull/3988 |
Links from other tables
- 0 rows from pull_requests_id in labels_pull_requests