Skip to content

Commit accf87e

Browse files
Allow to use latest dask without dask-expr (#299)
1 parent f8da2f6 commit accf87e

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

.github/workflows/tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- ci/envs/39-minimal.yaml
3434
- ci/envs/311-no-expr.yaml
3535
- ci/envs/311-latest.yaml
36+
- ci/envs/311-latest-no-expr.yaml
3637
- ci/envs/312-latest.yaml
3738

3839
include:

ci/envs/311-latest-no-expr.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: test
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
# required dependencies
6+
- python=3.11
7+
- dask-core
8+
- geopandas
9+
- pyproj=3.4
10+
- packaging
11+
# test dependencies
12+
- pytest
13+
- pytest-cov
14+
- hilbertcurve
15+
- s3fs
16+
- moto<5 # <5 pin because of https://github.com/dask/dask/issues/10869
17+
- flask # needed for moto server
18+
# optional dependencies
19+
- pyarrow
20+
- pyogrio>=0.4
21+
- pygeohash
22+
- pip
23+
- pip:
24+
- pymorton

dask_geopandas/backends.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
import uuid
22
from packaging.version import Version
33

4+
import pandas as pd
5+
46
import dask
57
from dask import config
68

7-
# Check if dask-dataframe is using dask-expr (default of None means True as well)
9+
# Check if dask-dataframe is using dask-expr (mimix the logic of dask.dataframe
10+
# _dask_expr_enabled() - default of None means True as well if dask-expr is available)
811
QUERY_PLANNING_ON = config.get("dataframe.query-planning", False)
912
if QUERY_PLANNING_ON is None:
10-
import pandas as pd
11-
1213
if Version(pd.__version__).major < 2:
1314
QUERY_PLANNING_ON = False
1415
else:
15-
QUERY_PLANNING_ON = True
16+
try:
17+
import dask_expr # noqa: F401
18+
except ImportError:
19+
# dask will raise error or warning depending on the config
20+
QUERY_PLANNING_ON = False
21+
else:
22+
QUERY_PLANNING_ON = True
1623

1724

1825
from dask.base import normalize_token

0 commit comments

Comments
 (0)