Skip to content

Conversation

@shoyer
Copy link
Member

@shoyer shoyer commented Sep 7, 2024

DataTree isn't a Generic tree type. It's a specific tree type -- the nodes are DataTree objects.

This was resulting in many cases where mypy insisting on explicit type annotations, e.g., tree: DataTree = DataTree(...), which is unnecessary and annoying boilerplate.

DataTree isn't a Generic tree type. It's a specific tree type -- the
nodes are DataTree objects.

This was resulting in many cases where mypy insisting on explicit type
annotations, e.g., `tree: DataTree = DataTree(...)`, which is
unnecessary and annoying boilerplate.
@shoyer shoyer requested a review from TomNicholas September 7, 2024 19:38
@TomNicholas TomNicholas added the topic-DataTree Related to the implementation of a DataTree class label Sep 7, 2024
@shoyer shoyer merged commit 254f6c5 into pydata:main Sep 8, 2024
@shoyer shoyer deleted the datatree-generic branch September 8, 2024 01:22
dcherian added a commit to dcherian/xarray that referenced this pull request Sep 17, 2024
* main: (29 commits)
  Release notes for v2024.09.0 (pydata#9480)
  Fix `DataTree.coords.__setitem__` by adding `DataTreeCoordinates` class (pydata#9451)
  Rename DataTree's "ds" and "data" to "dataset" (pydata#9476)
  Update DataTree repr to indicate inheritance (pydata#9470)
  Bump pypa/gh-action-pypi-publish in the actions group (pydata#9460)
  Repo checker (pydata#9450)
  Add days_in_year and decimal_year to dt accessor (pydata#9105)
  remove parent argument from DataTree.__init__ (pydata#9465)
  Fix inheritance in DataTree.copy() (pydata#9457)
  Implement `DataTree.__delitem__` (pydata#9453)
  Add ASV for datatree.from_dict (pydata#9459)
  Make the first argument in DataTree.from_dict positional only (pydata#9446)
  Fix typos across the code, doc and comments (pydata#9443)
  DataTree should not be "Generic" (pydata#9445)
  Disallow passing a DataArray as data into the DataTree constructor (pydata#9444)
  Support additional dtypes in `resample` (pydata#9413)
  Shallow copy parent and children in DataTree constructor (pydata#9297)
  Bump minimum versions for dependencies (pydata#9434)
  Always include at least one category in random test data (pydata#9436)
  Avoid deep-copy when constructing groupby codes (pydata#9429)
  ...
hollymandel pushed a commit to hollymandel/xarray that referenced this pull request Sep 23, 2024
* DataTree should not be "Generic"

DataTree isn't a Generic tree type. It's a specific tree type -- the
nodes are DataTree objects.

This was resulting in many cases where mypy insisting on explicit type
annotations, e.g., `tree: DataTree = DataTree(...)`, which is
unnecessary and annoying boilerplate.

* Fix type error

* type ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-DataTree Related to the implementation of a DataTree class

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants