Skip to content

Commit 0a567b4

Browse files
authored
CI: test on 3.12 (#839)
* CI: test on 3.12 * simpler solution * fix nightly
1 parent 70605ea commit 0a567b4

File tree

7 files changed

+65
-28
lines changed

7 files changed

+65
-28
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-latest, windows-latest, macos-latest]
21-
python-version: ['3.9', '3.10', '3.11']
21+
python-version: ['3.9', '3.10', '3.11', '3.12']
2222

2323
steps:
2424
- uses: actions/checkout@v3

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ ci:
33
autofix_prs: false
44
repos:
55
- repo: https://github.com/python/black
6-
rev: 23.12.0
6+
rev: 23.12.1
77
hooks:
88
- id: black
99
- repo: https://github.com/PyCQA/isort
1010
rev: 5.13.2
1111
hooks:
1212
- id: isort
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.1.8
14+
rev: v0.1.9
1515
hooks:
1616
- id: ruff
1717
args: [

pandas-stubs/_libs/tslibs/timestamps.pyi

+11-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ from datetime import (
66
timedelta,
77
tzinfo as _tzinfo,
88
)
9+
import sys
910
from time import struct_time
1011
from typing import (
1112
ClassVar,
@@ -99,8 +100,16 @@ class Timestamp(datetime):
99100
def tz(self) -> _tzinfo | None: ...
100101
@property
101102
def fold(self) -> int: ...
102-
@classmethod
103-
def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = ...) -> Self: ...
103+
104+
if sys.version_info < (3, 12):
105+
@classmethod
106+
def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = ...) -> Self: ...
107+
else:
108+
@classmethod
109+
def fromtimestamp( # pyright: ignore[reportIncompatibleMethodOverride]
110+
cls, t: float, tz: _tzinfo | str | None = ...
111+
) -> Self: ...
112+
104113
@classmethod
105114
def utcfromtimestamp(cls, ts: float) -> Self: ...
106115
@classmethod

pyproject.toml

+9-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ types-pytz = ">= 2022.1.1"
3535
numpy = { version = ">=1.26.0", python = "<3.13" }
3636

3737
[tool.poetry.group.dev.dependencies]
38-
mypy = "1.7.1"
38+
mypy = "1.8.0"
3939
pandas = "2.1.4"
4040
pyarrow = ">=10.0.1"
4141
pytest = ">=7.1.2"
@@ -62,7 +62,6 @@ jinja2 = ">=3.1"
6262
scipy = { version = ">=1.9.1", python = "<3.13" }
6363
SQLAlchemy = ">=2.0.12"
6464
types-python-dateutil = ">=2.8.19"
65-
numexpr = "<2.8.5" # https://github.com/pandas-dev/pandas/issues/54449
6665
beautifulsoup4 = ">=4.12.2"
6766
html5lib = ">=1.1"
6867

@@ -199,6 +198,14 @@ useLibraryCodeForTypes = false
199198
[tool.codespell]
200199
ignore-words-list = "indext, mose, sav, ser"
201200

201+
[tool.pytest.ini_options]
202+
filterwarnings = [
203+
# treat warnings as errors
204+
"error",
205+
# until there is a new dateutil release: github.com/dateutil/dateutil/pull/1285
206+
"ignore:datetime.datetime.utc:DeprecationWarning",
207+
]
208+
202209
# Next line needed to avoid poetry complaint
203210
[tool.setuptools_scm]
204211

scripts/test/run.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def pyright_src():
1515
subprocess.run(cmd, check=True)
1616

1717

18-
def pytest(flags: tuple[str, ...] = ("-Werror",)):
19-
cmd = ["pytest", "--cache-clear", *flags]
18+
def pytest():
19+
cmd = ["pytest", "--cache-clear"]
2020
subprocess.run(cmd, check=True)
2121

2222

tests/test_frame.py

+28-16
Original file line numberDiff line numberDiff line change
@@ -1699,31 +1699,43 @@ class ReadCsvKwargs(TypedDict):
16991699
pd.DataFrame,
17001700
)
17011701
parse_dates_2 = {"combined_date": ["Year", "Month", "Day"]}
1702-
check(
1703-
assert_type(pd.read_csv(path, parse_dates=parse_dates_2), pd.DataFrame),
1704-
pd.DataFrame,
1705-
)
1702+
with pytest_warns_bounded(
1703+
FutureWarning, "Support for nested sequences", lower="2.1.99"
1704+
):
1705+
check(
1706+
assert_type(pd.read_csv(path, parse_dates=parse_dates_2), pd.DataFrame),
1707+
pd.DataFrame,
1708+
)
17061709
parse_dates_3 = {"combined_date": [1, 2, 3]}
1707-
check(
1708-
assert_type(pd.read_csv(path, parse_dates=parse_dates_3), pd.DataFrame),
1709-
pd.DataFrame,
1710-
)
1710+
with pytest_warns_bounded(
1711+
FutureWarning, "Support for nested sequences", lower="2.1.99"
1712+
):
1713+
check(
1714+
assert_type(pd.read_csv(path, parse_dates=parse_dates_3), pd.DataFrame),
1715+
pd.DataFrame,
1716+
)
17111717
# MyPy calls this Dict[str, object] by default which necessitates the explicit annotation (Pyright does not)
17121718
parse_dates_4: dict[str, list[str | int]] = {"combined_date": [1, "Month", 3]}
1713-
check(
1714-
assert_type(pd.read_csv(path, parse_dates=parse_dates_4), pd.DataFrame),
1715-
pd.DataFrame,
1716-
)
1719+
with pytest_warns_bounded(
1720+
FutureWarning, "Support for nested sequences", lower="2.1.99"
1721+
):
1722+
check(
1723+
assert_type(pd.read_csv(path, parse_dates=parse_dates_4), pd.DataFrame),
1724+
pd.DataFrame,
1725+
)
17171726
parse_dates_5 = [0]
17181727
check(
17191728
assert_type(pd.read_csv(path, parse_dates=parse_dates_5), pd.DataFrame),
17201729
pd.DataFrame,
17211730
)
17221731
parse_dates_6 = [[1, 2, 3]]
1723-
check(
1724-
assert_type(pd.read_csv(path, parse_dates=parse_dates_6), pd.DataFrame),
1725-
pd.DataFrame,
1726-
)
1732+
with pytest_warns_bounded(
1733+
FutureWarning, "Support for nested sequences", lower="2.1.99"
1734+
):
1735+
check(
1736+
assert_type(pd.read_csv(path, parse_dates=parse_dates_6), pd.DataFrame),
1737+
pd.DataFrame,
1738+
)
17271739

17281740

17291741
def test_groupby_series_methods() -> None:

tests/test_utility.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
import platform
2+
13
import pandas as pd
2-
import pytest
34
from typing_extensions import assert_type
45

5-
from tests import check
6+
from tests import (
7+
check,
8+
pytest_warns_bounded,
9+
)
610

711

812
def test_show_version():
9-
with pytest.warns(UserWarning, match="Setuptools is replacing distutils"):
13+
with pytest_warns_bounded(
14+
UserWarning,
15+
match="Setuptools is replacing distutils",
16+
upper="3.11.99",
17+
version_str=platform.python_version(),
18+
):
1019
check(assert_type(pd.show_versions(True), None), type(None))
1120
check(assert_type(pd.show_versions(False), None), type(None))
1221

0 commit comments

Comments
 (0)