Skip to content

Commit fea47a5

Browse files
committed
Merge branch 'main' into numbagg
* main: (29 commits) Major fix to subset_to_blocks (#173) Performance improvements for cohorts detection (#172) Remove split_out (#170) Deprecate resample_reduce (#169) More efficient cohorts. (#165) Allow specifying output dtype (#131) Add a dtype check for numpy arrays in assert_equal (#158) Update ci-additional.yaml (#167) Refactor before redoing cohorts (#164) Fix mypy errors in core.py (#150) Add link to numpy_groupies (#160) Bump codecov/codecov-action from 3.1.0 to 3.1.1 (#159) Use math.prod instead of np.prod (#157) Remove None output from _get_expected_groups (#152) Fix mypy errors in xarray.py, xrutils.py, cache.py (#144) Raise error if multiple by's are used with Ellipsis (#149) pre-commit autoupdate (#148) Add mypy ignores (#146) Get pre commit bot to update (#145) Remove duplicate examples headers (#147) ...
2 parents 5bc6939 + 6897240 commit fea47a5

33 files changed

+1465
-508
lines changed

.github/workflows/benchmarks.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Benchmark
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, labeled]
6+
workflow_dispatch:
7+
8+
jobs:
9+
benchmark:
10+
# if: ${{ contains( github.event.pull_request.labels.*.name, 'run-benchmark') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} # Run if the PR has been labelled correctly.
11+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} # Always run.
12+
name: Linux
13+
runs-on: ubuntu-20.04
14+
env:
15+
ASV_DIR: "./asv_bench"
16+
17+
steps:
18+
# We need the full repo to avoid this issue
19+
# https://github.com/actions/checkout/issues/23
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up conda environment
25+
uses: mamba-org/provision-with-micromamba@v13
26+
with:
27+
environment-file: ci/environment.yml
28+
environment-name: flox-tests
29+
cache-env: true
30+
# extra-specs: |
31+
# python="${{ matrix.python-version }}"
32+
33+
# - name: Setup some dependencies
34+
# shell: bash -l {0}
35+
# run: |
36+
# pip install asv
37+
# sudo apt-get update -y
38+
39+
- name: Run benchmarks
40+
shell: bash -l {0}
41+
id: benchmark
42+
env:
43+
OPENBLAS_NUM_THREADS: 1
44+
MKL_NUM_THREADS: 1
45+
OMP_NUM_THREADS: 1
46+
ASV_FACTOR: 1.5
47+
ASV_SKIP_SLOW: 1
48+
run: |
49+
set -x
50+
# ID this runner
51+
asv machine --yes
52+
echo "Baseline: ${{ github.event.pull_request.base.sha }} (${{ github.event.pull_request.base.label }})"
53+
echo "Contender: ${GITHUB_SHA} (${{ github.event.pull_request.head.label }})"
54+
# Use mamba for env creation
55+
# export CONDA_EXE=$(which mamba)
56+
export CONDA_EXE=$(which conda)
57+
# Run benchmarks for current commit against base
58+
ASV_OPTIONS="--split --show-stderr --factor $ASV_FACTOR"
59+
asv continuous $ASV_OPTIONS ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} \
60+
| sed "/Traceback \|failed$\|PERFORMANCE DECREASED/ s/^/::error::/" \
61+
| tee benchmarks.log
62+
# Report and export results for subsequent steps
63+
if grep "Traceback \|failed\|PERFORMANCE DECREASED" benchmarks.log > /dev/null ; then
64+
exit 1
65+
fi
66+
working-directory: ${{ env.ASV_DIR }}
67+
68+
- name: Add instructions to artifact
69+
if: always()
70+
run: |
71+
cp benchmarks/README_CI.md benchmarks.log .asv/results/
72+
working-directory: ${{ env.ASV_DIR }}
73+
74+
- uses: actions/upload-artifact@v3
75+
if: always()
76+
with:
77+
name: asv-benchmark-results-${{ runner.os }}
78+
path: ${{ env.ASV_DIR }}/.asv/results

