From 4168a5ff9d86e67915b1c1949995ab3ad1a63ba2 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 10:19:41 -0700 Subject: [PATCH 01/51] Run isort, black, mypy, flake8 checks via pre-commit --- .github/workflows/linting.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/linting.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 00000000000..852ec0cd104 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,15 @@ +name: linting + +on: + push: + branches: '*' + pull_request: + branches: '*' + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.0 \ No newline at end of file From 24c7d786f3cba69b47448913455406d55322abc0 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 10:21:16 -0700 Subject: [PATCH 02/51] Fix line ending --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 852ec0cd104..497ec59913d 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,4 +12,4 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.0 \ No newline at end of file + - uses: pre-commit/action@v2.0.0 From 855d6b5499a482f993dcda7a70e6cbe7d011f13e Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 10:35:17 -0700 Subject: [PATCH 03/51] Fix end of line --- doc/internals.rst | 2 +- doc/plotting.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/internals.rst b/doc/internals.rst index 60d32128c60..177cc60ac0a 100644 --- a/doc/internals.rst +++ b/doc/internals.rst @@ -230,4 +230,4 @@ re-open it directly with Zarr: zgroup = zarr.open("rasm.zarr") print(zgroup.tree()) - dict(zgroup["Tair"].attrs) + dict(zgroup["Tair"].attrs) \ No newline at end of file diff --git a/doc/plotting.rst b/doc/plotting.rst index 3699f794ae8..dde48d47569 100644 --- a/doc/plotting.rst +++ b/doc/plotting.rst @@ -955,4 +955,4 @@ One can also make line plots with multidimensional coordinates. In this case, `` f, ax = plt.subplots(2, 1) da.plot.line(x="lon", hue="y", ax=ax[0]) @savefig plotting_example_2d_hue_xy.png - da.plot.line(x="lon", hue="x", ax=ax[1]) + da.plot.line(x="lon", hue="x", ax=ax[1]) \ No newline at end of file From 8f9f81bdfb360ccf18290d74bfffab0f0bb85a4d Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 18:13:09 -0700 Subject: [PATCH 04/51] Fix mypy pre-commit hook. Thanks @keewis --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 18d60f61eb9..5253bb3f979 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,6 +22,7 @@ repos: rev: v0.790 # Must match ci/requirements/*.yml hooks: - id: mypy + exclude: "properties|asv_bench" # run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194 # - repo: https://github.com/asottile/pyupgrade # rev: v1.22.1 From eb6581da3371334741019382f140dcb69d15369e Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 18:50:11 -0700 Subject: [PATCH 05/51] Add main CI --- .../{linting.yml => ci-pre-commit.yml} | 1 + .github/workflows/ci.yaml | 65 +++++++++++++++++++ ci/requirements/environment.yml | 45 +++++++++++++ 3 files changed, 111 insertions(+) rename .github/workflows/{linting.yml => ci-pre-commit.yml} (89%) create mode 100644 .github/workflows/ci.yaml create mode 100644 ci/requirements/environment.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/ci-pre-commit.yml similarity index 89% rename from .github/workflows/linting.yml rename to .github/workflows/ci-pre-commit.yml index 497ec59913d..7dc86c00b54 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/ci-pre-commit.yml @@ -8,6 +8,7 @@ on: jobs: linting: + name: "pre-commit hooks" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000000..9c062160241 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,65 @@ +name: CI +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + workflow_dispatch: # allows you to trigger manually + +jobs: + test: + name: ${{ matrix.os }} ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash -l {0} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: ["3.6", "3.7", "3.8"] + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + channels: conda-forge + channel-priority: strict + mamba-version: "*" + activate-environment: xarray-tests + auto-update-conda: false + python-version: ${{ matrix.python-version }} + + - name: Install conda dependencies + run: | + mamba env update -f ci/requirements/environment.yml + + - name: Install xarray + run: | + python -m pip install --no-deps -e . + + - name: Version info + run: | + conda info -a + conda list + python xarray/util/print_versions.py + - name: Run tests + run: | + pytest -n 4 \ + --cov=xarray \ + --cov-report=xml + + - name: Upload code coverage to Codecov + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + flags: unittests + env_vars: OS,PYTHON + name: codecov-umbrella + fail_ci_if_error: false + \ No newline at end of file diff --git a/ci/requirements/environment.yml b/ci/requirements/environment.yml new file mode 100644 index 00000000000..479e6e50811 --- /dev/null +++ b/ci/requirements/environment.yml @@ -0,0 +1,45 @@ +name: xarray-tests +channels: + - conda-forge + - nodefaults +dependencies: + - boto3 + - bottleneck + - cartopy + - cdms2 + - cfgrib + - cftime + - coveralls + - dask + - distributed + - h5netcdf + - h5py=2 + - hdf5 + - hypothesis + - iris + - isort + - lxml # Optional dep of pydap + - matplotlib-base + - nc-time-axis + - netcdf4 + - numba + - numpy + - pandas + - pint + - pip=20.2 + - pseudonetcdf + - pydap + # - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum + - pytest + - pytest-cov + - pytest-env + - pytest-xdist + - rasterio + - scipy + - seaborn + - setuptools + - sparse + - toolz + - zarr + - pip: + - numbagg From b37d8943b989ef7d38f646ea67415d63738ff785 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 19:06:24 -0700 Subject: [PATCH 06/51] Add additional CI --- .github/workflows/ci-additional.yaml | 62 ++++++++++++++++++++++++++++ .github/workflows/ci-pre-commit.yml | 4 +- .github/workflows/ci.yaml | 21 +++++----- 3 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/ci-additional.yaml diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml new file mode 100644 index 00000000000..0bb734cff7b --- /dev/null +++ b/.github/workflows/ci-additional.yaml @@ -0,0 +1,62 @@ +name: CI Additional +on: + push: + branches: + - "*" + pull_request: + branches: + - "*" + workflow_dispatch: # allows you to trigger manually + +jobs: + test: + name: ${{ matrix.os }} ${{ matrix.env }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash -l {0} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + env: + [ + "py36-bare-minimum", + "py36-min-all-deps", + "py36-min-nep18", + "py38-all-but-dask", + ] + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + channels: conda-forge + channel-priority: strict + mamba-version: "*" + activate-environment: xarray-tests + auto-update-conda: false + + - name: Install conda dependencies + run: | + mamba env update -f ci/requirements/${{ matrix.env }}.yml + + - name: Install xarray + run: | + python -m pip install --no-deps -e . + + - name: Version info + run: | + conda info -a + conda list + python xarray/util/print_versions.py + - name: Run tests + run: | + python -m pytest -n 4 \ + --cov=xarray \ + --cov-report=xml + + diff --git a/.github/workflows/ci-pre-commit.yml b/.github/workflows/ci-pre-commit.yml index 7dc86c00b54..1ab5642367e 100644 --- a/.github/workflows/ci-pre-commit.yml +++ b/.github/workflows/ci-pre-commit.yml @@ -2,9 +2,9 @@ name: linting on: push: - branches: '*' + branches: "*" pull_request: - branches: '*' + branches: "*" jobs: linting: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c062160241..a27f7f3e08c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,16 +1,16 @@ -name: CI +name: CI on: push: branches: - - '*' + - "*" pull_request: branches: - - '*' + - "*" workflow_dispatch: # allows you to trigger manually jobs: test: - name: ${{ matrix.os }} ${{ matrix.python-version }} + name: ${{ matrix.os }} py${{ matrix.python-version }} runs-on: ${{ matrix.os }} defaults: run: @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest"] + os: ["ubuntu-latest", "macos-latest", "windows-latest"] python-version: ["3.6", "3.7", "3.8"] steps: - name: Cancel previous runs @@ -38,11 +38,11 @@ jobs: - name: Install conda dependencies run: | mamba env update -f ci/requirements/environment.yml - + - name: Install xarray run: | python -m pip install --no-deps -e . - + - name: Version info run: | conda info -a @@ -50,9 +50,9 @@ jobs: python xarray/util/print_versions.py - name: Run tests run: | - pytest -n 4 \ - --cov=xarray \ - --cov-report=xml + python -m pytest -n 4 \ + --cov=xarray \ + --cov-report=xml - name: Upload code coverage to Codecov uses: codecov/codecov-action@v1 @@ -62,4 +62,3 @@ jobs: env_vars: OS,PYTHON name: codecov-umbrella fail_ci_if_error: false - \ No newline at end of file From 60d08ebe0941caae4998728ad3f1b14975550092 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 19:14:03 -0700 Subject: [PATCH 07/51] Fetch all history for all branches and tags --- .github/workflows/ci-additional.yaml | 2 ++ .github/workflows/ci.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 0bb734cff7b..c1ad9e275f8 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -32,6 +32,8 @@ jobs: with: access_token: ${{ github.token }} - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch all history for all branches and tags. - uses: conda-incubator/setup-miniconda@v2 with: channels: conda-forge diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a27f7f3e08c..3e28679f7bc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,6 +26,8 @@ jobs: with: access_token: ${{ github.token }} - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch all history for all branches and tags. - uses: conda-incubator/setup-miniconda@v2 with: channels: conda-forge From bdd3986e7c57bf647f46b0d48b6c739eb1200593 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 19:29:48 -0700 Subject: [PATCH 08/51] Add windows environment --- .github/workflows/ci.yaml | 6 +++- ci/requirements/environment-windows.yml | 44 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ci/requirements/environment-windows.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3e28679f7bc..ba023bb51f0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,10 +37,14 @@ jobs: auto-update-conda: false python-version: ${{ matrix.python-version }} + - name: Install conda dependencies (windows) + if: startsWith(matrix.os, 'windows') + run: | + mamba env update -f ci/requirements/environment-windows.yml - name: Install conda dependencies + if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') run: | mamba env update -f ci/requirements/environment.yml - - name: Install xarray run: | python -m pip install --no-deps -e . diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml new file mode 100644 index 00000000000..06a845b12d4 --- /dev/null +++ b/ci/requirements/environment-windows.yml @@ -0,0 +1,44 @@ +name: xarray-tests +channels: + - conda-forge +dependencies: + - boto3 + - bottleneck + - cartopy + # - cdms2 # Not available on Windows + # - cfgrib # Causes Python interpreter crash on Windows + - cftime + - coveralls + - dask + - distributed + - h5netcdf + - h5py=2 + - hdf5 + - hypothesis + - iris + - isort + - lxml # Optional dep of pydap + - matplotlib-base + - nc-time-axis + - netcdf4 + - numba + - numpy + - pandas + - pint + - pip + - pseudonetcdf + - pydap + # - pynio # Not available on Windows + - pytest + - pytest-cov + - pytest-env + - pytest-xdist + - rasterio + - scipy + - seaborn + - setuptools + - sparse + - toolz + - zarr + - pip: + - numbagg From 26604a5bd10e75699062ead9d448606228cdb307 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 19:35:47 -0700 Subject: [PATCH 09/51] Import xarray --- .github/workflows/ci-additional.yaml | 5 +++-- .github/workflows/ci.yaml | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index c1ad9e275f8..79ef435b536 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -55,10 +55,11 @@ jobs: conda info -a conda list python xarray/util/print_versions.py + - name: Import xarray + run: | + python -OO -c "import xarray" - name: Run tests run: | python -m pytest -n 4 \ --cov=xarray \ --cov-report=xml - - diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ba023bb51f0..d15014d96b2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,7 +41,7 @@ jobs: if: startsWith(matrix.os, 'windows') run: | mamba env update -f ci/requirements/environment-windows.yml - - name: Install conda dependencies + - name: Install conda dependencies (linux or macos) if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') run: | mamba env update -f ci/requirements/environment.yml @@ -54,6 +54,9 @@ jobs: conda info -a conda list python xarray/util/print_versions.py + - name: Import xarray + run: | + python -OO -c "import xarray" - name: Run tests run: | python -m pytest -n 4 \ From 6445b47c1ded91b7f4dc5ee2dafa6a7d062fc510 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 19:55:11 -0700 Subject: [PATCH 10/51] Add doctests workflow --- .github/workflows/ci-additional.yaml | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 79ef435b536..132294f2a3a 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -63,3 +63,41 @@ jobs: python -m pytest -n 4 \ --cov=xarray \ --cov-report=xml + doctest: + name: Doctests + runs-on: "ubuntu-latest" + defaults: + run: + shell: bash -l {0} + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch all history for all branches and tags. + - uses: conda-incubator/setup-miniconda@v2 + with: + channels: conda-forge + channel-priority: strict + mamba-version: "*" + activate-environment: xarray-tests + auto-update-conda: false + python-version: "3.8" + + - name: Install conda dependencies + run: | + mamba env update -f ci/requirements/environment.yml + - name: Install xarray + run: | + python -m pip install --no-deps -e . + - name: Version info + run: | + conda info -a + conda list + python xarray/util/print_versions.py + - name: Run doctests + run: | + python -m pytest --doctest-modules xarray --ignore xarray/tests From 80da3315216278837d46384d04e917d9f14baef2 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 20:00:03 -0700 Subject: [PATCH 11/51] Add minimum version policy workflow --- .github/workflows/ci-additional.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 132294f2a3a..14b429f52b6 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -101,3 +101,31 @@ jobs: - name: Run doctests run: | python -m pytest --doctest-modules xarray --ignore xarray/tests + + min-version-policy: + name: Minimum Version Policy + runs-on: "ubuntu-latest" + defaults: + run: + shell: bash -l {0} + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch all history for all branches and tags. + - uses: conda-incubator/setup-miniconda@v2 + with: + channels: conda-forge + channel-priority: strict + mamba-version: "*" + auto-update-conda: false + + - name: minimum versions policy + run: | + mamba install -y pyyaml + python ci/min_deps_check.py ci/requirements/py36-bare-minimum.yml + python ci/min_deps_check.py ci/requirements/py36-min-all-deps.yml From 32114b26dd644bac8c5dcb7018df93703f3c788f Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 20:19:13 -0700 Subject: [PATCH 12/51] Simplify if logic --- .github/workflows/ci-additional.yaml | 6 ++++++ .github/workflows/ci.yaml | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 14b429f52b6..5d22506f37e 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -25,6 +25,7 @@ jobs: "py36-min-all-deps", "py36-min-nep18", "py38-all-but-dask", + "py38-backend-api-v2", ] steps: - name: Cancel previous runs @@ -41,9 +42,14 @@ jobs: mamba-version: "*" activate-environment: xarray-tests auto-update-conda: false + python-version: 3.8 - name: Install conda dependencies run: | + if [[ ${{ matrix.env }} == "py38-backend-api-v2" ]] ; + then + mamba env update -f ci/requirements/environment.yml + fi mamba env update -f ci/requirements/${{ matrix.env }}.yml - name: Install xarray diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d15014d96b2..eaa012f4d42 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,13 +37,12 @@ jobs: auto-update-conda: false python-version: ${{ matrix.python-version }} - - name: Install conda dependencies (windows) - if: startsWith(matrix.os, 'windows') - run: | - mamba env update -f ci/requirements/environment-windows.yml - - name: Install conda dependencies (linux or macos) - if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') + - name: Install conda dependencies run: | + if [[ ${{ matrix.os }} == windows* ]] ; + then + mamba env update -f ci/requirements/environment-windows.yml + fi mamba env update -f ci/requirements/environment.yml - name: Install xarray run: | From 4eacb6532cbbc6c5cda8e81972e210b112ac52c6 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 20:40:49 -0700 Subject: [PATCH 13/51] Add flaky and backend-api-v2 settings --- .github/workflows/ci-additional.yaml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 5d22506f37e..8dec041d44d 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -26,6 +26,7 @@ jobs: "py36-min-nep18", "py38-all-but-dask", "py38-backend-api-v2", + "py38-flaky", ] steps: - name: Cancel previous runs @@ -44,13 +45,25 @@ jobs: auto-update-conda: false python-version: 3.8 - - name: Install conda dependencies + - name: Set environment variables run: | if [[ ${{ matrix.env }} == "py38-backend-api-v2" ]] ; then - mamba env update -f ci/requirements/environment.yml + echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV + echo "XARRAY_BACKEND_API=v2" >> $GITHUB_ENV + fi + + if [[ ${{ matrix.env }} == "py38-flaky" ]] ; + then + echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV + echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV fi - mamba env update -f ci/requirements/${{ matrix.env }}.yml + + echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV + + - name: Install conda dependencies + run: | + mamba env update -f $CONDA_ENV_FILE - name: Install xarray run: | @@ -68,7 +81,8 @@ jobs: run: | python -m pytest -n 4 \ --cov=xarray \ - --cov-report=xml + --cov-report=xml \ + $PYTEST_EXTRA_FLAGS doctest: name: Doctests runs-on: "ubuntu-latest" From 4c6252b3367ca1222670fab565fe5cac228103af Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 20:45:50 -0700 Subject: [PATCH 14/51] Fix if elif else statements --- .github/workflows/ci-additional.yaml | 11 ++++++----- .github/workflows/ci.yaml | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 8dec041d44d..af8659df383 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -51,15 +51,16 @@ jobs: then echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV echo "XARRAY_BACKEND_API=v2" >> $GITHUB_ENV - fi - - if [[ ${{ matrix.env }} == "py38-flaky" ]] ; + + elif [[ ${{ matrix.env }} == "py38-flaky" ]] ; then echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV - fi + + else + echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV - echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV + - name: Install conda dependencies run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eaa012f4d42..1c94bdca4c0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,8 +42,9 @@ jobs: if [[ ${{ matrix.os }} == windows* ]] ; then mamba env update -f ci/requirements/environment-windows.yml - fi - mamba env update -f ci/requirements/environment.yml + else + mamba env update -f ci/requirements/environment.yml + fi - name: Install xarray run: | python -m pip install --no-deps -e . From 002ab257875af279f599d6c7873911624e1ab55d Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 20:51:41 -0700 Subject: [PATCH 15/51] Fix typo --- .github/workflows/ci-additional.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index af8659df383..985e6e49188 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -51,16 +51,15 @@ jobs: then echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV echo "XARRAY_BACKEND_API=v2" >> $GITHUB_ENV - + elif [[ ${{ matrix.env }} == "py38-flaky" ]] ; then echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV - + else echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV - - + fi - name: Install conda dependencies run: | From e65c65506d8299aabc61387730f2b2059eaa7818 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 21:07:34 -0700 Subject: [PATCH 16/51] Remove azure pipelines configurations --- README.rst | 4 +- azure-pipelines.yml | 126 --------------------------------- ci/azure/add-conda-to-path.yml | 18 ----- ci/azure/install.yml | 68 ------------------ ci/azure/unit-tests.yml | 39 ---------- ci/requirements/py36.yml | 49 ------------- ci/requirements/py37.yml | 49 ------------- ci/requirements/py38.yml | 49 ------------- 8 files changed, 2 insertions(+), 400 deletions(-) delete mode 100644 azure-pipelines.yml delete mode 100644 ci/azure/add-conda-to-path.yml delete mode 100644 ci/azure/install.yml delete mode 100644 ci/azure/unit-tests.yml delete mode 100644 ci/requirements/py36.yml delete mode 100644 ci/requirements/py37.yml delete mode 100644 ci/requirements/py38.yml diff --git a/README.rst b/README.rst index 0b3b66c468d..e258a8ccd23 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,8 @@ xarray: N-D labeled arrays and datasets ======================================= -.. image:: https://dev.azure.com/xarray/xarray/_apis/build/status/pydata.xarray?branchName=master - :target: https://dev.azure.com/xarray/xarray/_build/latest?definitionId=1&branchName=master +.. image:: https://github.com/pydata/xarray/workflows/CI/badge.svg?branch=master + :target: https://github.com/pydata/xarray/actions?query=workflow%3ACI .. image:: https://codecov.io/gh/pydata/xarray/branch/master/graph/badge.svg :target: https://codecov.io/gh/pydata/xarray .. image:: https://readthedocs.org/projects/xray/badge/?version=latest diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 6682bbdf334..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,126 +0,0 @@ -variables: - pytest_extra_flags: '' - allow_failure: false - upstream_dev: false - -jobs: - -- job: Linux - strategy: - matrix: - py36-bare-minimum: - conda_env: py36-bare-minimum - py36-min-all-deps: - conda_env: py36-min-all-deps - py36-min-nep18: - conda_env: py36-min-nep18 - py36: - conda_env: py36 - py37: - conda_env: py37 - py38: - conda_env: py38 - py38-backend-api-v2: - conda_env: py38 - environment_variables: XARRAY_BACKEND_API=v2 - py38-all-but-dask: - conda_env: py38-all-but-dask - py38-upstream-dev: - conda_env: py38 - upstream_dev: true - allow_failure: true - py38-flaky: - conda_env: py38 - pytest_extra_flags: --run-flaky --run-network-tests - allow_failure: true - pool: - vmImage: 'ubuntu-16.04' - steps: - - template: ci/azure/unit-tests.yml - -- job: MacOSX - strategy: - matrix: - py38: - conda_env: py38 - pool: - vmImage: 'macOS-10.15' - steps: - - template: ci/azure/unit-tests.yml - -- job: Windows - strategy: - matrix: - py37: - conda_env: py37-windows - pool: - vmImage: 'windows-2019' - steps: - - template: ci/azure/unit-tests.yml - -- job: LintFlake8 - pool: - vmImage: 'ubuntu-16.04' - steps: - - task: UsePythonVersion@0 - - bash: python -m pip install flake8 - displayName: Install flake8 - - bash: flake8 - displayName: flake8 lint checks - -- job: FormattingBlack - pool: - vmImage: 'ubuntu-16.04' - steps: - - task: UsePythonVersion@0 - - bash: python -m pip install black - displayName: Install black - - bash: black --check . - displayName: black formatting check - -- job: Doctests - variables: - conda_env: py38 - pool: - vmImage: 'ubuntu-16.04' - steps: - - template: ci/azure/install.yml - - bash: | - source activate xarray-tests - python -m pytest --doctest-modules xarray --ignore xarray/tests - displayName: Run doctests - -- job: TypeChecking - variables: - conda_env: py38 - pool: - vmImage: 'ubuntu-16.04' - steps: - - template: ci/azure/install.yml - - bash: | - source activate xarray-tests - mypy . - displayName: mypy type checks - -- job: isort - variables: - conda_env: py38 - pool: - vmImage: 'ubuntu-16.04' - steps: - - template: ci/azure/install.yml - - bash: | - source activate xarray-tests - isort --check . - displayName: isort formatting checks - -- job: MinimumVersionsPolicy - pool: - vmImage: 'ubuntu-16.04' - steps: - - template: ci/azure/add-conda-to-path.yml - - bash: | - conda install -y pyyaml - python ci/min_deps_check.py ci/requirements/py36-bare-minimum.yml - python ci/min_deps_check.py ci/requirements/py36-min-all-deps.yml - displayName: minimum versions policy diff --git a/ci/azure/add-conda-to-path.yml b/ci/azure/add-conda-to-path.yml deleted file mode 100644 index e5173835388..00000000000 --- a/ci/azure/add-conda-to-path.yml +++ /dev/null @@ -1,18 +0,0 @@ -# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/anaconda -steps: - -- bash: | - echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH (Linux) - condition: eq(variables['Agent.OS'], 'Linux') - -- bash: | - echo "##vso[task.prependpath]$CONDA/bin" - sudo chown -R $USER $CONDA - displayName: Add conda to PATH (OS X) - condition: eq(variables['Agent.OS'], 'Darwin') - -- powershell: | - Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Add conda to PATH (Windows) - condition: eq(variables['Agent.OS'], 'Windows_NT') diff --git a/ci/azure/install.yml b/ci/azure/install.yml deleted file mode 100644 index 2b080287669..00000000000 --- a/ci/azure/install.yml +++ /dev/null @@ -1,68 +0,0 @@ -parameters: - env_file: ci/requirements/$CONDA_ENV.yml - -steps: - -- template: add-conda-to-path.yml - -- bash: | - conda install -y mamba -c conda-forge - source activate # required for mamba on windows - mamba env create -n xarray-tests --file ${{ parameters.env_file }} - displayName: Install conda dependencies - -# TODO: add sparse back in, once Numba works with the development version of -# NumPy again: https://github.com/pydata/xarray/issues/4146 -- bash: | - source activate xarray-tests - conda uninstall -y --force \ - numpy \ - scipy \ - pandas \ - matplotlib \ - dask \ - distributed \ - zarr \ - cftime \ - rasterio \ - pint \ - bottleneck \ - sparse - python -m pip install \ - -i https://pypi.anaconda.org/scipy-wheels-nightly/simple \ - --no-deps \ - --pre \ - --upgrade \ - numpy \ - scipy \ - pandas - python -m pip install \ - -f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com \ - --no-deps \ - --pre \ - --upgrade \ - matplotlib - python -m pip install \ - --no-deps \ - --upgrade \ - git+https://github.com/dask/dask \ - git+https://github.com/dask/distributed \ - git+https://github.com/zarr-developers/zarr \ - git+https://github.com/Unidata/cftime \ - git+https://github.com/mapbox/rasterio \ - git+https://github.com/hgrecco/pint \ - git+https://github.com/pydata/bottleneck - condition: eq(variables['UPSTREAM_DEV'], 'true') - displayName: Install upstream dev dependencies - -- bash: | - source activate xarray-tests - python -m pip install --no-deps -e . - displayName: Install xarray - -- bash: | - source activate xarray-tests - conda info -a - conda list - python xarray/util/print_versions.py - displayName: Version info diff --git a/ci/azure/unit-tests.yml b/ci/azure/unit-tests.yml deleted file mode 100644 index 0fb2d53cc36..00000000000 --- a/ci/azure/unit-tests.yml +++ /dev/null @@ -1,39 +0,0 @@ -steps: - -- template: install.yml - -- bash: | - source activate xarray-tests - python -OO -c "import xarray" - displayName: Import xarray - -# Work around for allowed test failures: -# https://github.com/microsoft/azure-pipelines-tasks/issues/9302 -- bash: | - source activate xarray-tests - $(environment_variables) pytest -n 4 \ - --junitxml=junit/test-results.xml \ - --cov=xarray \ - --cov-report=xml \ - $(pytest_extra_flags) \ - || ( \ - [ "$ALLOW_FAILURE" = "true" ] \ - && echo "##vso[task.logissue type=warning]Allowed CI failure!!" \ - && echo "##vso[task.complete result=SucceededWithIssues]" \ - ) - displayName: Run tests - -- bash: | - curl https://codecov.io/bash > codecov.sh - bash codecov.sh -t 688f4d53-31bb-49b5-8370-4ce6f792cf3d - displayName: Upload coverage to codecov.io - -# TODO: publish coverage results to Azure, once we can merge them across -# multiple jobs: https://stackoverflow.com/questions/56776185 - -- task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-*.xml' - failTaskOnFailedTests: false - testRunTitle: '$(Agent.JobName)' diff --git a/ci/requirements/py36.yml b/ci/requirements/py36.yml deleted file mode 100644 index 97fe92e2271..00000000000 --- a/ci/requirements/py36.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: xarray-tests -channels: - - conda-forge - - nodefaults -dependencies: - - python=3.6 - - black - - boto3 - - bottleneck - - cartopy - - cdms2 - - cfgrib - - cftime - - coveralls - - dask - - distributed - - flake8 - - h5netcdf - - h5py=2 - - hdf5 - - hypothesis - - iris - - isort - - lxml # Optional dep of pydap - - matplotlib-base - - mypy=0.790 # Must match .pre-commit-config.yaml - - nc-time-axis - - netcdf4 - - numba - - numpy - - pandas - - pint - - pip - - pseudonetcdf - - pydap - # - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum - - pytest - - pytest-cov - - pytest-env - - pytest-xdist - - rasterio - - scipy - - seaborn - - setuptools - - sparse - - toolz - - zarr - - pip: - - numbagg diff --git a/ci/requirements/py37.yml b/ci/requirements/py37.yml deleted file mode 100644 index 34d8b3a3fc2..00000000000 --- a/ci/requirements/py37.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: xarray-tests -channels: - - conda-forge - - nodefaults -dependencies: - - python=3.7 - - black - - boto3 - - bottleneck - - cartopy - - cdms2 - - cfgrib - - cftime - - coveralls - - dask - - distributed - - flake8 - - h5netcdf - - h5py=2 - - hdf5 - - hypothesis - - iris - - isort - - lxml # Optional dep of pydap - - matplotlib-base - - mypy=0.790 # Must match .pre-commit-config.yaml - - nc-time-axis - - netcdf4 - - numba - - numpy - - pandas - - pint - - pip - - pseudonetcdf - - pydap - # - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum - - pytest - - pytest-cov - - pytest-env - - pytest-xdist - - rasterio - - scipy - - seaborn - - setuptools - - sparse - - toolz - - zarr - - pip: - - numbagg diff --git a/ci/requirements/py38.yml b/ci/requirements/py38.yml deleted file mode 100644 index 7e31216c285..00000000000 --- a/ci/requirements/py38.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: xarray-tests -channels: - - conda-forge - - nodefaults -dependencies: - - python=3.8 - - black - - boto3 - - bottleneck - - cartopy - - cdms2 - - cfgrib - - cftime - - coveralls - - dask - - distributed - - flake8 - - h5netcdf - - h5py=2 - - hdf5 - - hypothesis - - iris - - isort - - lxml # Optional dep of pydap - - matplotlib-base - - mypy=0.790 # Must match .pre-commit-config.yaml - - nc-time-axis - - netcdf4 - - numba - - numpy - - pandas - - pint - - pip=20.2 - - pseudonetcdf - - pydap - # - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum - - pytest - - pytest-cov - - pytest-env - - pytest-xdist - - rasterio - - scipy - - seaborn - - setuptools - - sparse - - toolz - - zarr - - pip: - - numbagg From 06b833463f59aa2cfee63ae38675f7f7dafb73a1 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 23 Dec 2020 21:13:03 -0700 Subject: [PATCH 17/51] Fix environment file name --- .github/workflows/upstream-dev-ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 629b1c27b05..5e1216926ef 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -1,4 +1,4 @@ -name: CI +name: CI Upstream on: push: branches: @@ -40,7 +40,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Set up conda environment run: | - mamba env update -f ci/requirements/py38.yml + mamba env update -f ci/requirements/environment.yml bash ci/install-upstream-wheels.sh conda list - name: import xarray From edf8d144bf94cc834dee14ae6845431cb776649a Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 24 Dec 2020 18:46:32 -0700 Subject: [PATCH 18/51] Upload code coverage for additional CI --- .github/workflows/ci-additional.yaml | 8 ++++++++ .github/workflows/ci.yaml | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 985e6e49188..a8a7793cc67 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -83,6 +83,14 @@ jobs: --cov=xarray \ --cov-report=xml \ $PYTEST_EXTRA_FLAGS + + - name: Upload code coverage to Codecov + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + flags: unittests,${{ matrix.env }} + name: codecov-umbrella + fail_ci_if_error: false doctest: name: Doctests runs-on: "ubuntu-latest" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1c94bdca4c0..54f292fabe5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,6 +45,9 @@ jobs: else mamba env update -f ci/requirements/environment.yml fi + echo "OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV + echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV + - name: Install xarray run: | python -m pip install --no-deps -e . @@ -68,6 +71,6 @@ jobs: with: file: ./coverage.xml flags: unittests - env_vars: OS,PYTHON + env_vars: OS_NAME,PYTHON_VERSION name: codecov-umbrella fail_ci_if_error: false From ec1e5fc34eb9caa150693e0d8d2f50c4f5cf697a Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 24 Dec 2020 19:11:30 -0700 Subject: [PATCH 19/51] Cache conda pkgs_dir --- .github/workflows/ci-additional.yaml | 28 +++++++++++++++++------- .github/workflows/ci.yaml | 32 +++++++++++++++++++++------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index a8a7793cc67..9f93887100c 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -36,14 +36,6 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 # Fetch all history for all branches and tags. - - uses: conda-incubator/setup-miniconda@v2 - with: - channels: conda-forge - channel-priority: strict - mamba-version: "*" - activate-environment: xarray-tests - auto-update-conda: false - python-version: 3.8 - name: Set environment variables run: | @@ -60,6 +52,26 @@ jobs: else echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV fi + - name: Cache conda + uses: actions/cache@v2 + env: + # Increase this value to reset cache if the environment file has changed + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: + ${{ runner.os }}-conda-${{ matrix.env }}-${{ env.CACHE_NUMBER }}-${{ + hashFiles(${{ env.CONDA_ENV_FILE }}) }} + + - uses: conda-incubator/setup-miniconda@v2 + with: + channels: conda-forge + channel-priority: strict + mamba-version: "*" + activate-environment: xarray-tests + auto-update-conda: false + python-version: 3.8 + use-only-tar-bz2: true - name: Install conda dependencies run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 54f292fabe5..855c43db26f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,6 +28,28 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 # Fetch all history for all branches and tags. + - name: Set environment variables + run: | + if [[ ${{ matrix.os }} == windows* ]] ; + then + echo "CONDA_ENV_FILE=ci/requirements/environment-windows.yml" >> $GITHUB_ENV + else + echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV + + fi + echo "OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV + echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV + + - name: Cache conda + uses: actions/cache@v2 + env: + # Increase this value to reset cache if the environment file has changed + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: + ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ + hashFiles(${{ env.CONDA_ENV_FILE }}) }} - uses: conda-incubator/setup-miniconda@v2 with: channels: conda-forge @@ -36,17 +58,11 @@ jobs: activate-environment: xarray-tests auto-update-conda: false python-version: ${{ matrix.python-version }} + use-only-tar-bz2: true - name: Install conda dependencies run: | - if [[ ${{ matrix.os }} == windows* ]] ; - then - mamba env update -f ci/requirements/environment-windows.yml - else - mamba env update -f ci/requirements/environment.yml - fi - echo "OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV - echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV + mamba env update -f $CONDA_ENV_FILE - name: Install xarray run: | From 257529bf5d432e99b04e0c5dc2c727fb38a7c733 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 24 Dec 2020 19:16:26 -0700 Subject: [PATCH 20/51] Fix cache key --- .github/workflows/ci-additional.yaml | 2 +- .github/workflows/ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 9f93887100c..2f6d2317d11 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -61,7 +61,7 @@ jobs: path: ~/conda_pkgs_dir key: ${{ runner.os }}-conda-${{ matrix.env }}-${{ env.CACHE_NUMBER }}-${{ - hashFiles(${{ env.CONDA_ENV_FILE }}) }} + hashFiles('ci/requirements/**.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 855c43db26f..230e69c0095 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,7 +49,7 @@ jobs: path: ~/conda_pkgs_dir key: ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ - hashFiles(${{ env.CONDA_ENV_FILE }}) }} + hashFiles('ci/requirements/**.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: channels: conda-forge From 26a031683d500a59f35a7075c990a61748b3baf8 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 24 Dec 2020 19:20:18 -0700 Subject: [PATCH 21/51] Remove unnecessary cache number variable --- .github/workflows/ci-additional.yaml | 5 +---- .github/workflows/ci.yaml | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 2f6d2317d11..0050d06abb3 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -54,13 +54,10 @@ jobs: fi - name: Cache conda uses: actions/cache@v2 - env: - # Increase this value to reset cache if the environment file has changed - CACHE_NUMBER: 0 with: path: ~/conda_pkgs_dir key: - ${{ runner.os }}-conda-${{ matrix.env }}-${{ env.CACHE_NUMBER }}-${{ + ${{ runner.os }}-conda-${{ matrix.env }}-${{ hashFiles('ci/requirements/**.yml') }} - uses: conda-incubator/setup-miniconda@v2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 230e69c0095..ba3c1470dc5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,13 +42,10 @@ jobs: - name: Cache conda uses: actions/cache@v2 - env: - # Increase this value to reset cache if the environment file has changed - CACHE_NUMBER: 0 with: path: ~/conda_pkgs_dir key: - ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ + ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{ hashFiles('ci/requirements/**.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: From 85303746fd9960d4606766d4b28d3228040dbcb0 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 29 Dec 2020 16:45:16 -0700 Subject: [PATCH 22/51] Use `runner.os` instead of `matrix.os` --- .github/workflows/ci-additional.yaml | 2 +- .github/workflows/ci.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 0050d06abb3..75bdcc23578 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -10,7 +10,7 @@ on: jobs: test: - name: ${{ matrix.os }} ${{ matrix.env }} + name: ${{ runner.os }} ${{ matrix.env }} runs-on: ${{ matrix.os }} defaults: run: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ba3c1470dc5..b1504586a09 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ on: jobs: test: - name: ${{ matrix.os }} py${{ matrix.python-version }} + name: ${{ runner.os }} py${{ matrix.python-version }} runs-on: ${{ matrix.os }} defaults: run: @@ -37,7 +37,7 @@ jobs: echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV fi - echo "OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV + echo "OS_NAME=${{ runner.os }}" >> $GITHUB_ENV echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV - name: Cache conda From e6baaa27dc465b0f80b3650f1dbd462a211ba825 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 29 Dec 2020 16:51:06 -0700 Subject: [PATCH 23/51] Use RUNNER_OS env variable --- .github/workflows/ci-additional.yaml | 3 ++- .github/workflows/ci.yaml | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 75bdcc23578..c28d616ce4d 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -10,8 +10,8 @@ on: jobs: test: - name: ${{ runner.os }} ${{ matrix.env }} runs-on: ${{ matrix.os }} + name: ${{ runner.os }} ${{ matrix.env }} defaults: run: shell: bash -l {0} @@ -98,6 +98,7 @@ jobs: with: file: ./coverage.xml flags: unittests,${{ matrix.env }} + env_vars: RUNNER_OS name: codecov-umbrella fail_ci_if_error: false doctest: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b1504586a09..3885d2bd4a6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,9 +9,9 @@ on: workflow_dispatch: # allows you to trigger manually jobs: - test: - name: ${{ runner.os }} py${{ matrix.python-version }} + test: runs-on: ${{ matrix.os }} + name: ${{ runner.os }} py${{ matrix.python-version }} defaults: run: shell: bash -l {0} @@ -37,7 +37,6 @@ jobs: echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV fi - echo "OS_NAME=${{ runner.os }}" >> $GITHUB_ENV echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV - name: Cache conda @@ -84,6 +83,6 @@ jobs: with: file: ./coverage.xml flags: unittests - env_vars: OS_NAME,PYTHON_VERSION + env_vars: RUNNER_OS,PYTHON_VERSION name: codecov-umbrella fail_ci_if_error: false From 3c8da767ac2ce7a973a03085244f37588b1f826b Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 29 Dec 2020 16:55:28 -0700 Subject: [PATCH 24/51] Disable name for the time being --- .github/workflows/ci-additional.yaml | 1 - .github/workflows/ci.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index c28d616ce4d..c2e990fbd23 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -11,7 +11,6 @@ on: jobs: test: runs-on: ${{ matrix.os }} - name: ${{ runner.os }} ${{ matrix.env }} defaults: run: shell: bash -l {0} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3885d2bd4a6..b6c6f5fa646 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,6 @@ on: jobs: test: runs-on: ${{ matrix.os }} - name: ${{ runner.os }} py${{ matrix.python-version }} defaults: run: shell: bash -l {0} From 28eca4b40e3e02ece06ca754cabb6c9a9514af59 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 29 Dec 2020 17:06:02 -0700 Subject: [PATCH 25/51] Another attempt at setting name --- .github/workflows/ci-additional.yaml | 1 + .github/workflows/ci.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index c2e990fbd23..e7f4ada6c6a 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -10,6 +10,7 @@ on: jobs: test: + name: ${{ env.RUNNER_OS }} ${{ matrix.env }} runs-on: ${{ matrix.os }} defaults: run: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b6c6f5fa646..27d5cf04353 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,7 @@ on: jobs: test: + name: ${{ env.RUNNER_OS }} py${{ matrix.python-version }} runs-on: ${{ matrix.os }} defaults: run: From b8349196f904fa3bdcb62ce69b32850b4f59d1e8 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 29 Dec 2020 17:08:06 -0700 Subject: [PATCH 26/51] `runner.os` doesn't work. Use `matrix.os` instead --- .github/workflows/ci-additional.yaml | 2 +- .github/workflows/ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index e7f4ada6c6a..4c9df0ea2e9 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -10,7 +10,7 @@ on: jobs: test: - name: ${{ env.RUNNER_OS }} ${{ matrix.env }} + name: ${{ matrix.os }} ${{ matrix.env }} runs-on: ${{ matrix.os }} defaults: run: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 27d5cf04353..26d6feae4c5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ on: jobs: test: - name: ${{ env.RUNNER_OS }} py${{ matrix.python-version }} + name: ${{ matrix.os }} py${{ matrix.python-version }} runs-on: ${{ matrix.os }} defaults: run: From 646b079b90e238edc16e3143fb833b4a0d246c47 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Sat, 2 Jan 2021 13:07:33 -0700 Subject: [PATCH 27/51] Update env creation guidelines --- doc/contributing.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index 39863ec96c7..49bb86fb7dc 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -152,8 +152,13 @@ We'll now kick off a two-step process: .. code-block:: sh # Create and activate the build environment - # This is for Linux and MacOS. On Windows, use py37-windows.yml instead. - conda env create -f ci/requirements/py37.yml + conda create -c conda-forge -n xarray-tests python=3.8 + + # This is for Linux and MacOS + conda env update -f ci/requirements/environment.yml + + # On windows, use environment-windows.yml instead + conda env update -f ci/requirements/environment-windows.yml conda activate xarray-tests From c4b4139bceaca7ccab9a8ba6a1b42f6409f1901f Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Sat, 2 Jan 2021 13:18:33 -0700 Subject: [PATCH 28/51] Add `pre-commit run --all-files` check --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- doc/contributing.rst | 20 ++------------------ 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 15c971907f6..3078c583502 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,6 +2,6 @@ - [ ] Closes #xxxx - [ ] Tests added - - [ ] Passes `isort . && black . && mypy . && flake8` + - [ ] Passes `pre-commit run --all-files` - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` diff --git a/doc/contributing.rst b/doc/contributing.rst index 49bb86fb7dc..2a6f0ef2696 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -368,22 +368,7 @@ xarray uses several tools to ensure a consistent code format throughout the proj - `mypy `_ for static type checking on `type hints `_ -``pip``:: - - pip install black flake8 isort mypy blackdoc - -and then run from the root of the xarray repository:: - - isort . - black -t py36 . - blackdoc -t py36 . - flake8 - mypy . - -to auto-format your code. Additionally, many editors have plugins that will -apply ``black`` as you edit files. - -Optionally, you may wish to setup `pre-commit hooks `_ +We highly recommend that you setup `pre-commit hooks `_ to automatically run all the above tools every time you make a git commit. This can be done by installing ``pre-commit``:: @@ -862,8 +847,7 @@ PR checklist - **Properly format your code** and verify that it passes the formatting guidelines set by `Black `_ and `Flake8 `_. See `"Code formatting" `_. You can use `pre-commit `_ to run these automatically on each commit. - - Run ``black .`` in the root directory. This may modify some files. Confirm and commit any formatting changes. - - Run ``flake8`` in the root directory. If this fails, it will log an error message. + - Run ``pre-commit run --all-files`` in the root directory. This may modify some files. Confirm and commit any formatting changes. - **Push your code and** `create a PR on GitHub `_. - **Use a helpful title for your pull request** by summarizing the main contributions rather than using the latest commit message. If the PR addresses an `issue `_, please `reference it `_. From 8437d12361cf168a19bde2bdc1d8ecb08f6ab5cc Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 16:02:10 -0700 Subject: [PATCH 29/51] Update blackdoc version --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5253bb3f979..acf33c67ed1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ repos: # isort should run before black as black sometimes tweaks the isort output - repo: https://github.com/PyCQA/isort - rev: 5.6.4 + rev: 5.7.0 hooks: - id: isort # https://github.com/python/black#version-control-integration @@ -11,7 +11,7 @@ repos: hooks: - id: black - repo: https://github.com/keewis/blackdoc - rev: v0.3.1 + rev: v0.3.2 hooks: - id: blackdoc - repo: https://gitlab.com/pycqa/flake8 From afaf4b63eade097e26633287eb4540ee1e1de0bb Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 16:35:33 -0700 Subject: [PATCH 30/51] Add new pre-commit hooks --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index acf33c67ed1..07aa1e16c5d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,13 @@ # https://pre-commit.com/ repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-docstring-first + - id: check-yaml + - id: double-quote-string-fixer # isort should run before black as black sometimes tweaks the isort output - repo: https://github.com/PyCQA/isort rev: 5.7.0 From 1a8ba88701106e98d79a94386f285da7479a2daa Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 16:49:06 -0700 Subject: [PATCH 31/51] Add some of the out-of-the box hooks --- .github/ISSUE_TEMPLATE/config.yml | 4 +--- .github/stale.yml | 2 +- .github/workflows/ci-additional.yaml | 8 ++++---- .github/workflows/ci.yaml | 8 ++++---- .github/workflows/upstream-dev-ci.yaml | 4 ++-- .pre-commit-config.yaml | 2 -- doc/_templates/autosummary/base.rst | 2 +- doc/contributing.rst | 2 +- doc/gallery/README.txt | 1 - doc/groupby.rst | 6 +++--- doc/howdoi.rst | 1 - doc/indexing.rst | 2 +- doc/internals.rst | 2 +- doc/interpolation.rst | 4 ++-- doc/io.rst | 4 ++-- doc/plotting.rst | 2 +- doc/quick-overview.rst | 2 +- doc/reshaping.rst | 4 ++-- doc/weather-climate.rst | 2 +- doc/whats-new.rst | 2 +- licenses/PYTHON_LICENSE | 2 +- xarray/core/variable.py | 2 ++ xarray/tests/data/example.ict | 2 +- 23 files changed, 33 insertions(+), 37 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 00c65e99767..0ad7e5f3e13 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -4,7 +4,5 @@ contact_links: url: https://github.com/pydata/xarray/discussions about: | Ask questions and discuss with other community members here. - If you have a question like "How do I concatenate a list of datasets?" then + If you have a question like "How do I concatenate a list of datasets?" then please include a self-contained reproducible example if possible. - - \ No newline at end of file diff --git a/.github/stale.yml b/.github/stale.yml index f4835b5eeec..f4057844d01 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -56,4 +56,4 @@ limitPerRun: 1 # start with a small number # issues: # exemptLabels: -# - confirmed \ No newline at end of file +# - confirmed diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 4c9df0ea2e9..6dbe18e082c 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -40,12 +40,12 @@ jobs: - name: Set environment variables run: | if [[ ${{ matrix.env }} == "py38-backend-api-v2" ]] ; - then + then echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV echo "XARRAY_BACKEND_API=v2" >> $GITHUB_ENV elif [[ ${{ matrix.env }} == "py38-flaky" ]] ; - then + then echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV @@ -80,7 +80,7 @@ jobs: - name: Version info run: | - conda info -a + conda info -a conda list python xarray/util/print_versions.py - name: Import xarray @@ -133,7 +133,7 @@ jobs: python -m pip install --no-deps -e . - name: Version info run: | - conda info -a + conda info -a conda list python xarray/util/print_versions.py - name: Run doctests diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 26d6feae4c5..374b7ac82ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ on: workflow_dispatch: # allows you to trigger manually jobs: - test: + test: name: ${{ matrix.os }} py${{ matrix.python-version }} runs-on: ${{ matrix.os }} defaults: @@ -31,11 +31,11 @@ jobs: - name: Set environment variables run: | if [[ ${{ matrix.os }} == windows* ]] ; - then + then echo "CONDA_ENV_FILE=ci/requirements/environment-windows.yml" >> $GITHUB_ENV else echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV - + fi echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV @@ -66,7 +66,7 @@ jobs: - name: Version info run: | - conda info -a + conda info -a conda list python xarray/util/print_versions.py - name: Import xarray diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 5e1216926ef..8d6b64158b1 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -128,8 +128,8 @@ jobs: } const result = await github.graphql(query, variables) - // If no issue is open, create a new issue, - // else update the body of the existing issue. + // If no issue is open, create a new issue, + // else update the body of the existing issue. if (result.repository.issues.edges.length === 0) { github.issues.create({ owner: variables.owner, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07aa1e16c5d..b0fa21a7bf9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,9 +5,7 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer - - id: check-docstring-first - id: check-yaml - - id: double-quote-string-fixer # isort should run before black as black sometimes tweaks the isort output - repo: https://github.com/PyCQA/isort rev: 5.7.0 diff --git a/doc/_templates/autosummary/base.rst b/doc/_templates/autosummary/base.rst index e6726a71d7c..53f2a29c193 100644 --- a/doc/_templates/autosummary/base.rst +++ b/doc/_templates/autosummary/base.rst @@ -1,3 +1,3 @@ :github_url: {{ fullname | github_url | escape_underscores }} -{% extends "!autosummary/base.rst" %} \ No newline at end of file +{% extends "!autosummary/base.rst" %} diff --git a/doc/contributing.rst b/doc/contributing.rst index 2a6f0ef2696..0cd6bf8beab 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -153,7 +153,7 @@ We'll now kick off a two-step process: # Create and activate the build environment conda create -c conda-forge -n xarray-tests python=3.8 - + # This is for Linux and MacOS conda env update -f ci/requirements/environment.yml diff --git a/doc/gallery/README.txt b/doc/gallery/README.txt index b17f803696b..63f7d477cf4 100644 --- a/doc/gallery/README.txt +++ b/doc/gallery/README.txt @@ -2,4 +2,3 @@ Gallery ======= - diff --git a/doc/groupby.rst b/doc/groupby.rst index c72a26c45ea..d0c0b1849f9 100644 --- a/doc/groupby.rst +++ b/doc/groupby.rst @@ -124,7 +124,7 @@ dimensions *other than* the provided one: .. note:: We use an ellipsis (`...`) here to indicate we want to reduce over all - other dimensions + other dimensions First and last @@ -220,10 +220,10 @@ may be desirable: da.groupby_bins("lon", [0, 45, 50]).sum() These methods group by `lon` values. It is also possible to groupby each -cell in a grid, regardless of value, by stacking multiple dimensions, +cell in a grid, regardless of value, by stacking multiple dimensions, applying your function, and then unstacking the result: .. ipython:: python stacked = da.stack(gridcell=["ny", "nx"]) - stacked.groupby("gridcell").sum(...).unstack("gridcell") \ No newline at end of file + stacked.groupby("gridcell").sum(...).unstack("gridcell") diff --git a/doc/howdoi.rst b/doc/howdoi.rst index 84c0c786027..3604d66bd0c 100644 --- a/doc/howdoi.rst +++ b/doc/howdoi.rst @@ -59,4 +59,3 @@ How do I ... - ``obj.dt.ceil``, ``obj.dt.floor``, ``obj.dt.round``. See :ref:`dt_accessor` for more. * - make a mask that is ``True`` where an object contains any of the values in a array - :py:meth:`Dataset.isin`, :py:meth:`DataArray.isin` - diff --git a/doc/indexing.rst b/doc/indexing.rst index 58064582354..78766b8fd81 100644 --- a/doc/indexing.rst +++ b/doc/indexing.rst @@ -548,7 +548,7 @@ you can supply a :py:class:`~xarray.DataArray` with a coordinate, x=xr.DataArray([0, 1, 6], dims="z", coords={"z": ["a", "b", "c"]}), y=xr.DataArray([0, 1, 0], dims="z"), ) - + Analogously, label-based pointwise-indexing is also possible by the ``.sel`` method: diff --git a/doc/internals.rst b/doc/internals.rst index 177cc60ac0a..60d32128c60 100644 --- a/doc/internals.rst +++ b/doc/internals.rst @@ -230,4 +230,4 @@ re-open it directly with Zarr: zgroup = zarr.open("rasm.zarr") print(zgroup.tree()) - dict(zgroup["Tair"].attrs) \ No newline at end of file + dict(zgroup["Tair"].attrs) diff --git a/doc/interpolation.rst b/doc/interpolation.rst index c2922813e15..9a3b7a7ee2d 100644 --- a/doc/interpolation.rst +++ b/doc/interpolation.rst @@ -68,7 +68,7 @@ by specifying the time periods required. Interpolation of data indexed by a :py:class:`~xarray.CFTimeIndex` is also allowed. See :ref:`CFTimeIndex` for examples. - + .. note:: Currently, our interpolation only works for regular grids. @@ -317,4 +317,4 @@ The remapping can be done as follows dsi = ds.interp(lon=lon, lat=lat) dsi.air.plot(ax=axes[1]) @savefig interpolation_sample4.png width=8in - axes[1].set_title("Remapped data") \ No newline at end of file + axes[1].set_title("Remapped data") diff --git a/doc/io.rst b/doc/io.rst index e4fa57689a6..2e46879929b 100644 --- a/doc/io.rst +++ b/doc/io.rst @@ -1107,7 +1107,7 @@ We recommend installing PyNIO via conda:: conda install -c conda-forge pynio .. note:: - + PyNIO is no longer actively maintained and conflicts with netcdf4 > 1.5.3. The PyNIO backend may be moved outside of xarray in the future. @@ -1152,4 +1152,4 @@ Third party libraries More formats are supported by extension libraries: -- `xarray-mongodb `_: Store xarray objects on MongoDB \ No newline at end of file +- `xarray-mongodb `_: Store xarray objects on MongoDB diff --git a/doc/plotting.rst b/doc/plotting.rst index dde48d47569..3699f794ae8 100644 --- a/doc/plotting.rst +++ b/doc/plotting.rst @@ -955,4 +955,4 @@ One can also make line plots with multidimensional coordinates. In this case, `` f, ax = plt.subplots(2, 1) da.plot.line(x="lon", hue="y", ax=ax[0]) @savefig plotting_example_2d_hue_xy.png - da.plot.line(x="lon", hue="x", ax=ax[1]) \ No newline at end of file + da.plot.line(x="lon", hue="x", ax=ax[1]) diff --git a/doc/quick-overview.rst b/doc/quick-overview.rst index e3d1456f017..1a2bc809550 100644 --- a/doc/quick-overview.rst +++ b/doc/quick-overview.rst @@ -153,7 +153,7 @@ Visualizing your datasets is quick and convenient: data.plot() Note the automatic labeling with names and units. Our effort in adding metadata attributes has paid off! Many aspects of these figures are customizable: see :ref:`plotting`. - + pandas ------ diff --git a/doc/reshaping.rst b/doc/reshaping.rst index d07929b3b8f..81fd4a6d35e 100644 --- a/doc/reshaping.rst +++ b/doc/reshaping.rst @@ -19,7 +19,7 @@ Reordering dimensions --------------------- To reorder dimensions on a :py:class:`~xarray.DataArray` or across all variables -on a :py:class:`~xarray.Dataset`, use :py:meth:`~xarray.DataArray.transpose`. An +on a :py:class:`~xarray.Dataset`, use :py:meth:`~xarray.DataArray.transpose`. An ellipsis (`...`) can be use to represent all other dimensions: .. ipython:: python @@ -288,4 +288,4 @@ As a shortcut, you can refer to existing coordinates by name: ds.sortby("x") ds.sortby(["y", "x"]) - ds.sortby(["y", "x"], ascending=False) \ No newline at end of file + ds.sortby(["y", "x"], ascending=False) diff --git a/doc/weather-climate.rst b/doc/weather-climate.rst index cb2921e2ed1..db612d74859 100644 --- a/doc/weather-climate.rst +++ b/doc/weather-climate.rst @@ -136,7 +136,7 @@ For data indexed by a :py:class:`~xarray.CFTimeIndex` xarray currently supports: da.time.dt.ceil("3D") da.time.dt.floor("5D") da.time.dt.round("2D") - + - Group-by operations based on datetime accessor attributes (e.g. by month of the year): diff --git a/doc/whats-new.rst b/doc/whats-new.rst index d4579cb3631..6bafca57d76 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -76,7 +76,7 @@ Internal Changes - Run the tests in parallel using pytest-xdist (:pull:`4694`). By `Justus Magin `_ and `Mathias Hauser `_. -- Replace all usages of ``assert x.identical(y)`` with ``assert_identical(x, y)`` +- Replace all usages of ``assert x.identical(y)`` with ``assert_identical(x, y)`` for clearer error messages. (:pull:`4752`); By `Maximilian Roos `_. diff --git a/licenses/PYTHON_LICENSE b/licenses/PYTHON_LICENSE index 43829c533b9..88251f5b6e8 100644 --- a/licenses/PYTHON_LICENSE +++ b/licenses/PYTHON_LICENSE @@ -251,4 +251,4 @@ FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/xarray/core/variable.py b/xarray/core/variable.py index 0a6eef44c90..a8e4eebeebd 100644 --- a/xarray/core/variable.py +++ b/xarray/core/variable.py @@ -1,3 +1,5 @@ +""" +""" import copy import functools import itertools diff --git a/xarray/tests/data/example.ict b/xarray/tests/data/example.ict index bc04888fb80..41bbfeb996c 100644 --- a/xarray/tests/data/example.ict +++ b/xarray/tests/data/example.ict @@ -28,4 +28,4 @@ Start_UTC, lat, lon, elev, TEST_ppbv, TESTM_ppbv 43200, 41.00000, -71.00000, 5, 1.2345, 2.220 46800, 42.00000, -72.00000, 15, 2.3456, -9999 50400, 42.00000, -73.00000, 20, 3.4567, -7777 -50400, 42.00000, -74.00000, 25, 4.5678, -8888 \ No newline at end of file +50400, 42.00000, -74.00000, 25, 4.5678, -8888 From 09ee1f665c1b613f8e55d7cbf61924be0109060f Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 16:51:46 -0700 Subject: [PATCH 32/51] Formatting only --- doc/internals.rst | 2 +- doc/plotting.rst | 2 +- doc/whats-new.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/internals.rst b/doc/internals.rst index 177cc60ac0a..60d32128c60 100644 --- a/doc/internals.rst +++ b/doc/internals.rst @@ -230,4 +230,4 @@ re-open it directly with Zarr: zgroup = zarr.open("rasm.zarr") print(zgroup.tree()) - dict(zgroup["Tair"].attrs) \ No newline at end of file + dict(zgroup["Tair"].attrs) diff --git a/doc/plotting.rst b/doc/plotting.rst index dde48d47569..3699f794ae8 100644 --- a/doc/plotting.rst +++ b/doc/plotting.rst @@ -955,4 +955,4 @@ One can also make line plots with multidimensional coordinates. In this case, `` f, ax = plt.subplots(2, 1) da.plot.line(x="lon", hue="y", ax=ax[0]) @savefig plotting_example_2d_hue_xy.png - da.plot.line(x="lon", hue="x", ax=ax[1]) \ No newline at end of file + da.plot.line(x="lon", hue="x", ax=ax[1]) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 26a045dc20c..c19bb5cc54d 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -79,7 +79,7 @@ Internal Changes By `Justus Magin `_ and `Mathias Hauser `_. - Replace all usages of ``assert x.identical(y)`` with ``assert_identical(x, y)`` -- Replace all usages of ``assert x.identical(y)`` with ``assert_identical(x, y)`` +- Replace all usages of ``assert x.identical(y)`` with ``assert_identical(x, y)`` for clearer error messages. (:pull:`4752`); By `Maximilian Roos `_. From 3c96c197c291e8ec8e7b78d9519fbc4a6eebf3c8 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 18:28:58 -0700 Subject: [PATCH 33/51] Remove bad change --- xarray/core/variable.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/xarray/core/variable.py b/xarray/core/variable.py index a8e4eebeebd..0a6eef44c90 100644 --- a/xarray/core/variable.py +++ b/xarray/core/variable.py @@ -1,5 +1,3 @@ -""" -""" import copy import functools import itertools From 8760d15fd432b05b40cb867fc025016d0da83435 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 18:32:45 -0700 Subject: [PATCH 34/51] Remove isort and add pre-commit --- ci/requirements/environment-windows.yml | 2 +- ci/requirements/environment.yml | 2 +- doc/contributing.rst | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml index 06a845b12d4..92a43495ed3 100644 --- a/ci/requirements/environment-windows.yml +++ b/ci/requirements/environment-windows.yml @@ -16,7 +16,6 @@ dependencies: - hdf5 - hypothesis - iris - - isort - lxml # Optional dep of pydap - matplotlib-base - nc-time-axis @@ -26,6 +25,7 @@ dependencies: - pandas - pint - pip + - pre-commit - pseudonetcdf - pydap # - pynio # Not available on Windows diff --git a/ci/requirements/environment.yml b/ci/requirements/environment.yml index 479e6e50811..8c14e1310ec 100644 --- a/ci/requirements/environment.yml +++ b/ci/requirements/environment.yml @@ -17,7 +17,6 @@ dependencies: - hdf5 - hypothesis - iris - - isort - lxml # Optional dep of pydap - matplotlib-base - nc-time-axis @@ -27,6 +26,7 @@ dependencies: - pandas - pint - pip=20.2 + - pre-commit - pseudonetcdf - pydap # - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum diff --git a/doc/contributing.rst b/doc/contributing.rst index 0cd6bf8beab..8a9a1f486e3 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -370,11 +370,7 @@ xarray uses several tools to ensure a consistent code format throughout the proj We highly recommend that you setup `pre-commit hooks `_ to automatically run all the above tools every time you make a git commit. This -can be done by installing ``pre-commit``:: - - pip install pre-commit - -and then running:: +can be done by running:: pre-commit install From 8446adaf7926a643f008df26dd70ad7b8f3a3ed4 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 18:39:38 -0700 Subject: [PATCH 35/51] Fix bad merge --- doc/whats-new.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index c19bb5cc54d..624065ecbea 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -77,7 +77,6 @@ Internal Changes - Run the tests in parallel using pytest-xdist (:pull:`4694`). By `Justus Magin `_ and `Mathias Hauser `_. -- Replace all usages of ``assert x.identical(y)`` with ``assert_identical(x, y)`` - Replace all usages of ``assert x.identical(y)`` with ``assert_identical(x, y)`` for clearer error messages. From 5bf36f1a921364892bfddf8bb081b48d781df822 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 18:47:00 -0700 Subject: [PATCH 36/51] Enable `cfgrib` on windows for the time being --- ci/requirements/environment-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml index 92a43495ed3..968b5ab0e88 100644 --- a/ci/requirements/environment-windows.yml +++ b/ci/requirements/environment-windows.yml @@ -6,7 +6,7 @@ dependencies: - bottleneck - cartopy # - cdms2 # Not available on Windows - # - cfgrib # Causes Python interpreter crash on Windows + - cfgrib - cftime - coveralls - dask From fe10a282e79eb98bf718bfeb699b1e5692228edc Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 19:20:35 -0700 Subject: [PATCH 37/51] Disable cfgrib on windows --- ci/requirements/environment-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml index 968b5ab0e88..1a0787a9521 100644 --- a/ci/requirements/environment-windows.yml +++ b/ci/requirements/environment-windows.yml @@ -6,7 +6,7 @@ dependencies: - bottleneck - cartopy # - cdms2 # Not available on Windows - - cfgrib + # - cfgrib # Causes Python interpreter crash on Windows: https://github.com/pydata/xarray/pull/3340 - cftime - coveralls - dask From 954cc69e5c3f3eaaf56a950ba526a51d27ba279a Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Tue, 5 Jan 2021 19:20:59 -0700 Subject: [PATCH 38/51] Remove coveralls --- ci/requirements/environment-windows.yml | 1 - ci/requirements/environment.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml index 1a0787a9521..6de2bc8dc64 100644 --- a/ci/requirements/environment-windows.yml +++ b/ci/requirements/environment-windows.yml @@ -8,7 +8,6 @@ dependencies: # - cdms2 # Not available on Windows # - cfgrib # Causes Python interpreter crash on Windows: https://github.com/pydata/xarray/pull/3340 - cftime - - coveralls - dask - distributed - h5netcdf diff --git a/ci/requirements/environment.yml b/ci/requirements/environment.yml index 8c14e1310ec..f09d35e5ad3 100644 --- a/ci/requirements/environment.yml +++ b/ci/requirements/environment.yml @@ -9,7 +9,6 @@ dependencies: - cdms2 - cfgrib - cftime - - coveralls - dask - distributed - h5netcdf From fa5bb1f1343cd50c1842613d7529e010bbfefc4f Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 6 Jan 2021 16:06:50 -0700 Subject: [PATCH 39/51] Formatting only --- .github/workflows/upstream-dev-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 73c693c642d..bb325c1837e 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -23,7 +23,7 @@ jobs: id: detect-trigger with: keyword: "[test-upstream]" - + upstream-dev: name: upstream-dev runs-on: ubuntu-latest From 3df58b72432e824f7026eaad235f182fe5b781e5 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Wed, 6 Jan 2021 16:40:16 -0700 Subject: [PATCH 40/51] Remove remaining reference to azure pipelines --- doc/contributing.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index 8a9a1f486e3..9c4ce5a0af2 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -392,12 +392,8 @@ Testing With Continuous Integration ----------------------------------- The *xarray* test suite runs automatically the -`Azure Pipelines `__, -continuous integration service, once your pull request is submitted. However, -if you wish to run the test suite on a branch prior to submitting the pull -request, then Azure Pipelines -`needs to be configured `_ -for your GitHub repository. +`GitHub Actions `__, +continuous integration service, once your pull request is submitted. A pull-request will be considered for merging when you have an all 'green' build. If any tests are failing, then you will get a red 'X', where you can click through to see the From c7a91d74f895dac99fc9fcd098f413ed09161b73 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 10:00:47 -0700 Subject: [PATCH 41/51] Remove py 3.6 from CI matrix --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 374b7ac82ff..cbd87e7a1ec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.6", "3.7", "3.8"] + python-version: ["3.7", "3.8"] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.6.0 From 7c4de891308721e2f6610a2917bbebc3389f54c3 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:22:34 -0700 Subject: [PATCH 42/51] Use py37 --- .github/workflows/ci-additional.yaml | 6 ++-- ci/requirements/py37-windows.yml | 48 ---------------------------- 2 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 ci/requirements/py37-windows.yml diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 6dbe18e082c..1ca34d9d970 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -21,9 +21,9 @@ jobs: os: ["ubuntu-latest"] env: [ - "py36-bare-minimum", - "py36-min-all-deps", - "py36-min-nep18", + "py37-bare-minimum", + "py37-min-all-deps", + "py37-min-nep18", "py38-all-but-dask", "py38-backend-api-v2", "py38-flaky", diff --git a/ci/requirements/py37-windows.yml b/ci/requirements/py37-windows.yml deleted file mode 100644 index 6dd8be768b1..00000000000 --- a/ci/requirements/py37-windows.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: xarray-tests -channels: - - conda-forge -dependencies: - - python=3.7 - - black - - boto3 - - bottleneck - - cartopy - # - cdms2 # Not available on Windows - # - cfgrib # Causes Python interpreter crash on Windows - - cftime - - coveralls - - dask - - distributed - - flake8 - - h5netcdf - - h5py=2 - - hdf5 - - hypothesis - - iris - - isort - - lxml # Optional dep of pydap - - matplotlib-base - - mypy=0.790 # Must match .pre-commit-config.yaml - - nc-time-axis - - netcdf4 - - numba - - numpy - - pandas - - pint - - pip - - pseudonetcdf - - pydap - # - pynio # Not available on Windows - - pytest - - pytest-cov - - pytest-env - - pytest-xdist - - rasterio - - scipy - - seaborn - - setuptools - - sparse - - toolz - - zarr - - pip: - - numbagg From c60dcd925c7ac7c9aecf7dd9b8d4a483f2793ec1 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:29:10 -0700 Subject: [PATCH 43/51] Remove all references to py36 env file --- .github/workflows/ci-additional.yaml | 4 ++-- ci/min_deps_check.py | 4 ++-- ci/requirements/environment.yml | 2 +- ci/requirements/py38-all-but-dask.yml | 2 +- doc/installing.rst | 4 ++-- xarray/tests/test_plot.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 1ca34d9d970..2dc6a6aea48 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -165,5 +165,5 @@ jobs: - name: minimum versions policy run: | mamba install -y pyyaml - python ci/min_deps_check.py ci/requirements/py36-bare-minimum.yml - python ci/min_deps_check.py ci/requirements/py36-min-all-deps.yml + python ci/min_deps_check.py ci/requirements/py37-bare-minimum.yml + python ci/min_deps_check.py ci/requirements/py37-min-all-deps.yml diff --git a/ci/min_deps_check.py b/ci/min_deps_check.py index 5f94c81ef8a..3cb443d0711 100755 --- a/ci/min_deps_check.py +++ b/ci/min_deps_check.py @@ -1,5 +1,5 @@ """Fetch from conda database all available versions of the xarray dependencies and their -publication date. Compare it against requirements/py36-min-all-deps.yml to verify the +publication date. Compare it against requirements/py37-min-all-deps.yml to verify the policy on obsolete dependencies is being followed. Print a pretty report :) """ import subprocess @@ -55,7 +55,7 @@ def warning(msg: str) -> None: def parse_requirements(fname) -> Iterator[Tuple[str, int, int, Optional[int]]]: - """Load requirements/py36-min-all-deps.yml + """Load requirements/py37-min-all-deps.yml Yield (package name, major version, minor version, [patch version]) """ diff --git a/ci/requirements/environment.yml b/ci/requirements/environment.yml index f09d35e5ad3..0f59d9570c8 100644 --- a/ci/requirements/environment.yml +++ b/ci/requirements/environment.yml @@ -28,7 +28,7 @@ dependencies: - pre-commit - pseudonetcdf - pydap - # - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum + # - pynio: not compatible with netCDF4>1.5.3; only tested in py37-bare-minimum - pytest - pytest-cov - pytest-env diff --git a/ci/requirements/py38-all-but-dask.yml b/ci/requirements/py38-all-but-dask.yml index 5eb8fa39cef..14930f5272d 100644 --- a/ci/requirements/py38-all-but-dask.yml +++ b/ci/requirements/py38-all-but-dask.yml @@ -30,7 +30,7 @@ dependencies: - pip - pseudonetcdf - pydap - # - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum + # - pynio: not compatible with netCDF4>1.5.3; only tested in py37-bare-minimum - pytest - pytest-cov - pytest-env diff --git a/doc/installing.rst b/doc/installing.rst index d5783e557e1..99b8b621aed 100644 --- a/doc/installing.rst +++ b/doc/installing.rst @@ -118,9 +118,9 @@ at the moment of publishing the xarray release is guaranteed to work. You can see the actual minimum tested versions: - `For NEP-18 libraries - `_ + `_ - `For everything else - `_ + `_ .. _installation-instructions: diff --git a/xarray/tests/test_plot.py b/xarray/tests/test_plot.py index d730b6dc1c6..2f4a4edd436 100644 --- a/xarray/tests/test_plot.py +++ b/xarray/tests/test_plot.py @@ -2240,7 +2240,7 @@ def test_datetime_hue(self, hue_style): ds2.plot.scatter(x="A", y="B", hue="hue", hue_style=hue_style) def test_facetgrid_hue_style(self): - # Can't move this to pytest.mark.parametrize because py36-bare-minimum + # Can't move this to pytest.mark.parametrize because py37-bare-minimum # doesn't have matplotlib. for hue_style, map_type in ( ("discrete", list), From 5e6ddf297bc2220603ab6d6f045c5dc4fa248510 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:40:24 -0700 Subject: [PATCH 44/51] Add check for skip ci --- .github/workflows/ci-additional.yaml | 19 +++++++++++++++++++ .github/workflows/ci.yaml | 14 ++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 2dc6a6aea48..8fae67cfac7 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -9,9 +9,24 @@ on: workflow_dispatch: # allows you to trigger manually jobs: + detect-ci-trigger: + name: detect upstream-dev ci trigger + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event_name == 'pull_request' + outputs: + triggered: ${{ steps.detect-trigger.outputs.trigger-found }} + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/detect-ci-trigger + id: detect-trigger + with: + keyword: "[skip-ci]" + test: name: ${{ matrix.os }} ${{ matrix.env }} runs-on: ${{ matrix.os }} + needs: detect-ci-trigger + if: needs.detect-ci-trigger.outputs.triggered == 'false' defaults: run: shell: bash -l {0} @@ -104,6 +119,8 @@ jobs: doctest: name: Doctests runs-on: "ubuntu-latest" + needs: detect-ci-trigger + if: needs.detect-ci-trigger.outputs.triggered == 'false' defaults: run: shell: bash -l {0} @@ -143,6 +160,8 @@ jobs: min-version-policy: name: Minimum Version Policy runs-on: "ubuntu-latest" + needs: detect-ci-trigger + if: needs.detect-ci-trigger.outputs.triggered == 'false' defaults: run: shell: bash -l {0} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cbd87e7a1ec..ed33e199831 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,9 +9,23 @@ on: workflow_dispatch: # allows you to trigger manually jobs: + detect-ci-trigger: + name: detect upstream-dev ci trigger + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event_name == 'pull_request' + outputs: + triggered: ${{ steps.detect-trigger.outputs.trigger-found }} + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/detect-ci-trigger + id: detect-trigger + with: + keyword: "[skip-ci]" test: name: ${{ matrix.os }} py${{ matrix.python-version }} runs-on: ${{ matrix.os }} + needs: detect-ci-trigger + if: needs.detect-ci-trigger.outputs.triggered == 'false' defaults: run: shell: bash -l {0} From 93ff1ce63d2232967f1930cab2d915c0acfa101a Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:41:49 -0700 Subject: [PATCH 45/51] rename job to `detect ci trigger` --- .github/workflows/ci-additional.yaml | 2 +- .github/workflows/ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 8fae67cfac7..752848ccbd1 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -10,7 +10,7 @@ on: jobs: detect-ci-trigger: - name: detect upstream-dev ci trigger + name: detect ci trigger runs-on: ubuntu-latest if: github.event_name == 'push' || github.event_name == 'pull_request' outputs: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed33e199831..730ec6a7075 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ on: jobs: detect-ci-trigger: - name: detect upstream-dev ci trigger + name: detect ci trigger runs-on: ubuntu-latest if: github.event_name == 'push' || github.event_name == 'pull_request' outputs: From 3cf7d3efb71bc0c2350a0419c899f5c3dca018ce Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:43:13 -0700 Subject: [PATCH 46/51] [skip ci] Empty commit From a6f4d60214d7fec6b3345c381f4cf5cbb3f70ad5 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:44:18 -0700 Subject: [PATCH 47/51] [skip-ci] Test skip CI trigger From fe18db1cb6aa374b27181a988fc684a69543d94a Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:52:22 -0700 Subject: [PATCH 48/51] Update PR template --- .github/PULL_REQUEST_TEMPLATE.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 666af8f95ce..a63a7214e38 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,4 +7,15 @@ - [ ] New functions/methods are listed in `api.rst` -By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a `[test-upstream]` tag to the first line of the commit message. + +

