xarray-contrib / datatree

WIP implementation of a tree-like hierarchical data structure for xarray.
https://xarray-datatree.readthedocs.io
Apache License 2.0
162 stars 43 forks source link

Bug with Python 3.12 #257

Closed mgrover1 closed 8 months ago

mgrover1 commented 8 months ago

As of now, several components break with Python 3.12. Here is a sample of the output after installing Python 3.12 in the datatree dev environment. It appears to be related to pathlib, but I am not exactly sure. Any thoughts here?

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1347ae3d0>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestGetNodes object at 0x13480f020>

    def test_get_upwards(self):
        sue = TreeNode()
        kate = TreeNode()
        mary = TreeNode(children={"Sue": sue, "Kate": kate})
        john = TreeNode(children={"Mary": mary})

>       assert sue._get_item("../") is mary

datatree/tests/test_treenode.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:429: in _get_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1347ae3d0>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
_______________________ TestGetNodes.test_get_from_root ________________________

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1359a9a50>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestGetNodes object at 0x13480f320>

    def test_get_from_root(self):
        sue = TreeNode()
        mary = TreeNode(children={"Sue": sue})
        john = TreeNode(children={"Mary": mary})  # noqa

>       assert sue._get_item("/Mary") is mary

datatree/tests/test_treenode.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:429: in _get_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1359a9a50>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
_______________________ TestSetNodes.test_set_child_node _______________________

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x135a14f50>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestSetNodes object at 0x13480e780>

    def test_set_child_node(self):
        john = TreeNode()
        mary = TreeNode()
>       john._set_item("Mary", mary)

datatree/tests/test_treenode.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:491: in _set_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x135a14f50>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
____________________ TestSetNodes.test_child_already_exists ____________________

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1359fca50>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestSetNodes object at 0x13480e1b0>

    def test_child_already_exists(self):
        mary = TreeNode()
        john = TreeNode(children={"Mary": mary})
        mary_2 = TreeNode()
        with pytest.raises(KeyError):
>           john._set_item("Mary", mary_2, allow_overwrite=False)

datatree/tests/test_treenode.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:491: in _set_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1359fca50>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
_______________________ TestSetNodes.test_set_grandchild _______________________

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1346ea450>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestSetNodes object at 0x13480e300>

    def test_set_grandchild(self):
        rose = TreeNode()
        mary = TreeNode()
        john = TreeNode()

>       john._set_item("Mary", mary)

datatree/tests/test_treenode.py:169:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:491: in _set_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1346ea450>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
_________________ TestSetNodes.test_create_intermediate_child __________________

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1347ae3d0>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestSetNodes object at 0x13480d8e0>

    def test_create_intermediate_child(self):
        john = TreeNode()
        rose = TreeNode()

        # test intermediate children not allowed
        with pytest.raises(KeyError, match="Could not reach"):
>           john._set_item(path="Mary/Rose", item=rose, new_nodes_along_path=False)

datatree/tests/test_treenode.py:183:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:491: in _set_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x1347ae3d0>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
______________________ TestSetNodes.test_overwrite_child _______________________

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x134bc3650>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestSetNodes object at 0x13480d910>

    def test_overwrite_child(self):
        john = TreeNode()
        mary = TreeNode()
>       john._set_item("Mary", mary)

datatree/tests/test_treenode.py:197:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:491: in _set_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x134bc3650>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
__________________________ TestPruning.test_del_child __________________________

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x134215750>

    @property
    def drive(self):
        """The drive prefix (letter or UNC path), if any."""
        try:
>           return self._drv
E           AttributeError: 'NodePath' object has no attribute '_drv'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:555: AttributeError

During handling of the above exception, another exception occurred:

self = <datatree.tests.test_treenode.TestPruning object at 0x13480dc40>

    def test_del_child(self):
        john = TreeNode()
        mary = TreeNode()
>       john._set_item("Mary", mary)

datatree/tests/test_treenode.py:217:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datatree/treenode.py:491: in _set_item
    path = NodePath(path)
datatree/treenode.py:36: in __new__
    if obj.drive:
