Skip to content

Commit

Permalink
Merge branch 'pydata:main' into nanquantiles
Browse files Browse the repository at this point in the history
  • Loading branch information
maawoo authored Feb 6, 2024
2 parents 1a45612 + f33a632 commit eff2628
Show file tree
Hide file tree
Showing 133 changed files with 10,358 additions and 631 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ jobs:
#
# If dependencies emit warnings we can't do anything about, add ignores to
# `xarray/tests/__init__.py`.
python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror
# [MHS, 01/25/2024] Skip datatree_ documentation remove after #8572
python -m pytest --doctest-modules xarray --ignore xarray/tests --ignore xarray/datatree_ -Werror
mypy:
name: Mypy
Expand Down Expand Up @@ -127,7 +128,7 @@ jobs:
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report xarray/
- name: Upload mypy coverage to Codecov
uses: codecov/codecov-action@v3.1.5
uses: codecov/codecov-action@v4.0.1
with:
file: mypy_report/cobertura.xml
flags: mypy
Expand Down Expand Up @@ -181,7 +182,7 @@ jobs:
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report xarray/
- name: Upload mypy coverage to Codecov
uses: codecov/codecov-action@v3.1.5
uses: codecov/codecov-action@v4.0.1
with:
file: mypy_report/cobertura.xml
flags: mypy39
Expand Down Expand Up @@ -242,7 +243,7 @@ jobs:
python -m pyright xarray/
- name: Upload pyright coverage to Codecov
uses: codecov/codecov-action@v3.1.5
uses: codecov/codecov-action@v4.0.1
with:
file: pyright_report/cobertura.xml
flags: pyright
Expand Down Expand Up @@ -301,7 +302,7 @@ jobs:
python -m pyright xarray/
- name: Upload pyright coverage to Codecov
uses: codecov/codecov-action@v3.1.5
uses: codecov/codecov-action@v4.0.1
with:
file: pyright_report/cobertura.xml
flags: pyright39
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
path: pytest.xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v3.1.5
uses: codecov/codecov-action@v4.0.1
with:
file: ./coverage.xml
flags: unittests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
run: |
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
- name: Upload mypy coverage to Codecov
uses: codecov/codecov-action@v3.1.5
uses: codecov/codecov-action@v4.0.1
with:
file: mypy_report/cobertura.xml
flags: mypy
Expand Down
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# https://pre-commit.com/
ci:
autoupdate_schedule: monthly
exclude: 'xarray/datatree_.*'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -10,29 +11,23 @@ repos:
- id: check-yaml
- id: debug-statements
- id: mixed-line-ending
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
name: absolufy-imports
files: ^xarray/
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.9'
rev: 'v0.2.0'
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black-jupyter
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
exclude: "generate_aggregations.py"
additional_dependencies: ["black==23.12.1"]
additional_dependencies: ["black==24.1.1"]
- id: blackdoc-autoupdate-black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
prune xarray/datatree_*
2 changes: 1 addition & 1 deletion ci/requirements/all-but-dask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- pint>=0.22
- pip
- pydap
- pytest==7.4.*
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/bare-minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- python=3.9
- coveralls
- pip
- pytest==7.4.*
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-3.12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
- pooch
- pre-commit
- pydap
- pytest==7.4.*
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-windows-3.12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
- pip
- pre-commit
- pydap
- pytest==7.4.*
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
- pip
- pre-commit
- pydap
- pytest==7.4.*
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
- pre-commit
- pyarrow # pandas makes a deprecation warning without this, breaking doctests
- pydap
- pytest==7.4.*
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies:
- pint=0.22
- pip
- pydap=3.3
- pytest==7.4.*
- pytest
- pytest-cov
- pytest-env
- pytest-xdist
Expand Down
8 changes: 3 additions & 5 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Creating a development environment
----------------------------------

To test out code changes locally, you'll need to build *xarray* from source, which requires you to
`create a local development environment <https://docs.xarray.dev/en/stable/contributing.html#creating-a-development-environment>`_.
`create a local development environment <https://docs.xarray.dev/en/stable/contributing.html#contributing-dev-env>`_.

Update the ``main`` branch
--------------------------
Expand Down Expand Up @@ -670,8 +670,7 @@ typically find tests wrapped in a class.