+ Overriding CI behaviors +

+
    +
  • By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a `[test-upstream]` tag to the first line of the commit message. +
  • +
  • + For documentation-only commits, you can skip the CI per commit by adding a `[skip-ci]` tag to the first line of the commit message +
  • + + From f4088f6503b695cb062bf804c5fe283a3c13a47b Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 11:59:33 -0700 Subject: [PATCH 49/51] Fix typ --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a63a7214e38..95620519260 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -17,5 +17,5 @@
  • For documentation-only commits, you can skip the CI per commit by adding a `[skip-ci]` tag to the first line of the commit message
  • - +
From c869ee243aed5a8e8193a41e32fec6d8af288127 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 7 Jan 2021 12:06:20 -0700 Subject: [PATCH 50/51] GH markdown doesn't like lists in --- .github/PULL_REQUEST_TEMPLATE.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 95620519260..74f3fe2430f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,14 +8,8 @@ -

+

Overriding CI behaviors -

-
    -
  • By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a `[test-upstream]` tag to the first line of the commit message. -
  • -
  • - For documentation-only commits, you can skip the CI per commit by adding a `[skip-ci]` tag to the first line of the commit message -
  • -
+ + By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a `[test-upstream]` tag to the first line of the commit message. For documentation-only commits, you can skip the CI per commit by adding a `[skip-ci]` tag to the first line of the commit message
From 5c6c49b706dc2278550d99588d9b7385419b080c Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Sun, 10 Jan 2021 09:03:04 -0700 Subject: [PATCH 51/51] Remove the `-OO` flag for consistency --- .github/workflows/ci-additional.yaml | 2 +- .github/workflows/ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 752848ccbd1..1e19f594853 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -100,7 +100,7 @@ jobs: python xarray/util/print_versions.py - name: Import xarray run: | - python -OO -c "import xarray" + python -c "import xarray" - name: Run tests run: | python -m pytest -n 4 \ diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 730ec6a7075..849d8a445a5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -85,7 +85,7 @@ jobs: python xarray/util/print_versions.py - name: Import xarray run: | - python -OO -c "import xarray" + python -c "import xarray" - name: Run tests run: | python -m pytest -n 4 \