../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:557: in drive
    self._load_parts()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NodePath' object has no attribute '_raw_paths'") raised in repr()] NodePath object at 0x134215750>

    def _load_parts(self):
>       paths = self._raw_paths
E       AttributeError: 'NodePath' object has no attribute '_raw_paths'

../../mambaforge/envs/datatree-test/lib/python3.12/pathlib.py:408: AttributeError
=============================== warnings summary ===============================
../../mambaforge/envs/datatree-test/lib/python3.12/site-packages/dateutil/tz/tz.py:37
  /Users/mgrover/mambaforge/envs/datatree-test/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    EPOCH = datetime.datetime.utcfromtimestamp(0)

../../mambaforge/envs/datatree-test/lib/python3.12/site-packages/xarray/tests/__init__.py:133
  /Users/mgrover/mambaforge/envs/datatree-test/lib/python3.12/site-packages/xarray/tests/__init__.py:133: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    flaky = pytest.mark.flaky

../../mambaforge/envs/datatree-test/lib/python3.12/site-packages/xarray/tests/__init__.py:134
  /Users/mgrover/mambaforge/envs/datatree-test/lib/python3.12/site-packages/xarray/tests/__init__.py:134: PytestUnknownMarkWarning: Unknown pytest.mark.network - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    network = pytest.mark.network

datatree/tests/test_io.py::TestIO::test_to_zarr
  <frozen posixpath>:82: RuntimeWarning: deallocating CachingFileManager(<class 'netCDF4._netCDF4.Dataset'>, '/private/var/folders/bw/c9j8z20x45s2y20vv6528qjc0000gq/T/pytest-of-mgrover/pytest-0/test_to_h5netcdf0/test.nc', mode='r', kwargs={'clobber': True, 'diskless': False, 'persist': False, 'format': 'NETCDF4'}, manager_id='1db2a12b-6ca7-4f13-84cd-21bb6d3e8f57'), but file is not already closed. This may indicate a bug.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED datatree/tests/test_dataset_api.py::TestDSMethodInheritance::test_dataset_method - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_dataset_api.py::TestDSMethodInheritance::test_reduce_method - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_dataset_api.py::TestDSMethodInheritance::test_nan_reduce_method - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_dataset_api.py::TestDSMethodInheritance::test_cum_method - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_dataset_api.py::TestOps::test_binary_op_on_int - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_dataset_api.py::TestOps::test_binary_op_on_dataset - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_dataset_api.py::TestOps::test_binary_op_on_datatree - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_dataset_api.py::TestUFuncs::test_tree - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestPaths::test_path_roundtrip - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestPaths::test_relative_paths - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestGetItem::test_getitem_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestGetItem::test_getitem_self - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestGetItem::test_getitem_single_data_variable - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestGetItem::test_getitem_single_data_variable_from_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestGetItem::test_getitem_nonexistent_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestGetItem::test_getitem_nonexistent_variable - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestUpdate::test_update - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestUpdate::test_update_new_named_dataarray - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestUpdate::test_update_doesnt_alter_child_name - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestUpdate::test_update_overwrite - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestCopy::test_copy - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestCopy::test_copy_subtree - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestCopy::test_deepcopy - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_new_child_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_unnamed_child_node_becomes_named - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_new_grandchild_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_grafted_subtree_retains_name - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_new_empty_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_overwrite_data_in_node_with_none - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_named_dataarray - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_unnamed_dataarray - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_variable - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_coerce_to_dataarray - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_add_new_variable_to_empty_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSetItem::test_setitem_dataarray_replace_existing_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestTreeFromDict::test_one_layer - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestTreeFromDict::test_two_layers - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestTreeFromDict::test_nones - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestTreeFromDict::test_datatree_values - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestTreeFromDict::test_roundtrip - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestDatasetView::test_arithmetic - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestAccess::test_attribute_access - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestRestructuring::test_drop_nodes - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestRestructuring::test_assign - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestPipe::test_params - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_datatree.py::TestSubset::test_filter - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_formatting.py::TestDiffFormatting::test_diff_structure - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_formatting.py::TestDiffFormatting::test_diff_node_names - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_formatting.py::TestDiffFormatting::test_diff_node_data - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_io.py::TestIO::test_to_netcdf - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_io.py::TestIO::test_netcdf_encoding - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_io.py::TestIO::test_to_h5netcdf - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_io.py::TestIO::test_to_zarr - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_io.py::TestIO::test_zarr_encoding - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_io.py::TestIO::test_to_zarr_zip_store - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_io.py::TestIO::test_to_zarr_not_consolidated - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestCheckTreesIsomorphic::test_different_widths - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestCheckTreesIsomorphic::test_different_heights - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestCheckTreesIsomorphic::test_names_different - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestCheckTreesIsomorphic::test_isomorphic_names_equal - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestCheckTreesIsomorphic::test_isomorphic_ordering - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestCheckTreesIsomorphic::test_isomorphic_names_not_equal - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestCheckTreesIsomorphic::test_not_isomorphic_complex_tree - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_not_isomorphic - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_single_dt_arg - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_single_dt_arg_plus_args_and_kwargs - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_multiple_dt_args - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_dt_as_kwarg - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_return_multiple_dts - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_map_single_dataset_against_whole_tree - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_dt_method - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMapOverSubTree::test_discard_ancestry - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMutableOperations::test_construct_using_type - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_mapping.py::TestMutableOperations::test_alter_inplace - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestGetNodes::test_get_child - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestGetNodes::test_get_upwards - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestGetNodes::test_get_from_root - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestSetNodes::test_set_child_node - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestSetNodes::test_child_already_exists - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestSetNodes::test_set_grandchild - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestSetNodes::test_create_intermediate_child - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestSetNodes::test_overwrite_child - AttributeError: 'NodePath' object has no attribute '_raw_paths'