.. code-block:: python
class TestReallyCoolFeature:
...
class TestReallyCoolFeature: ...
Going forward, we are moving to a more *functional* style using the
`pytest <http://doc.pytest.org/en/latest/>`__ framework, which offers a richer
Expand All @@ -680,8 +679,7 @@ writing test classes, we will write test functions like this:

.. code-block:: python
def test_really_cool_feature():
...
def test_really_cool_feature(): ...
Using ``pytest``
~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion doc/gallery/plot_cartopy_facetgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
.. _this discussion: https://github.com/pydata/xarray/issues/1397#issuecomment-299190567
"""


import cartopy.crs as ccrs
import matplotlib.pyplot as plt

Expand Down
1 change: 1 addition & 0 deletions doc/gallery/plot_control_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Use ``cbar_kwargs`` keyword to specify the number of ticks.
The ``spacing`` kwarg can be used to draw proportional ticks.
"""

import matplotlib.pyplot as plt

import xarray as xr
Expand Down
6 changes: 6 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ v2024.02.0 (unreleased)
New Features
~~~~~~~~~~~~

- Allow negative frequency strings (e.g. ``"-1YE"``). These strings are for example used
in :py:func:`date_range`, and :py:func:`cftime_range` (:pull:`8651`).
By `Mathias Hauser <https://github.com/mathause>`_.
- Add :py:meth:`NamedArray.expand_dims`, :py:meth:`NamedArray.permute_dims` and :py:meth:`NamedArray.broadcast_to`
(:pull:`8380`) By `Anderson Banihirwe <https://github.com/andersy005>`_.

Expand All @@ -43,6 +46,9 @@ Deprecations
Bug fixes
~~~~~~~~~

- Fixed a regression that prevented multi-index level coordinates being
serialized after resetting or dropping the multi-index (:issue:`8628`, :pull:`8672`).
By `Benoit Bovy <https://github.com/benbovy>`_.
- Fix bug with broadcasting when wrapping array API-compliant classes. (:issue:`8665`, :pull:`8669`)
By `Tom Nicholas <https://github.com/TomNicholas>`_.
- Ensure :py:meth:`DataArray.unstack` works when wrapping array API-compliant classes. (:issue:`8666`, :pull:`8668`)
Expand Down
1 change: 1 addition & 0 deletions properties/test_encode_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
These ones pass, just as you'd hope!
"""

import pytest

pytest.importorskip("hypothesis")
Expand Down
1 change: 1 addition & 0 deletions properties/test_pandas_roundtrip.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Property-based tests for roundtripping between xarray and pandas objects.
"""

from functools import partial

import numpy as np
Expand Down
17 changes: 16 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"]

[tool.mypy]
enable_error_code = "redundant-self"
exclude = 'xarray/util/generate_.*\.py'
exclude = [
'xarray/util/generate_.*\.py',
'xarray/datatree_/.*\.py',
]
files = "xarray"
show_error_codes = true
show_error_context = true
Expand Down Expand Up @@ -242,8 +245,15 @@ extend-exclude = [
"doc",
"_typed_ops.pyi",
]
extend-safe-fixes = [
"TID252", # absolute imports
]
target-version = "py39"

[tool.ruff.per-file-ignores]
# don't enforce absolute imports
"asv_bench/**" = ["TID252"]

[tool.ruff.lint]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
Expand All @@ -257,13 +267,18 @@ select = [
"F", # Pyflakes
"E", # Pycodestyle
"W",
"TID", # flake8-tidy-imports (absolute imports)
"I", # isort
"UP", # Pyupgrade
]

[tool.ruff.lint.isort]
known-first-party = ["xarray"]

[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"

[tool.pytest.ini_options]
addopts = ["--strict-config", "--strict-markers"]
filterwarnings = [
Expand Down
1 change: 1 addition & 0 deletions xarray/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
DataStores provide a uniform interface for saving and loading data in different
formats. They should not be used directly, but rather through Dataset objects.
"""

from xarray.backends.common import AbstractDataStore, BackendArray, BackendEntrypoint
from xarray.backends.file_manager import (
CachingFileManager,
Expand Down
Loading

0 comments on commit eff2628

Please sign in to comment.