.github/workflows/ci-additional.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: CI Additional
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
branches:
8+
- "*"
9+
workflow_dispatch: # allows you to trigger manually
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
detect-ci-trigger:
17+
name: detect ci trigger
18+
runs-on: ubuntu-latest
19+
if: |
20+
github.repository == 'xarray-contrib/flox'
21+
&& (github.event_name == 'push' || github.event_name == 'pull_request')
22+
outputs:
23+
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 2
28+
- uses: xarray-contrib/[email protected]
29+
id: detect-trigger
30+
with:
31+
keyword: "[skip-ci]"
32+
33+
doctest:
34+
name: Doctests
35+
runs-on: "ubuntu-latest"
36+
needs: detect-ci-trigger
37+
if: needs.detect-ci-trigger.outputs.triggered == 'false'
38+
defaults:
39+
run:
40+
shell: bash -l {0}
41+
42+
env:
43+
CONDA_ENV_FILE: ci/environment.yml
44+
PYTHON_VERSION: "3.10"
45+
46+
steps:
47+
- uses: actions/checkout@v3
48+
with:
49+
fetch-depth: 0 # Fetch all history for all branches and tags.
50+
51+
- name: set environment variables
52+
run: |
53+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
54+
55+
- name: Setup micromamba
56+
uses: mamba-org/provision-with-micromamba@34071ca7df4983ccd272ed0d3625818b27b70dcc
57+
with:
58+
environment-file: ${{env.CONDA_ENV_FILE}}
59+
environment-name: flox-tests
60+
extra-specs: |
61+
python=${{env.PYTHON_VERSION}}
62+
cache-env: true
63+
cache-env-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
64+
65+
- name: Install flox
66+
run: |
67+
python -m pip install --no-deps -e .
68+
- name: Version info
69+
run: |
70+
conda info -a
71+
conda list
72+
- name: Run doctests
73+
run: |
74+
python -m pytest --doctest-modules flox --ignore flox/tests
75+
76+
mypy:
77+
name: Mypy
78+
runs-on: "ubuntu-latest"
79+
needs: detect-ci-trigger
80+
if: needs.detect-ci-trigger.outputs.triggered == 'false'
81+
defaults:
82+
run:
83+
shell: bash -l {0}
84+
env:
85+
CONDA_ENV_FILE: ci/environment.yml
86+
PYTHON_VERSION: "3.10"
87+
88+
steps:
89+
- uses: actions/checkout@v3
90+
with:
91+
fetch-depth: 0 # Fetch all history for all branches and tags.
92+
93+
- name: set environment variables
94+
run: |
95+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
96+
- name: Setup micromamba
97+
uses: mamba-org/provision-with-micromamba@34071ca7df4983ccd272ed0d3625818b27b70dcc
98+
with:
99+
environment-file: ${{env.CONDA_ENV_FILE}}
100+
environment-name: xarray-tests
101+
extra-specs: |
102+
python=${{env.PYTHON_VERSION}}
103+
cache-env: true
104+
cache-env-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
105+
- name: Install xarray
106+
run: |
107+
python -m pip install --no-deps -e .
108+
- name: Version info
109+
run: |
110+
conda info -a
111+
conda list
112+
- name: Install mypy
113+
run: |
114+
python -m pip install mypy
115+
116+
- name: Run mypy
117+
run: |
118+
python -m mypy --install-types --non-interactive

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
3636
- name: Set up conda environment
37-
uses: mamba-org/provision-with-micromamba@v12
37+
uses: mamba-org/provision-with-micromamba@v13
3838
with:
3939
environment-file: ci/environment.yml
4040
environment-name: flox-tests
@@ -49,7 +49,7 @@ jobs:
4949
run: |
5050
pytest -n auto --cov=./ --cov-report=xml
5151
- name: Upload code coverage to Codecov
52-
uses: codecov/[email protected].0
52+
uses: codecov/[email protected].1
5353
with:
5454
file: ./coverage.xml
5555
flags: unittests
@@ -78,7 +78,7 @@ jobs:
7878
with:
7979
fetch-depth: 0 # Fetch all history for all branches and tags.
8080
- name: Set up conda environment
81-
uses: mamba-org/provision-with-micromamba@v12
81+
uses: mamba-org/provision-with-micromamba@v13
8282
with:
8383
environment-file: ci/${{ matrix.env }}.yml
8484
environment-name: flox-tests
@@ -101,7 +101,7 @@ jobs:
101101
steps:
102102
- uses: actions/checkout@v3
103103
- name: Set up conda environment
104-
uses: mamba-org/provision-with-micromamba@v12
104+
uses: mamba-org/provision-with-micromamba@v13
105105
with:
106106
environment-file: ci/upstream-dev-env.yml
107107
environment-name: flox-tests
@@ -123,7 +123,7 @@ jobs:
123123
repository: 'pydata/xarray'
124124
fetch-depth: 0 # Fetch all history for all branches and tags.
125125
- name: Set up conda environment
126-
uses: mamba-org/provision-with-micromamba@v12
126+
uses: mamba-org/provision-with-micromamba@v13
127127
with:
128128
environment-file: ci/requirements/environment.yml
129129
environment-name: xarray-tests

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ repos:
1010
- id: check-docstring-first
1111

