From dcff010b2dd1e62ab2efebf45def18f5a60af085 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Sun, 15 May 2022 10:50:08 -0700 Subject: [PATCH 01/13] CI: Start Testing on Python 3.11 --- .github/workflows/python-dev.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index 23a48e567dfe9..2d6e10dab3f28 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -29,7 +29,7 @@ env: jobs: build: - if: false # Comment this line out to "unfreeze" + #if: false # Comment this line out to "unfreeze" runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -61,7 +61,8 @@ jobs: python -m pip install --upgrade pip "setuptools<60.0.0" wheel pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy pip install git+https://github.com/nedbat/coveragepy.git - pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov + pip install git+https://github.com/cython/cython.git + pip install python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pip list - name: Build Pandas From df8dc986c56a9bd342b4a1b319782491482bd26b Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Sun, 15 May 2022 10:57:26 -0700 Subject: [PATCH 02/13] install numpy from github repo --- .github/workflows/python-dev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index 2d6e10dab3f28..41ed482d7a516 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -59,9 +59,10 @@ jobs: shell: bash -el {0} run: | python -m pip install --upgrade pip "setuptools<60.0.0" wheel - pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy + # pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy pip install git+https://github.com/nedbat/coveragepy.git pip install git+https://github.com/cython/cython.git + pip install git+https://github.com/numpy/numpy.git pip install python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pip list From af2cb642ade351099b4c8921ed2b0a65c27be712 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Mon, 16 May 2022 13:35:09 -0700 Subject: [PATCH 03/13] Update python-dev.yml --- .github/workflows/python-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index 41ed482d7a516..e1b3368f49407 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -61,9 +61,8 @@ jobs: python -m pip install --upgrade pip "setuptools<60.0.0" wheel # pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy pip install git+https://github.com/nedbat/coveragepy.git - pip install git+https://github.com/cython/cython.git pip install git+https://github.com/numpy/numpy.git - pip install python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov + pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pip list - name: Build Pandas From 4b3bd8e8f944360512289048c48bbf05588803ad Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Mon, 16 May 2022 14:58:31 -0700 Subject: [PATCH 04/13] install pytest-asyncio --- .github/workflows/python-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index e1b3368f49407..f07aaf177905a 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -56,13 +56,13 @@ jobs: # TODO: GH#44980 https://github.com/pypa/setuptools/issues/2941 - name: Install dependencies - shell: bash -el {0} + #shell: bash -el {0} run: | python -m pip install --upgrade pip "setuptools<60.0.0" wheel # pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy pip install git+https://github.com/nedbat/coveragepy.git pip install git+https://github.com/numpy/numpy.git - pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov + pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio pip list - name: Build Pandas From 8043db316d3bf4cb2c7148920abcda92e11a272d Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Tue, 24 May 2022 12:30:21 -0700 Subject: [PATCH 05/13] remove as_tuple --- pandas/tests/scalar/test_nat.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 873103b01f64d..39e3a5d63f21b 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -220,7 +220,7 @@ def test_missing_public_nat_methods(klass, expected): assert missing == expected -def _get_overlap_public_nat_methods(klass, as_tuple=False): +def _get_overlap_public_nat_methods(klass): """ Get overlapping public methods between NaT and another class. @@ -228,8 +228,6 @@ def _get_overlap_public_nat_methods(klass, as_tuple=False): ---------- klass : type The class to compare with NaT - as_tuple : bool, default False - Whether to return a list of tuples of the form (klass, method). Returns ------- @@ -249,9 +247,6 @@ def _get_overlap_public_nat_methods(klass, as_tuple=False): ts_names = dir(Timestamp) overlap = [x for x in overlap if x not in ts_names] - if as_tuple: - overlap = [(klass, method) for method in overlap] - overlap.sort() return overlap From 8e4a64066decb8d33690650e2ba9465c879f6175 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Tue, 24 May 2022 12:53:06 -0700 Subject: [PATCH 06/13] Update test_nat.py --- pandas/tests/scalar/test_nat.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 39e3a5d63f21b..3c7e42400ffda 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -310,30 +310,31 @@ def test_overlap_public_nat_methods(klass, expected): @pytest.mark.parametrize( - "compare", + "klass", ( - _get_overlap_public_nat_methods(Timestamp, True) - + _get_overlap_public_nat_methods(Timedelta, True) + Timestamp, + Timedelta ), ) -def test_nat_doc_strings(compare): +def test_nat_doc_strings(klass): # see gh-17327 # # The docstrings for overlapping methods should match. - klass, method = compare - klass_doc = getattr(klass, method).__doc__ + methods = _get_overlap_public_nat_methods(klass) + for method in methods: + klass_doc = getattr(klass, method).__doc__ - # Ignore differences with Timestamp.isoformat() as they're intentional - if klass == Timestamp and method == "isoformat": - return + # Ignore differences with Timestamp.isoformat() as they're intentional + if klass == Timestamp and method == "isoformat": + return - if method == "to_numpy": - # GH#44460 can return either dt64 or td64 depending on dtype, - # different docstring is intentional - return + if method == "to_numpy": + # GH#44460 can return either dt64 or td64 depending on dtype, + # different docstring is intentional + return - nat_doc = getattr(NaT, method).__doc__ - assert klass_doc == nat_doc + nat_doc = getattr(NaT, method).__doc__ + assert klass_doc == nat_doc _ops = { From 7d922d8e35fdefff75b9a77f828a496e190f6c15 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Mon, 30 May 2022 09:22:06 -0700 Subject: [PATCH 07/13] fix parser tests --- pandas/compat/__init__.py | 1 + pandas/tests/io/parser/common/test_read_errors.py | 3 ++- pandas/tests/io/parser/test_quoting.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index bc8948cc8aee1..2537efe898553 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -29,6 +29,7 @@ PY39 = sys.version_info >= (3, 9) PY310 = sys.version_info >= (3, 10) +PY311 = sys.version_info >= (3, 11) PYPY = platform.python_implementation() == "PyPy" IS64 = sys.maxsize > 2**32 diff --git a/pandas/tests/io/parser/common/test_read_errors.py b/pandas/tests/io/parser/common/test_read_errors.py index 47f1052808e0c..57db65b42464b 100644 --- a/pandas/tests/io/parser/common/test_read_errors.py +++ b/pandas/tests/io/parser/common/test_read_errors.py @@ -12,6 +12,7 @@ import numpy as np import pytest +from pandas.compat import PY311 from pandas.errors import ( EmptyDataError, ParserError, @@ -230,7 +231,7 @@ def test_null_byte_char(all_parsers): names = ["a", "b"] parser = all_parsers - if parser.engine == "c": + if parser.engine == "c" or PY311: expected = DataFrame([[np.nan, "foo"]], columns=names) out = parser.read_csv(StringIO(data), names=names) tm.assert_frame_equal(out, expected) diff --git a/pandas/tests/io/parser/test_quoting.py b/pandas/tests/io/parser/test_quoting.py index 456dd049d2f4a..8dc46fc1f64f9 100644 --- a/pandas/tests/io/parser/test_quoting.py +++ b/pandas/tests/io/parser/test_quoting.py @@ -80,7 +80,7 @@ def test_null_quote_char(all_parsers, quoting, quote_char): if quoting != csv.QUOTE_NONE: # Sanity checking. - msg = "quotechar must be set if quoting enabled" + msg = r'(quotechar must be set if quoting enabled|"quotechar" must be a 1-character string)' with pytest.raises(TypeError, match=msg): parser.read_csv(StringIO(data), **kwargs) From 1226509dd2b250a1388358d538cedf7a5c4f4da6 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Mon, 30 May 2022 16:23:38 +0000 Subject: [PATCH 08/13] Fixes from pre-commit [automated commit] --- pandas/tests/scalar/test_nat.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 3c7e42400ffda..2e7a3ef966a25 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -311,10 +311,7 @@ def test_overlap_public_nat_methods(klass, expected): @pytest.mark.parametrize( "klass", - ( - Timestamp, - Timedelta - ), + (Timestamp, Timedelta), ) def test_nat_doc_strings(klass): # see gh-17327 From b8cbe8470e5a4d1a8101387a0c52088e344965f6 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Mon, 30 May 2022 10:05:40 -0700 Subject: [PATCH 09/13] break up string --- pandas/tests/io/parser/test_quoting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/io/parser/test_quoting.py b/pandas/tests/io/parser/test_quoting.py index 8dc46fc1f64f9..300f3daa45e7b 100644 --- a/pandas/tests/io/parser/test_quoting.py +++ b/pandas/tests/io/parser/test_quoting.py @@ -80,7 +80,8 @@ def test_null_quote_char(all_parsers, quoting, quote_char): if quoting != csv.QUOTE_NONE: # Sanity checking. - msg = r'(quotechar must be set if quoting enabled|"quotechar" must be a 1-character string)' + msg = r'(quotechar must be set if quoting enabled|' + r'"quotechar" must be a 1-character string)' with pytest.raises(TypeError, match=msg): parser.read_csv(StringIO(data), **kwargs) From d4653fb809910759c298c895e05a0b487f9dff23 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Mon, 30 May 2022 10:21:57 -0700 Subject: [PATCH 10/13] syntax --- pandas/tests/io/parser/test_quoting.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/parser/test_quoting.py b/pandas/tests/io/parser/test_quoting.py index 300f3daa45e7b..d47d78da0d905 100644 --- a/pandas/tests/io/parser/test_quoting.py +++ b/pandas/tests/io/parser/test_quoting.py @@ -80,8 +80,10 @@ def test_null_quote_char(all_parsers, quoting, quote_char): if quoting != csv.QUOTE_NONE: # Sanity checking. - msg = r'(quotechar must be set if quoting enabled|' - r'"quotechar" must be a 1-character string)' + msg = ( + r"(quotechar must be set if quoting enabled|" + r'"quotechar" must be a 1-character string)' + ) with pytest.raises(TypeError, match=msg): parser.read_csv(StringIO(data), **kwargs) From 67035c449a287886c8ab0a91128213501fdd8dde Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Wed, 22 Jun 2022 11:00:10 -0700 Subject: [PATCH 11/13] DEPS/TST: tzdata is optional, not required (#17) --- pandas/conftest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandas/conftest.py b/pandas/conftest.py index dfe8c5f1778d3..c69359ec4fa61 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -78,6 +78,13 @@ if pd.compat.PY39: # Import "zoneinfo" could not be resolved (reportMissingImports) import zoneinfo # type: ignore[no-redef] + # Although zoneinfo can be imported in Py39, it is effectively + # "not available" without tzdata/IANA tz data. + # We will set zoneinfo to not found in this case + try: + utc_zoneinfo = ZoneInfo("UTC") + except ZoneInfoNotFoundError: + zoneinfo = None # Until https://github.com/numpy/numpy/issues/19078 is sorted out, just suppress suppress_npdev_promotion_warning = pytest.mark.filterwarnings( From 3f41dd2d64eeb37c0a58077a64817304da762372 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Wed, 22 Jun 2022 11:37:04 -0700 Subject: [PATCH 12/13] try again * DEPS/TST: tzdata is optional, not required * Fix name & formatting * another one --- pandas/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandas/conftest.py b/pandas/conftest.py index c69359ec4fa61..20c5722edb81e 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -86,6 +86,14 @@ except ZoneInfoNotFoundError: zoneinfo = None + # Although zoneinfo can be imported in Py39, it is effectively + # "not available" without tzdata/IANA tz data. + # We will set zoneinfo to not found in this case + try: + utc_zoneinfo = zoneinfo.ZoneInfo("UTC") + except zoneinfo.ZoneInfoNotFoundError: + zoneinfo = None + # Until https://github.com/numpy/numpy/issues/19078 is sorted out, just suppress suppress_npdev_promotion_warning = pytest.mark.filterwarnings( "ignore:Promotion of numbers and bools:FutureWarning" From b05dec57923ea2e3b2b13b008a7c41a4f9d1c5dd Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Wed, 22 Jun 2022 11:56:28 -0700 Subject: [PATCH 13/13] bad merge --- pandas/conftest.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 20c5722edb81e..4253e15f0bd5c 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -78,13 +78,6 @@ if pd.compat.PY39: # Import "zoneinfo" could not be resolved (reportMissingImports) import zoneinfo # type: ignore[no-redef] - # Although zoneinfo can be imported in Py39, it is effectively - # "not available" without tzdata/IANA tz data. - # We will set zoneinfo to not found in this case - try: - utc_zoneinfo = ZoneInfo("UTC") - except ZoneInfoNotFoundError: - zoneinfo = None # Although zoneinfo can be imported in Py39, it is effectively # "not available" without tzdata/IANA tz data.