FAILED datatree/tests/test_treenode.py::TestPruning::test_del_child - AttributeError: 'NodePath' object has no attribute '_raw_paths'
TomNicholas commented 8 months ago

Uh oh! Perhaps it wasn't so clever to subclass a class from the pathlib standard libary :sweat_smile:

mgrover1 commented 8 months ago

@TomNicholas - from the highlights, it looks like subclassing the pathlib.Path class is now supported directly

Significant improvements in the standard library:

The pathlib.Path class now supports subclassing

The os module received several improvements for Windows support

A command-line interface has been added to the sqlite3 module

https://docs.python.org/3/whatsnew/3.12.html

TomNicholas commented 8 months ago

Oh interesting! I deliberately didn't subclass Path though because (a) these paths should not be linked to the filesystem and (b) I don't want the direction of the separator slashes flipping on Windows systems. (Also do the docs clearly state which classes do and don't support subclassing...?)

mgrover1 commented 8 months ago

Those are great questions... I am not sure. Also it is unclear of what exactly changed here that is causing the lack of those methods...

mgrover1 commented 8 months ago

@TomNicholas from further down the page:

Add support for subclassing pathlib.PurePath and pathlib.Path, plus their Posix- and Windows-specific variants. Subclasses may override the pathlib.PurePath.with_segments() method to pass information between path instances.

mgrover1 commented 8 months ago

@TomNicholas - how difficult of a fix would you think this would be? I am happy to help where possible.

TomNicholas commented 8 months ago

how difficult of a fix would you think this would be? I am happy to help where possible.

Probably really easy - I suspect that we would just need to rewrite NodePath to initialize using whatever the newly-recommended approach is. (Looks like we can just use __init__ now.) NodePath doesn't even add any functionality on top of using PurePosixPath, it just forbids some obviously-invalid path strings, so we can just keep those checks in the new __init__.

To make it work on different versions of python I think we would need to wrap the definition of NodePath within an if else check of sys.version.

It might also be good to add a test that specifically checks that we can create a NodePath object and successfully do whatever it is that causes those errors (looks like simply viewing the repr?)

mgrover1 commented 8 months ago

@TomNicholas - once #260 is merged, would you be willing to cut a new release for datatree, which would release 3.12 wheels?