1212
- repo: https://github.com/psf/black
13-
rev: 22.6.0
13+
rev: 22.8.0
1414
hooks:
1515
- id: black
1616

1717
- repo: https://github.com/PyCQA/flake8
18-
rev: 4.0.1
18+
rev: 5.0.4
1919
hooks:
2020
- id: flake8
2121

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It was motivated by
1616

1717
1. Dask Dataframe GroupBy
1818
[blogpost](https://blog.dask.org/2019/10/08/df-groupby)
19-
2. numpy_groupies in Xarray
19+
2. [numpy_groupies](https://github.com/ml31415/numpy-groupies) in Xarray
2020
[issue](https://github.com/pydata/xarray/issues/4473)
2121

2222
(See a

asv.conf.json renamed to asv_bench/asv.conf.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// The URL or local path of the source code repository for the
1313
// project being benchmarked
14-
"repo": ".",
14+
"repo": "..",
1515

1616
// The Python project's subdirectory in your repo. If missing or
1717
// the empty string, the project is assumed to be located at the root
@@ -37,7 +37,7 @@
3737
// determined from "repo" by looking at the protocol in the URL
3838
// (if remote), or by looking for special directories, such as
3939
// ".git" (if local).
40-
// "dvcs": "git",
40+
"dvcs": "git",
4141

4242
// The tool to use to create environments. May be "conda",
4343
// "virtualenv" or other value depending on the plugins in use.
@@ -48,10 +48,10 @@
4848

4949
// timeout in seconds for installing any dependencies in environment
5050
// defaults to 10 min
51-
//"install_timeout": 600,
51+
"install_timeout": 600,
5252

5353
// the base URL to show a commit for the project.
54-
"show_commit_url": "http://github.com/dcherian/flox/commit/",
54+
"show_commit_url": "http://github.com/xarray-contrib/flox/commit/",
5555

5656
// The Pythons you'd like to test against. If not provided, defaults
5757
// to the current version of Python used to run `asv`.
@@ -115,7 +115,7 @@
115115

116116
// The directory (relative to the current directory) that benchmarks are
117117
// stored in. If not provided, defaults to "benchmarks"
118-
// "benchmark_dir": "benchmarks",
118+
"benchmark_dir": "benchmarks",
119119

120120
// The directory (relative to the current directory) to cache the Python
121121
// environments in. If not provided, defaults to "env"

0 commit comments

Comments
 (0)