Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Warning about repo being archived (#344)
Browse files Browse the repository at this point in the history
* add DeprecationWarning on import

* big wrarning in README

* add big fat warning to docs landing page too

* try adding prolog to every page

* rearrange emojis

* try updating micromamba action

* also update micromamba for other job

* fix expected repr diff

* pin xarray

* pin to earlier version

* upgrade the python version for docs

* require a more recent version of `sphinx`

* replace `sphinx-panels` with `sphinx-design`

* disable the mypy hook

* autoupdate hook versions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ignore `flake8` errors that conflict with `black`

* update link in warning to release discussion upstream

* update links

---------

Co-authored-by: Justus Magin <keewis@posteo.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 24, 2024
1 parent d97b636 commit 5f3956f
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ignore =
E731
# line break before binary operator
W503
E701
E704
exclude=
.eggs
doc
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
- uses: actions/checkout@v4

- name: Create conda environment
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
micromamba-version: 'latest'
environment-file: ci/environment.yml
extra-specs: |
create-args: >-
python=${{ matrix.python-version }}
- name: Conda info
Expand Down Expand Up @@ -70,12 +70,12 @@ jobs:
- uses: actions/checkout@v4

- name: Create conda environment
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
micromamba-version: 'latest'
environment-file: ci/environment.yml
extra-specs: |
create-args: >-
python=${{ matrix.python-version }}
- name: Conda info
Expand Down
36 changes: 18 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,38 @@ repos:
- id: isort
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
# - repo: https://github.com/Carreau/velin
# rev: 0.0.8
# hooks:
# - id: velin
# args: ["--write", "--compact"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
# Copied from setup.cfg
exclude: "properties|asv_bench|docs"
additional_dependencies: [
# Type stubs
types-python-dateutil,
types-pkg_resources,
types-PyYAML,
types-pytz,
# Dependencies that are typed
numpy,
typing-extensions>=4.1.0,
]
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.13.0
# hooks:
# - id: mypy
# # Copied from setup.cfg
# exclude: "properties|asv_bench|docs"
# additional_dependencies: [
# # Type stubs
# types-python-dateutil,
# types-pkg_resources,
# types-PyYAML,
# types-pytz,
# # Dependencies that are typed
# numpy,
# typing-extensions>=4.1.0,
# ]
# run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194
# - repo: https://github.com/asottile/pyupgrade
# rev: v1.22.1
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ that was more flexible than a single `xarray.Dataset` object.
The initial motivation was to represent netCDF files / Zarr stores with multiple nested groups in a single in-memory object,
but `datatree.DataTree` objects have many other uses.

### DEPRECATION NOTICE
# :rotating_light: :bell: :warning: NO LONGER MAINTAINED :warning: :bell: :rotating_light:

Datatree is in the process of being merged upstream into xarray (as of [v0.0.14](https://github.com/xarray-contrib/datatree/releases/tag/v0.0.14), see xarray issue [#8572](https://github.com/pydata/xarray/issues/8572)). We are aiming to preserve the record of contributions to this repository during the migration process. However whilst we will hapily accept new PRs to this repository, this repo will be deprecated and any PRs since [v0.0.14](https://github.com/xarray-contrib/datatree/releases/tag/v0.0.14) might be later copied across to xarray without full git attribution.
**This repository has been archived and the code is no longer maintained!**

Hopefully for users the disruption will be minimal - and just mean that in some future version of xarray you only need to do `from xarray import DataTree` rather than `from datatree import DataTree`. Once the migration is complete this repository will be archived.
Datatree has been [merged upstream into `pydata/xarray`](https://github.com/pydata/xarray/issues/8572), and released as of xarray version `2024.10.0`.

PLEASE RAISE NEW ISSUES ON THE XARRAY REPOSITORY UPSTREAM
There will be no further bugfixes or feature additions to this respository.

Users of this repository should migrate to using `xarray.DataTree` instead, following the [Migration Guide](https://github.com/pydata/xarray/discussions/9680).

The information below is all outdated, and is left only for historical interest.

### Installation
You can install datatree via pip:
Expand Down
8 changes: 4 additions & 4 deletions ci/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ channels:
- conda-forge
dependencies:
- pip
- python>=3.9
- python>=3.12
- netcdf4
- scipy
- sphinx>=4.2.0
- sphinx>=6.0.0
- sphinx-copybutton
- sphinx-panels
- sphinx-design
- sphinx-autosummary-accessors
- sphinx-book-theme >= 0.0.38
- nbsphinx
Expand All @@ -18,7 +18,7 @@ dependencies:
- ipython
- h5netcdf
- zarr
- xarray
- "xarray>=2022.06.0, <=2024.07.0"
- pip:
- -e ..
- sphinxext-rediraffe
Expand Down
2 changes: 1 addition & 1 deletion ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ dependencies:
- h5netcdf
- zarr
- pip:
- xarray>=2022.05.0.dev0
- "xarray>=2022.06.0, <=2024.07.0"
10 changes: 10 additions & 0 deletions datatree/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import warnings

# import public API
from .datatree import DataTree
from .extensions import register_datatree_accessor
from .io import open_datatree
from .mapping import TreeIsomorphismError, map_over_subtree
from .treenode import InvalidTreeError, NotFoundInTreeError

warnings.warn(
"The repository `xarray-contrib/datatree` has been archived! It is no longer maintained as of October 2024. "
"Datatree functionality has been migrated upstream to `pydata/xarray`, so please use `xarray.DataTree` instead. "
"To help you migrate a guide can be found by following https://github.com/pydata/xarray/discussions/9680",
DeprecationWarning,
)


try:
# NOTE: the `_version.py` file must not be present in the git repository
# as it is generated by setuptools at install time
Expand Down
3 changes: 1 addition & 2 deletions datatree/datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ def __getitem__(self, key: Hashable) -> DataArray: # type: ignore[misc]
...

@overload
def __getitem__(self, key: Any) -> Dataset:
...
def __getitem__(self, key: Any) -> Dataset: ...

def __getitem__(self, key) -> DataArray:
# TODO call the `_get_item` method of DataTree to allow path-like access to contents of other nodes
Expand Down
8 changes: 5 additions & 3 deletions datatree/formatting_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ def summarize_children(children: Mapping[str, Any]) -> str:
lines_callback = lambda n, c, end: _wrap_repr(node_repr(n, c), end=end)

children_html = "".join(
lines_callback(n, c, end=False) # Long lines
if i < N_CHILDREN
else lines_callback(n, c, end=True) # Short lines
(
lines_callback(n, c, end=False) # Long lines
if i < N_CHILDREN
else lines_callback(n, c, end=True)
) # Short lines
for i, (n, c) in enumerate(children.items())
)

Expand Down
3 changes: 1 addition & 2 deletions datatree/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ def __next__(self) -> Iterator[Tree]:

@staticmethod
@abstractmethod
def _iter(children: List[Tree], filter_, stop, maxlevel) -> Iterator[Tree]:
...
def _iter(children: List[Tree], filter_, stop, maxlevel) -> Iterator[Tree]: ...

@staticmethod
def _abort_at_level(level, maxlevel):
Expand Down
6 changes: 2 additions & 4 deletions datatree/tests/test_datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def test_assign_when_already_child_with_variables_name(self):
dt.ds = new_ds


class TestGet:
...
class TestGet: ...


class TestGetItem:
Expand Down Expand Up @@ -450,8 +449,7 @@ def test_setitem_dataarray_replace_existing_node(self):
xrt.assert_identical(results.to_dataset(), expected)


class TestDictionaryInterface:
...
class TestDictionaryInterface: ...


class TestTreeFromDict:
Expand Down
6 changes: 3 additions & 3 deletions datatree/tests/test_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ def test_diff_node_data(self):
Data in nodes at position '/a' do not match:
Data variables only on the left object:
v int64 1
v int64 8B 1
Data in nodes at position '/a/b' do not match:
Differing data variables:
L w int64 5
R w int64 6"""
L w int64 8B 5
R w int64 8B 6"""
)
actual = diff_tree_repr(dt_1, dt_2, "equals")
assert actual == expected
5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
parent = os.path.dirname(cwd)
sys.path.insert(0, parent)

# -- Deprecation Warning banner -----------------------------------------------------

rst_prolog = """.. attention::
This repository has been archived. Please use xarray.DataTree instead.
"""

# -- General configuration -----------------------------------------------------

Expand Down
12 changes: 12 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ Datatree

**Datatree is a prototype implementation of a tree-like hierarchical data structure for xarray.**

# !!! NO LONGER MAINTAINED !!!

**This repository has been archived and the code is no longer maintained!**

Datatree has been `merged upstream into pydata/xarray <https://github.com/pydata/xarray/issues/8572>`_, and released as of xarray version `2024.10.0`.

There will be no further bugfixes or feature additions to this respository.

Users of this repository should migrate to using `xarray.DataTree` instead, following the `Migration Guide <https://github.com/pydata/xarray/discussions/9680>`_.

The information below is all outdated, and is left only for historical interest.

Why Datatree?
~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
]
requires-python = ">=3.9"
dependencies = [
"xarray >=2023.12.0",
"xarray >=2023.12.0, <=2024.07.0",
"packaging",
]
dynamic = ["version"]
Expand Down

0 comments on commit 5f3956f

Please sign in to comment.