Skip to content

Commit 7056d18

Browse files
committed
Merge branch 'main' into topk
* main: Fix first, last again (#381) Fix docs build (#382) Optimize for-loop merging of cohorts. (#378) Add cohorts snapshot tests with syrupy (#379) Stricter tolerance in property tests (#377) Better gridlines Update containment image with gridlines, higher dpi
2 parents 80c67f4 + f0ce343 commit 7056d18

21 files changed

+14588
-86
lines changed

.github/workflows/ci-additional.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ jobs:
128128
129129
- name: Run mypy
130130
run: |
131-
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
131+
mkdir .mypy_cache
132+
python -m mypy --install-types --non-interactive --cache-dir=.mypy_cache/ --cobertura-xml-report mypy_report
132133
133134
- name: Upload mypy coverage to Codecov
134135
uses: codecov/[email protected]

.github/workflows/ci.yaml

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
test:
19-
name: Test (${{ matrix.python-version }}, ${{ matrix.os }})
19+
name: Test (${{matrix.env}}, ${{ matrix.python-version }}, ${{ matrix.os }})
2020
runs-on: ${{ matrix.os }}
2121
defaults:
2222
run:
@@ -25,10 +25,18 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
os: ["ubuntu-latest"]
28+
env: ["environment"]
2829
python-version: ["3.9", "3.12"]
2930
include:
3031
- os: "windows-latest"
32+
env: "environment"
3133
python-version: "3.12"
34+
- os: "ubuntu-latest"
35+
env: "no-dask" # "no-xarray", "no-numba"
36+
python-version: "3.12"
37+
- os: "ubuntu-latest"
38+
env: "minimal-requirements"
39+
python-version: "3.9"
3240
steps:
3341
- uses: actions/checkout@v4
3442
with:
@@ -39,7 +47,7 @@ jobs:
3947
- name: Set up conda environment
4048
uses: mamba-org/setup-micromamba@v1
4149
with:
42-
environment-file: ci/environment.yml
50+
environment-file: ci/${{ matrix.env }}.yml
4351
environment-name: flox-tests
4452
init-shell: bash
4553
cache-environment: true
@@ -81,48 +89,6 @@ jobs:
8189
path: .hypothesis/
8290
key: cache-hypothesis-${{ runner.os }}-${{ matrix.python-version }}-${{ github.run_id }}
8391

84-
optional-deps:
85-
name: ${{ matrix.env }}
86-
runs-on: "ubuntu-latest"
87-
defaults:
88-
run:
89-
shell: bash -l {0}
90-
strategy:
91-
fail-fast: false
92-
matrix:
93-
python-version: ["3.12"]
94-
env: ["no-dask"] # "no-xarray", "no-numba"
95-
include:
96-
- env: "minimal-requirements"
97-
python-version: "3.9"
98-
steps:
99-
- uses: actions/checkout@v4
100-
with:
101-
fetch-depth: 0 # Fetch all history for all branches and tags.
102-
- name: Set up conda environment
103-
uses: mamba-org/setup-micromamba@v1
104-
with:
105-
environment-file: ci/${{ matrix.env }}.yml
106-
environment-name: flox-tests
107-
init-shell: bash
108-
cache-environment: true
109-
create-args: |
110-
python=${{ matrix.python-version }}
111-
- name: Install flox
112-
run: |
113-
python -m pip install --no-deps -e .
114-
- name: Run tests
115-
run: |
116-
python -m pytest -n auto --cov=./ --cov-report=xml
117-
- name: Upload code coverage to Codecov
118-
uses: codecov/[email protected]
119-
with:
120-
file: ./coverage.xml
121-
flags: unittests
122-
env_vars: RUNNER_OS
123-
name: codecov-umbrella
124-
fail_ci_if_error: false
125-
12692
xarray-groupby:
12793
name: xarray-groupby
12894
runs-on: ubuntu-latest

asv_bench/__init__.py

Whitespace-only changes.

asv_bench/benchmarks/cohorts.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def time_find_group_cohorts(self):
4747
except AttributeError:
4848
pass
4949

50+
def track_num_cohorts(self):
51+
return len(self.chunks_cohorts())
52+
5053
def time_graph_construct(self):
5154
flox.groupby_reduce(self.array, self.by, func="sum", axis=self.axis)
5255

@@ -60,10 +63,11 @@ def track_num_tasks_optimized(self):
6063
def track_num_layers(self):
6164
return len(self.result.dask.layers)
6265

66+
track_num_cohorts.unit = "cohorts" # type: ignore[attr-defined] # Lazy
6367
track_num_tasks.unit = "tasks" # type: ignore[attr-defined] # Lazy
6468
track_num_tasks_optimized.unit = "tasks" # type: ignore[attr-defined] # Lazy
6569
track_num_layers.unit = "layers" # type: ignore[attr-defined] # Lazy
66-
for f in [track_num_tasks, track_num_tasks_optimized, track_num_layers]:
70+
for f in [track_num_tasks, track_num_tasks_optimized, track_num_layers, track_num_cohorts]:
6771
f.repeat = 1 # type: ignore[attr-defined] # Lazy
6872
f.rounds = 1 # type: ignore[attr-defined] # Lazy
6973
f.number = 1 # type: ignore[attr-defined] # Lazy

ci/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
- myst-parser
1717
- myst-nb
1818
- sphinx
19-
- furo
19+
- furo>=2024.08
2020
- ipykernel
2121
- jupyter
2222
- sphinx-codeautolink

ci/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- pytest-cov
1919
- pytest-pretty
2020
- pytest-xdist
21+
- syrupy
2122
- xarray
2223
- pre-commit
2324
- numpy_groupies>=0.9.19

ci/minimal-requirements.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- pytest-cov
1010
- pytest-pretty
1111
- pytest-xdist
12+
- syrupy
1213
- numpy==1.22
1314
- scipy==1.9.0
1415
- numpy_groupies==0.9.19

ci/no-dask.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies:
1313
- pytest-cov
1414
- pytest-pretty
1515
- pytest-xdist
16+
- syrupy
1617
- xarray
1718
- numpydoc
1819
- pre-commit

ci/no-numba.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- pytest-cov
1919
- pytest-pretty
2020
- pytest-xdist
21+
- syrupy
2122
- xarray
2223
- pre-commit
2324
- numpy_groupies>=0.9.19

ci/no-xarray.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- conda-forge
44
dependencies:
55
- codecov
6+
- syrupy
67
- pandas
78
- numpy>=1.22
89
- scipy
@@ -11,6 +12,7 @@ dependencies:
1112
- pytest-cov
1213
- pytest-pretty
1314
- pytest-xdist
15+
- syrupy
1416
- dask-core
1517
- numpydoc
1618
- pre-commit

0 commit comments

Comments
 (0)