diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3a846ab5..7f271f8c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.8', '3.9', '3.10.6'] + python-version: ['3.8', '3.9', '3.10.6', '3.11'] steps: - uses: actions/checkout@v3 diff --git a/pandas-stubs/core/arrays/arrow/dtype.pyi b/pandas-stubs/core/arrays/arrow/dtype.pyi index 041012a7..954b96a6 100644 --- a/pandas-stubs/core/arrays/arrow/dtype.pyi +++ b/pandas-stubs/core/arrays/arrow/dtype.pyi @@ -1,7 +1,15 @@ +import sys +from typing import Any + import pyarrow as pa from pandas.core.dtypes.base import StorageExtensionDtype +if sys.version_info < (3, 11): + import pyarrow as pa +else: + pa: Any + class ArrowDtype(StorageExtensionDtype): pyarrow_dtype: pa.DataType def __init__(self, pyarrow_dtype: pa.DataType) -> None: ... diff --git a/pyproject.toml b/pyproject.toml index e1fc2964..d3e091fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering" ] packages = [ @@ -30,12 +31,13 @@ packages = [ "Documentation" = "https://pandas.pydata.org/pandas-docs/stable" [tool.poetry.dependencies] -python = ">=3.8,<3.11" +python = ">=3.8,<3.12" types-pytz = ">= 2022.1.1" [tool.poetry.dev-dependencies] mypy = "0.990" -pyarrow = ">=9.0.0" +# Until pyarrow releases wheels for 3.11 this is required to make the ci pass +pyarrow = { version = ">=9.0.0", python = "<3.11" } pytest = ">=7.1.2" pyright = ">=1.1.278" poethepoet = "0.16.0" @@ -47,8 +49,8 @@ pre-commit = ">=2.19.0" black = ">=22.8.0" isort = ">=5.10.1" openpyxl = ">=3.0.10" -tables = ">=3.7.0" -lxml = ">=4.7.1,<4.9.0" +tables = { version = ">=3.7.0", python = "<3.11" } +lxml = { version = ">=4.7.1,<4.9.0", python = "<3.11" } pyreadstat = ">=1.1.9" xlrd = ">=2.0.1" pyxlsb = ">=1.0.9" diff --git a/tests/__init__.py b/tests/__init__.py index 43008807..0d1ff072 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -4,9 +4,11 @@ AbstractContextManager, nullcontext, ) +import functools import os import platform from typing import ( + Callable, TYPE_CHECKING, Final, ) @@ -15,7 +17,7 @@ from pandas.util.version import Version import pytest -from pandas._typing import T +from pandas._typing import T, F TYPE_CHECKING_INVALID_USAGE: Final = TYPE_CHECKING WINDOWS = os.name == "nt" or "cygwin" in platform.system().lower() diff --git a/tests/test_io.py b/tests/test_io.py index 3a8bee13..85353b87 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -5,6 +5,7 @@ import pathlib from pathlib import Path import sqlite3 +import sys from typing import ( TYPE_CHECKING, Any, @@ -69,6 +70,13 @@ CWD = os.path.split(os.path.abspath(__file__))[0] +arrow_skip = pytest.mark.skipif(sys.version_info >= (3, 11), "pyarrow is not available for 3.11 yet") +"""This is only needed temporarily due to no wheels being available for arrow on 3.11""" + +lxml_skip = pytest.mark.skipif(sys.version_info >= (3, 11), "pyarrow is not available for 3.11 yet") +"""This is only needed temporarily due to no wheels being available for arrow on 3.11""" + +@arrow_skip @pytest.mark.skipif(WINDOWS, reason="ORC not available on windows") def test_orc(): with ensure_clean() as path: @@ -76,6 +84,7 @@ def test_orc(): check(assert_type(read_orc(path), DataFrame), DataFrame) +@arrow_skip @pytest.mark.skipif(WINDOWS, reason="ORC not available on windows") def test_orc_path(): with ensure_clean() as path: @@ -84,6 +93,7 @@ def test_orc_path(): check(assert_type(read_orc(pathlib_path), DataFrame), DataFrame) +@arrow_skip @pytest.mark.skipif(WINDOWS, reason="ORC not available on windows") def test_orc_buffer(): with ensure_clean() as path: @@ -96,6 +106,7 @@ def test_orc_buffer(): file_r.close() +@arrow_skip @pytest.mark.skipif(WINDOWS, reason="ORC not available on windows") def test_orc_columns(): with ensure_clean() as path: @@ -103,11 +114,12 @@ def test_orc_columns(): check(assert_type(read_orc(path, columns=["a"]), DataFrame), DataFrame) +@arrow_skip @pytest.mark.skipif(WINDOWS, reason="ORC not available on windows") def test_orc_bytes(): check(assert_type(DF.to_orc(index=False), bytes), bytes) - +@lxml_skip def test_xml(): with ensure_clean() as path: check(assert_type(DF.to_xml(path), None), type(None)) @@ -116,6 +128,7 @@ def test_xml(): check(assert_type(read_xml(f), DataFrame), DataFrame) +@lxml_skip def test_xml_str(): with ensure_clean() as path: check(assert_type(DF.to_xml(), str), str) @@ -282,6 +295,7 @@ def test_sas_xport() -> None: pass +@lxml_skip def test_hdf(): with ensure_clean() as path: check(assert_type(DF.to_hdf(path, "df"), None), type(None)) diff --git a/tests/test_pandas.py b/tests/test_pandas.py index 456f9494..1445f862 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -20,11 +20,15 @@ from pandas._libs.tslibs import NaTType from pandas._typing import Scalar + from tests import ( TYPE_CHECKING_INVALID_USAGE, check, + importskip ) +pyarrow_skip = pytest.mark.skip + def test_types_to_datetime() -> None: df = pd.DataFrame({"year": [2015, 2016], "month": [2, 3], "day": [4, 5]}) @@ -461,9 +465,8 @@ def test_crosstab() -> None: ) +@pyarrow_skip def test_arrow_dtype() -> None: - pytest.importorskip("pyarrow") - import pyarrow as pa check(