Skip to content

stop pruning datatree_ directory from distribution #8953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
prune xarray/datatree_*
recursive-include xarray/datatree_/datatree *.py
7 changes: 1 addition & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"]
enable_error_code = "redundant-self"
exclude = [
'xarray/util/generate_.*\.py',
'xarray/datatree_/.*\.py',
'xarray/datatree_/doc/.*\.py',
]
files = "xarray"
show_error_codes = true
Expand All @@ -97,11 +97,6 @@ warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true

# Ignore mypy errors for modules imported from datatree_.
[[tool.mypy.overrides]]
ignore_errors = true
module = "xarray.datatree_.*"

# Much of the numerical computing stack doesn't have type annotations yet.
[[tool.mypy.overrides]]
ignore_missing_imports = true
Expand Down
10 changes: 5 additions & 5 deletions xarray/datatree_/datatree/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

def _get_nc_dataset_class(engine):
if engine == "netcdf4":
from netCDF4 import Dataset # type: ignore
from netCDF4 import Dataset
elif engine == "h5netcdf":
from h5netcdf.legacyapi import Dataset # type: ignore
from h5netcdf.legacyapi import Dataset
elif engine is None:
try:
from netCDF4 import Dataset
except ImportError:
from h5netcdf.legacyapi import Dataset # type: ignore
from h5netcdf.legacyapi import Dataset
else:
raise ValueError(f"unsupported engine: {engine}")
return Dataset
Expand Down Expand Up @@ -78,7 +78,7 @@ def _datatree_to_netcdf(


def _create_empty_zarr_group(store, group, mode):
import zarr # type: ignore
import zarr

root = zarr.open_group(store, mode=mode)
root.create_group(group, overwrite=True)
Expand All @@ -92,7 +92,7 @@ def _datatree_to_zarr(
consolidated: bool = True,
**kwargs,
):
from zarr.convenience import consolidate_metadata # type: ignore
from zarr.convenience import consolidate_metadata

if kwargs.get("group", None) is not None:
raise NotImplementedError(
Expand Down
11 changes: 5 additions & 6 deletions xarray/datatree_/datatree/tests/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ def foo(self):
return "bar"

dt: DataTree = DataTree()
assert dt.demo.foo == "bar" # type: ignore
assert dt.demo.foo == "bar"

# accessor is cached
assert dt.demo is dt.demo # type: ignore
assert dt.demo is dt.demo

# check descriptor
assert dt.demo.__doc__ == "Demo accessor." # type: ignore
# TODO: typing doesn't seem to work with accessors
assert DataTree.demo.__doc__ == "Demo accessor." # type: ignore
assert isinstance(dt.demo, DemoAccessor) # type: ignore
assert dt.demo.__doc__ == "Demo accessor."
assert DataTree.demo.__doc__ == "Demo accessor." # type: ignore
assert isinstance(dt.demo, DemoAccessor)
assert DataTree.demo is DemoAccessor # type: ignore

with pytest.warns(Warning, match="overriding a preexisting attribute"):
Expand Down
6 changes: 3 additions & 3 deletions xarray/datatree_/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import os
import sys

import sphinx_autosummary_accessors
import sphinx_autosummary_accessors # type: ignore

import datatree
import datatree # type: ignore

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -286,7 +286,7 @@

# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
latex_elements: dict = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
Expand Down