From f879112699cb77fa2f6a9c6d8304b216a713981f Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Thu, 30 Nov 2023 15:38:01 +0100 Subject: [PATCH 1/3] Backport PR #56174: CI: Add 3.12 builds --- .github/workflows/unit-tests.yml | 22 ++++++++-- ci/deps/actions-312.yaml | 63 +++++++++++++++++++++++++++ pandas/tests/computation/test_eval.py | 13 +++++- pandas/tests/extension/test_arrow.py | 9 +++- pandas/tests/io/excel/test_readers.py | 4 +- pandas/tests/io/excel/test_writers.py | 4 +- 6 files changed, 107 insertions(+), 8 deletions(-) create mode 100644 ci/deps/actions-312.yaml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 14abcdbfdb310..b472587d8b58f 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -26,7 +26,7 @@ jobs: timeout-minutes: 180 strategy: matrix: - env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml] + env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml, actions-312.yaml] # Prevent the include jobs from overriding other jobs pattern: [""] include: @@ -69,6 +69,22 @@ jobs: env_file: actions-311.yaml pattern: "not slow and not network and not single_cpu" pandas_copy_on_write: "1" + - name: "Copy-on-Write 3.12" + env_file: actions-312.yaml + pattern: "not slow and not network and not single_cpu" + pandas_copy_on_write: "1" + - name: "Copy-on-Write 3.11 (warnings)" + env_file: actions-311.yaml + pattern: "not slow and not network and not single_cpu" + pandas_copy_on_write: "warn" + - name: "Copy-on-Write 3.10 (warnings)" + env_file: actions-310.yaml + pattern: "not slow and not network and not single_cpu" + pandas_copy_on_write: "warn" + - name: "Copy-on-Write 3.9 (warnings)" + env_file: actions-39.yaml + pattern: "not slow and not network and not single_cpu" + pandas_copy_on_write: "warn" - name: "Pypy" env_file: actions-pypy-39.yaml pattern: "not slow and not network and not single_cpu" @@ -177,7 +193,7 @@ jobs: strategy: matrix: os: [macos-latest, windows-latest] - env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml] + env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml, actions-312.yaml] fail-fast: false runs-on: ${{ matrix.os }} name: ${{ format('{0} {1}', matrix.os, matrix.env_file) }} @@ -308,7 +324,7 @@ jobs: # To freeze this file, uncomment out the ``if: false`` condition, and migrate the jobs # to the corresponding posix/windows-macos/sdist etc. workflows. # Feel free to modify this comment as necessary. - #if: false # Uncomment this to freeze the workflow, comment it to unfreeze + if: false # Uncomment this to freeze the workflow, comment it to unfreeze defaults: run: shell: bash -eou pipefail {0} diff --git a/ci/deps/actions-312.yaml b/ci/deps/actions-312.yaml new file mode 100644 index 0000000000000..394b65525c791 --- /dev/null +++ b/ci/deps/actions-312.yaml @@ -0,0 +1,63 @@ +name: pandas-dev-312 +channels: + - conda-forge +dependencies: + - python=3.12 + + # build dependencies + - versioneer[toml] + - cython>=0.29.33 + - meson[ninja]=1.2.1 + - meson-python=0.13.1 + + # test dependencies + - pytest>=7.3.2 + - pytest-cov + - pytest-xdist>=2.2.0 + - pytest-localserver>=0.7.1 + - pytest-qt>=4.2.0 + - boto3 + + # required dependencies + - python-dateutil + - numpy<2 + - pytz + + # optional dependencies + - beautifulsoup4>=4.11.2 + - blosc>=1.21.3 + - bottleneck>=1.3.6 + - fastparquet>=2022.12.0 + - fsspec>=2022.11.0 + - html5lib>=1.1 + - hypothesis>=6.46.1 + - gcsfs>=2022.11.0 + - jinja2>=3.1.2 + - lxml>=4.9.2 + - matplotlib>=3.6.3 + # - numba>=0.56.4 + - numexpr>=2.8.4 + - odfpy>=1.4.1 + - qtpy>=2.3.0 + - pyqt>=5.15.9 + - openpyxl>=3.1.0 + - psycopg2>=2.9.6 + - pyarrow>=10.0.1 + - pymysql>=1.0.2 + - pyreadstat>=1.2.0 + # - pytables>=3.8.0 + # - python-calamine>=0.1.6 + - pyxlsb>=1.0.10 + - s3fs>=2022.11.0 + - scipy>=1.10.0 + - sqlalchemy>=2.0.0 + - tabulate>=0.9.0 + - xarray>=2022.12.0 + - xlrd>=2.0.1 + - xlsxwriter>=3.0.5 + - zstandard>=0.19.0 + + - pip: + - adbc-driver-postgresql>=0.8.0 + - adbc-driver-sqlite>=0.8.0 + - tzdata>=2022.7 diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 9c630e29ea8e6..3aa7decfa7b3a 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -542,6 +542,9 @@ def test_series_pos(self, lhs, engine, parser): def test_scalar_unary(self, engine, parser): msg = "bad operand type for unary ~: 'float'" + warn = None + if PY312 and not (engine == "numexpr" and parser == "pandas"): + warn = DeprecationWarning with pytest.raises(TypeError, match=msg): pd.eval("~1.0", engine=engine, parser=parser) @@ -550,8 +553,14 @@ def test_scalar_unary(self, engine, parser): assert pd.eval("~1", parser=parser, engine=engine) == ~1 assert pd.eval("-1", parser=parser, engine=engine) == -1 assert pd.eval("+1", parser=parser, engine=engine) == +1 - assert pd.eval("~True", parser=parser, engine=engine) == ~True - assert pd.eval("~False", parser=parser, engine=engine) == ~False + with tm.assert_produces_warning( + warn, match="Bitwise inversion", check_stacklevel=False + ): + assert pd.eval("~True", parser=parser, engine=engine) == ~True + with tm.assert_produces_warning( + warn, match="Bitwise inversion", check_stacklevel=False + ): + assert pd.eval("~False", parser=parser, engine=engine) == ~False assert pd.eval("-True", parser=parser, engine=engine) == -True assert pd.eval("-False", parser=parser, engine=engine) == -False assert pd.eval("+True", parser=parser, engine=engine) == +True diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py index 61474aa94d1c8..0cfe4ee105e49 100644 --- a/pandas/tests/extension/test_arrow.py +++ b/pandas/tests/extension/test_arrow.py @@ -34,6 +34,7 @@ from pandas._libs.tslibs import timezones from pandas.compat import ( PY311, + PY312, is_ci_environment, is_platform_windows, pa_version_under7p0, @@ -762,7 +763,13 @@ def test_invert(self, data, request): reason=f"pyarrow.compute.invert does support {pa_dtype}", ) ) - super().test_invert(data) + if PY312 and pa.types.is_boolean(pa_dtype): + with tm.assert_produces_warning( + DeprecationWarning, match="Bitwise inversion", check_stacklevel=False + ): + super().test_invert(data) + else: + super().test_invert(data) class TestBaseMethods(base.BaseMethodsTests): diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index 20bc6e98577d5..f7e11f24d306c 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -1446,7 +1446,9 @@ def test_deprecate_bytes_input(self, engine, read_ext): "byte string, wrap it in a `BytesIO` object." ) - with tm.assert_produces_warning(FutureWarning, match=msg): + with tm.assert_produces_warning( + FutureWarning, match=msg, raise_on_extra_warnings=False + ): with open("test1" + read_ext, "rb") as f: pd.read_excel(f.read(), engine=engine) diff --git a/pandas/tests/io/excel/test_writers.py b/pandas/tests/io/excel/test_writers.py index 905c733ea5ef1..3ab703ea68519 100644 --- a/pandas/tests/io/excel/test_writers.py +++ b/pandas/tests/io/excel/test_writers.py @@ -271,7 +271,9 @@ def test_read_excel_parse_dates(self, ext): date_parser = lambda x: datetime.strptime(x, "%m/%d/%Y") with tm.assert_produces_warning( - FutureWarning, match="use 'date_format' instead" + FutureWarning, + match="use 'date_format' instead", + raise_on_extra_warnings=False, ): res = pd.read_excel( pth, From e93f05ae9e5fd5a27e461ac188835d2ce545caf3 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Wed, 6 Dec 2023 22:21:35 -0500 Subject: [PATCH 2/3] Update test_arrow.py --- pandas/tests/extension/test_arrow.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py index 0cfe4ee105e49..b796484236d71 100644 --- a/pandas/tests/extension/test_arrow.py +++ b/pandas/tests/extension/test_arrow.py @@ -763,13 +763,7 @@ def test_invert(self, data, request): reason=f"pyarrow.compute.invert does support {pa_dtype}", ) ) - if PY312 and pa.types.is_boolean(pa_dtype): - with tm.assert_produces_warning( - DeprecationWarning, match="Bitwise inversion", check_stacklevel=False - ): - super().test_invert(data) - else: - super().test_invert(data) + super().test_invert(data) class TestBaseMethods(base.BaseMethodsTests): From 2a550b385fbc767aeac12973b3841429ec99780b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 04:22:07 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ci/deps/actions-312.yaml | 42 ++++++++++++++-------------- pandas/tests/extension/test_arrow.py | 1 - 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/ci/deps/actions-312.yaml b/ci/deps/actions-312.yaml index 394b65525c791..0caf851a3b65a 100644 --- a/ci/deps/actions-312.yaml +++ b/ci/deps/actions-312.yaml @@ -24,38 +24,38 @@ dependencies: - pytz # optional dependencies - - beautifulsoup4>=4.11.2 + - beautifulsoup4>=4.11.1 - blosc>=1.21.3 - - bottleneck>=1.3.6 - - fastparquet>=2022.12.0 - - fsspec>=2022.11.0 + - bottleneck>=1.3.4 + - fastparquet>=0.8.1 + - fsspec>=2022.05.0 - html5lib>=1.1 - hypothesis>=6.46.1 - - gcsfs>=2022.11.0 + - gcsfs>=2022.05.0 - jinja2>=3.1.2 - - lxml>=4.9.2 - - matplotlib>=3.6.3 + - lxml>=4.8.0 + - matplotlib>=3.6.1 # - numba>=0.56.4 - - numexpr>=2.8.4 + - numexpr>=2.8.0 - odfpy>=1.4.1 - - qtpy>=2.3.0 + - qtpy>=2.2.0 - pyqt>=5.15.9 - - openpyxl>=3.1.0 - - psycopg2>=2.9.6 - - pyarrow>=10.0.1 + - openpyxl>=3.0.10 + - psycopg2>=2.9.3 + - pyarrow>=7.0.0 - pymysql>=1.0.2 - - pyreadstat>=1.2.0 + - pyreadstat>=1.1.5 # - pytables>=3.8.0 # - python-calamine>=0.1.6 - - pyxlsb>=1.0.10 - - s3fs>=2022.11.0 - - scipy>=1.10.0 - - sqlalchemy>=2.0.0 - - tabulate>=0.9.0 - - xarray>=2022.12.0 + - pyxlsb>=1.0.9 + - s3fs>=2022.05.0 + - scipy>=1.8.1 + - sqlalchemy>=1.4.36 + - tabulate>=0.8.10 + - xarray>=2022.03.0 - xlrd>=2.0.1 - - xlsxwriter>=3.0.5 - - zstandard>=0.19.0 + - xlsxwriter>=3.0.3 + - zstandard>=0.17.0 - pip: - adbc-driver-postgresql>=0.8.0 diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py index b796484236d71..61474aa94d1c8 100644 --- a/pandas/tests/extension/test_arrow.py +++ b/pandas/tests/extension/test_arrow.py @@ -34,7 +34,6 @@ from pandas._libs.tslibs import timezones from pandas.compat import ( PY311, - PY312, is_ci_environment, is_platform_windows, pa_version_under7p0,