Skip to content

Commit 5b84457

Browse files
sebergnvliyuan
authored andcommitted
CI: Test against old versions of key dependencies (rapidsai#16570)
This adds explicit tests with old versions of key dependencies. Specifically: - `numba==0.57` - `numpy==1.23` - `pandas==2.0` - ~`fsspec==0.6.0`~ excluded it. `transformers==4.39.3` requires `huggingface_hub` which requires `fsspec>=2023.5.0`. In principle one could include it e.g. only for conda which doesn't pull in `transformers`, but that seemed not worth the trouble? - `cupy==12.0.0` - `pyarrow==16.1.0` See also rapidsai/build-planning#81 (Marking as draft until I see that things work.) Authors: - Sebastian Berg (https://github.com/seberg) - Matthew Roeschke (https://github.com/mroeschke) - GALI PREM SAGAR (https://github.com/galipremsagar) Approvers: - Matthew Roeschke (https://github.com/mroeschke) - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) - Charles Blackmon-Luca (https://github.com/charlesbluca) URL: rapidsai#16570
1 parent 5f29c23 commit 5b84457

34 files changed

Lines changed: 638 additions & 70 deletions

ci/cudf_pandas_scripts/run_tests.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,19 @@ else
5454
RAPIDS_PY_WHEEL_NAME="libcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp ./dist
5555
RAPIDS_PY_WHEEL_NAME="pylibcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist
5656

57-
# echo to expand wildcard before adding `[extra]` requires for pip
57+
echo "" > ./constraints.txt
58+
if [[ $RAPIDS_DEPENDENCIES == "oldest" ]]; then
59+
# `test_python` constraints are for `[test]` not `[cudf-pandas-tests]`
60+
rapids-dependency-file-generator \
61+
--output requirements \
62+
--file-key test_python \
63+
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \
64+
| tee ./constraints.txt
65+
fi
66+
5867
python -m pip install \
68+
-v \
69+
--constraint ./constraints.txt \
5970
"$(echo ./dist/cudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)[test,cudf-pandas-tests]" \
6071
"$(echo ./dist/libcudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)" \
6172
"$(echo ./dist/pylibcudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)"

ci/test_python_common.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ ENV_YAML_DIR="$(mktemp -d)"
1414
rapids-dependency-file-generator \
1515
--output conda \
1616
--file-key test_python \
17-
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee "${ENV_YAML_DIR}/env.yaml"
17+
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \
18+
| tee "${ENV_YAML_DIR}/env.yaml"
1819

1920
rapids-mamba-retry env create --yes -f "${ENV_YAML_DIR}/env.yaml" -n test
2021

ci/test_wheel_cudf.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,22 @@ RAPIDS_PY_WHEEL_NAME="cudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from
1010
RAPIDS_PY_WHEEL_NAME="libcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp ./dist
1111
RAPIDS_PY_WHEEL_NAME="pylibcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist
1212

13+
rapids-logger "Install cudf, pylibcudf, and test requirements"
14+
15+
# Constrain to minimum dependency versions if job is set up as "oldest"
16+
echo "" > ./constraints.txt
17+
if [[ $RAPIDS_DEPENDENCIES == "oldest" ]]; then
18+
rapids-dependency-file-generator \
19+
--output requirements \
20+
--file-key py_test_cudf \
21+
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \
22+
| tee ./constraints.txt
23+
fi
24+
1325
# echo to expand wildcard before adding `[extra]` requires for pip
1426
python -m pip install \
27+
-v \
28+
--constraint ./constraints.txt \
1529
"$(echo ./dist/cudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)[test]" \
1630
"$(echo ./dist/libcudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)" \
1731
"$(echo ./dist/pylibcudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)[test]"

ci/test_wheel_cudf_polars.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,20 @@ RAPIDS_PY_WHEEL_NAME="libcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-f
2525
RAPIDS_PY_WHEEL_NAME="pylibcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist
2626

2727
rapids-logger "Installing cudf_polars and its dependencies"
28+
# Constraint to minimum dependency versions if job is set up as "oldest"
29+
echo "" > ./constraints.txt
30+
if [[ $RAPIDS_DEPENDENCIES == "oldest" ]]; then
31+
rapids-dependency-file-generator \
32+
--output requirements \
33+
--file-key py_test_cudf_polars \
34+
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \
35+
| tee ./constraints.txt
36+
fi
2837

2938
# echo to expand wildcard before adding `[extra]` requires for pip
3039
python -m pip install \
40+
-v \
41+
--constraint ./constraints.txt \
3142
"$(echo ./dist/cudf_polars_${RAPIDS_PY_CUDA_SUFFIX}*.whl)[test]" \
3243
"$(echo ./dist/libcudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)" \
3344
"$(echo ./dist/pylibcudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)"

ci/test_wheel_dask_cudf.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ RAPIDS_PY_WHEEL_NAME="cudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from
1111
RAPIDS_PY_WHEEL_NAME="libcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp ./dist
1212
RAPIDS_PY_WHEEL_NAME="pylibcudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist
1313

14+
rapids-logger "Install dask_cudf, cudf, pylibcudf, and test requirements"
15+
# Constraint to minimum dependency versions if job is set up as "oldest"
16+
echo "" > ./constraints.txt
17+
if [[ $RAPIDS_DEPENDENCIES == "oldest" ]]; then
18+
rapids-dependency-file-generator \
19+
--output requirements \
20+
--file-key py_test_dask_cudf \
21+
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \
22+
| tee ./constraints.txt
23+
fi
24+
1425
# echo to expand wildcard before adding `[extra]` requires for pip
1526
python -m pip install \
27+
-v \
28+
--constraint ./constraints.txt \
1629
"$(echo ./dist/cudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)" \
1730
"$(echo ./dist/dask_cudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)[test]" \
1831
"$(echo ./dist/libcudf_${RAPIDS_PY_CUDA_SUFFIX}*.whl)" \

dependencies.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,28 @@ dependencies:
696696
- pytest<8
697697
- pytest-cov
698698
- pytest-xdist
699+
specific:
700+
# Define additional constraints for testing with oldest dependencies.
701+
- output_types: [conda, requirements]
702+
matrices:
703+
- matrix: {dependencies: "oldest"}
704+
packages:
705+
- numba==0.57.*
706+
- numpy==1.23.*
707+
- pandas==2.0.*
708+
- pyarrow==14.0.0
709+
- cupy==12.0.0 # ignored as pip constraint
710+
- matrix:
711+
packages:
712+
- output_types: requirements
713+
# Using --constraints for pip install, so we list cupy multiple times
714+
matrices:
715+
- matrix: {dependencies: "oldest"}
716+
packages:
717+
- cupy-cuda11x==12.0.0
718+
- cupy-cuda12x==12.0.0
719+
- matrix:
720+
packages:
699721
test_python_pylibcudf:
700722
common:
701723
- output_types: [conda, requirements, pyproject]

python/cudf/cudf/tests/indexes/test_interval.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ def test_interval_range_periods_basic_dtype(start_t, end_t, periods_t):
149149
assert_eq(pindex, gindex)
150150

151151

152+
@pytest.mark.skipif(
153+
PANDAS_VERSION < PANDAS_CURRENT_SUPPORTED_VERSION,
154+
reason="Does not warn on older versions of pandas",
155+
)
152156
def test_interval_range_periods_warnings():
153157
start_val, end_val, periods_val = 0, 4, 1.0
154158

python/cudf/cudf/tests/test_avro_reader_fastavro_integration.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import pytest
2424

2525
import cudf
26+
from cudf.core._compat import PANDAS_CURRENT_SUPPORTED_VERSION, PANDAS_VERSION
2627
from cudf.testing import assert_eq
2728
from cudf.testing.dataset_generator import rand_dataframe
2829

@@ -302,6 +303,10 @@ def get_days_from_epoch(date: datetime.date | None) -> int | None:
302303
@pytest.mark.parametrize("namespace", [None, "root_ns"])
303304
@pytest.mark.parametrize("nullable", [True, False])
304305
@pytest.mark.parametrize("prepend_null", [True, False])
306+
@pytest.mark.skipif(
307+
PANDAS_VERSION < PANDAS_CURRENT_SUPPORTED_VERSION,
308+
reason="Fails in older versions of pandas (datetime(9999, ...) too large)",
309+
)
305310
def test_can_parse_avro_date_logical_type(namespace, nullable, prepend_null):
306311
avro_type = {"logicalType": "date", "type": "int"}
307312
if nullable:

python/cudf/cudf/tests/test_binops.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
import cudf
1515
from cudf import Index, Series
16-
from cudf.core._compat import PANDAS_CURRENT_SUPPORTED_VERSION, PANDAS_VERSION
16+
from cudf.core._compat import (
17+
PANDAS_CURRENT_SUPPORTED_VERSION,
18+
PANDAS_GE_220,
19+
PANDAS_VERSION,
20+
)
1721
from cudf.core.buffer.spill_manager import get_global_manager
1822
from cudf.testing import _utils as utils, assert_eq
1923
from cudf.utils.dtypes import (
@@ -1781,6 +1785,20 @@ def test_datetime_dateoffset_binaryop(
17811785
reason="https://github.com/pandas-dev/pandas/issues/57448",
17821786
)
17831787
)
1788+
if (
1789+
not PANDAS_GE_220
1790+
and dtype in {"datetime64[ms]", "datetime64[s]"}
1791+
and frequency in ("microseconds", "nanoseconds")
1792+
and n_periods != 0
1793+
):
1794+
pytest.skip(reason="https://github.com/pandas-dev/pandas/pull/55595")
1795+
if (
1796+
not PANDAS_GE_220
1797+
and dtype == "datetime64[us]"
1798+
and frequency == "nanoseconds"
1799+
and n_periods != 0
1800+
):
1801+
pytest.skip(reason="https://github.com/pandas-dev/pandas/pull/55595")
17841802

17851803
date_col = [
17861804
f"2000-01-01 00:00:{components}",
@@ -1834,7 +1852,11 @@ def test_datetime_dateoffset_binaryop(
18341852
"ignore:Discarding nonzero nanoseconds:UserWarning"
18351853
)
18361854
@pytest.mark.parametrize("op", [operator.add, operator.sub])
1837-
def test_datetime_dateoffset_binaryop_multiple(date_col, kwargs, op):
1855+
@pytest.mark.skipif(
1856+
PANDAS_VERSION < PANDAS_CURRENT_SUPPORTED_VERSION,
1857+
reason="Fails in older versions of pandas",
1858+
)
1859+
def test_datetime_dateoffset_binaryop_multiple(request, date_col, kwargs, op):
18381860
gsr = cudf.Series(date_col, dtype="datetime64[ns]")
18391861
psr = gsr.to_pandas()
18401862

@@ -1873,6 +1895,21 @@ def test_datetime_dateoffset_binaryop_multiple(date_col, kwargs, op):
18731895
def test_datetime_dateoffset_binaryop_reflected(
18741896
n_periods, frequency, dtype, components
18751897
):
1898+
if (
1899+
not PANDAS_GE_220
1900+
and dtype in {"datetime64[ms]", "datetime64[s]"}
1901+
and frequency in ("microseconds", "nanoseconds")
1902+
and n_periods != 0
1903+
):
1904+
pytest.skip(reason="https://github.com/pandas-dev/pandas/pull/55595")
1905+
if (
1906+
not PANDAS_GE_220
1907+
and dtype == "datetime64[us]"
1908+
and frequency == "nanoseconds"
1909+
and n_periods != 0
1910+
):
1911+
pytest.skip(reason="https://github.com/pandas-dev/pandas/pull/55595")
1912+
18761913
date_col = [
18771914
f"2000-01-01 00:00:{components}",
18781915
f"2000-01-31 00:00:{components}",

python/cudf/cudf/tests/test_categorical.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pytest
1212

1313
import cudf
14+
from cudf.core._compat import PANDAS_CURRENT_SUPPORTED_VERSION, PANDAS_VERSION
1415
from cudf.testing import assert_eq
1516
from cudf.testing._utils import NUMERIC_TYPES, assert_exceptions_equal
1617

@@ -858,6 +859,10 @@ def test_cat_from_scalar(scalar):
858859
assert_eq(ps, gs)
859860

860861

862+
@pytest.mark.skipif(
863+
PANDAS_VERSION < PANDAS_CURRENT_SUPPORTED_VERSION,
864+
reason="Does not warn on older versions of pandas",
865+
)
861866
def test_cat_groupby_fillna():
862867
ps = pd.Series(["a", "b", "c"], dtype="category")
863868
gs = cudf.from_pandas(ps)

0 commit comments

Comments
 (0)