Skip to content

Conversation

headtr1ck
Copy link
Collaborator

Follow up to #9785

This introduces a ReadBuffer Protocol (stolen from pandas).

Also I finally took the courage to fix the Liskov violation in open_dataset by removing the **kwargs in the ABC.

Copy link
Collaborator

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG!

@headtr1ck headtr1ck added the plan to merge Final call for comments label Nov 16, 2024
@@ -65,24 +64,52 @@ def _normalize_path(path: str | os.PathLike | T) -> str | T:
if isinstance(path, str) and not is_remote_uri(path):
path = os.path.abspath(os.path.expanduser(path))

return cast(str, path)
return path # type:ignore [return-value]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does mypy complain here? Shouldn't it take the T path here?

@dcherian
Copy link
Contributor

Merging since this is an improvement.

@dcherian dcherian merged commit 5930d11 into pydata:main Nov 18, 2024
41 checks passed
dcherian added a commit to dcherian/xarray that referenced this pull request Nov 18, 2024
* main:
  Bump codecov/codecov-action from 4.6.0 to 5.0.2 in the actions group (pydata#9793)
  Buffer types (pydata#9787)
dcherian added a commit that referenced this pull request Nov 19, 2024
* main: (24 commits)
  Bump minimum versions (#9796)
  Namespace-aware `xarray.ufuncs` (#9776)
  Add prettier and pygrep hooks to pre-commit hooks (#9644)
  `rolling.construct`: Add `sliding_window_kwargs` to pipe arguments down to `sliding_window_view` (#9720)
  Bump codecov/codecov-action from 4.6.0 to 5.0.2 in the actions group (#9793)
  Buffer types (#9787)
  Add download stats badges (#9786)
  Fix open_mfdataset for list of fsspec files (#9785)
  add 'User-Agent'-header to pooch.retrieve (#9782)
  Optimize `ffill`, `bfill` with dask when `limit` is specified (#9771)
  fix cf decoding of grid_mapping (#9765)
  Allow wrapping `np.ndarray` subclasses (#9760)
  Optimize polyfit (#9766)
  Use `map_overlap` for rolling reductions with Dask (#9770)
  fix html repr indexes section (#9768)
  Bump pypa/gh-action-pypi-publish from 1.11.0 to 1.12.2 in the actions group (#9763)
  unpin array-api-strict, as issues are resolved upstream (#9762)
  rewrite the `min_deps_check` script (#9754)
  CI runs ruff instead of pep8speaks (#9759)
  Specify copyright holders in main license file (#9756)
  ...
dcherian added a commit to dcherian/xarray that referenced this pull request Nov 19, 2024
* main:
  Bump minimum versions (pydata#9796)
  Namespace-aware `xarray.ufuncs` (pydata#9776)
  Add prettier and pygrep hooks to pre-commit hooks (pydata#9644)
  `rolling.construct`: Add `sliding_window_kwargs` to pipe arguments down to `sliding_window_view` (pydata#9720)
  Bump codecov/codecov-action from 4.6.0 to 5.0.2 in the actions group (pydata#9793)
  Buffer types (pydata#9787)
  Add download stats badges (pydata#9786)
  Fix open_mfdataset for list of fsspec files (pydata#9785)
  add 'User-Agent'-header to pooch.retrieve (pydata#9782)
  Optimize `ffill`, `bfill` with dask when `limit` is specified (pydata#9771)
  fix cf decoding of grid_mapping (pydata#9765)
  Allow wrapping `np.ndarray` subclasses (pydata#9760)
  Optimize polyfit (pydata#9766)
  Use `map_overlap` for rolling reductions with Dask (pydata#9770)
@headtr1ck headtr1ck deleted the buffer-types branch November 19, 2024 20:34
scott-huberty added a commit to scott-huberty/xarray that referenced this pull request Nov 20, 2024
Manually fixed a conflict in xarray/backends/common.py, specifically LOC touched/added  by pydata#9727 and pydata#9787

In one case I just needed to incorporate the xarray.core.types imports from pydata#9787
In the other case, a flake was fixed in one of the attempted imports that will utilize the attempt_import function in this PR. I just incorporated that flake fix from pydata#9727  into this PR
weiji14 added a commit to GenericMappingTools/pygmt that referenced this pull request Apr 17, 2025
Because xr.core.types.ReadBuffer is not available until xarray 2024.11.0, xref pydata/xarray#9787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan to merge Final call for comments topic-typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants