Skip to content

Commit ab5c643

Browse files
authored
Pandas 2.1 requires python>3.9 (#768)
* Pandas 2.1 requires python>3.9 * manual changes
1 parent 3c7df2f commit ab5c643

16 files changed

+127
-152
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.8', '3.9', '3.10', '3.11']
21+
python-version: ['3.9', '3.10', '3.11']
2222

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

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ repos:
1111
hooks:
1212
- id: isort
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.0.285
14+
rev: v0.0.286
1515
hooks:
1616
- id: ruff
1717
args: [
1818
--exit-non-zero-on-fix,
19-
--target-version, py38,
19+
--target-version, py39,
2020
--extend-select, "PYI,UP,RUF100",
2121
--ignore, "E501,E731,F841,PYI042",
2222
--per-file-ignores, "_*.pyi:PYI001",

pandas-stubs/_libs/tslibs/timestamps.pyi

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from datetime import (
2+
_IsoCalendarDate,
23
date as _date,
34
datetime,
45
time as _time,
56
timedelta,
67
tzinfo as _tzinfo,
78
)
8-
import sys
99
from time import struct_time
1010
from typing import (
1111
ClassVar,
@@ -46,11 +46,6 @@ _Nonexistent: TypeAlias = (
4646
Literal["raise", "NaT", "shift_backward", "shift_forward"] | Timedelta | timedelta
4747
)
4848

49-
if sys.version_info >= (3, 9):
50-
from datetime import _IsoCalendarDate
51-
else:
52-
_IsoCalendarDate: TypeAlias = tuple[int, int, int]
53-
5449
class Timestamp(datetime):
5550
min: ClassVar[Timestamp]
5651
max: ClassVar[Timestamp]

pandas-stubs/core/base.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
from collections.abc import Iterator
12
from typing import (
23
Generic,
3-
Iterator,
44
Literal,
55
)
66

pyproject.toml

+3-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ classifiers = [
1616
"Programming Language :: Python",
1717
"Programming Language :: Python :: 3",
1818
"Programming Language :: Python :: 3 :: Only",
19-
"Programming Language :: Python :: 3.8",
2019
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
2221
"Programming Language :: Python :: 3.11",
@@ -31,12 +30,9 @@ packages = [
3130
"Documentation" = "https://pandas.pydata.org/pandas-docs/stable"
3231

3332
[tool.poetry.dependencies]
34-
python = ">=3.8"
33+
python = ">=3.9"
3534
types-pytz = ">= 2022.1.1"
36-
numpy = [
37-
{version = "<=1.24.3", python = "<=3.8"},
38-
{version = ">=1.25.0", python = ">=3.9"}
39-
]
35+
numpy = ">=1.25.0"
4036

4137
[tool.poetry.dev-dependencies]
4238
mypy = "1.5.1"
@@ -116,7 +112,7 @@ args = [{ name = "allowlist", positional = true, default = "", required = false,
116112

117113

118114
[tool.black]
119-
target-version = ['py38']
115+
target-version = ['py39']
120116

121117
[tool.isort]
122118
known_pre_libs = "pandas._config"

scripts/_job.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
from collections import deque
12
from dataclasses import dataclass
23
import sys
34
import time
45
from typing import (
56
Callable,
6-
Deque,
7-
List,
87
Optional,
98
)
109

@@ -18,7 +17,7 @@ class Step:
1817
rollback: Optional[Callable[[], None]] = None
1918

2019

21-
def __rollback_job(steps: Deque[Step]):
20+
def __rollback_job(steps: deque[Step]):
2221
"""
2322
Responsible to run rollback of steps.
2423
"""
@@ -35,12 +34,12 @@ def __rollback_job(steps: Deque[Step]):
3534
)
3635

3736

38-
def run_job(steps: List[Step]) -> None:
37+
def run_job(steps: list[Step]) -> None:
3938
"""
4039
Responsible to run steps with logs.
4140
"""
4241

43-
rollback_steps = Deque[Step]()
42+
rollback_steps = deque[Step]()
4443
failed = False
4544

4645
for step in steps:

tests/test_api_types.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Type
2-
31
import numpy as np
42
import pandas as pd
53
from pandas.api.extensions import ExtensionDtype
@@ -468,7 +466,7 @@ def test_union_categoricals() -> None:
468466

469467
def test_check_extension_dtypes() -> None:
470468
# GH 315
471-
def check_ext_dtype(etype: Type[ExtensionDtype]):
469+
def check_ext_dtype(etype: type[ExtensionDtype]):
472470
assert issubclass(etype, ExtensionDtype)
473471

474472
check_ext_dtype(pd.Int64Dtype)

tests/test_dtypes.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
import numpy as np
1515
import pandas as pd
1616
from pandas.api.types import is_any_real_numeric_dtype
17-
from pandas.core.arrays import BooleanArray # noqa: F401
18-
from pandas.core.arrays import IntegerArray # noqa: F401
17+
from pandas.core.arrays import (
18+
BooleanArray,
19+
IntegerArray,
20+
)
1921
import pyarrow as pa
2022
from typing_extensions import assert_type
2123

@@ -96,7 +98,7 @@ def test_int64_dtype() -> None:
9698
i64dt = pd.Int64Dtype()
9799
check(assert_type(i64dt.itemsize, int), int)
98100
check(assert_type(i64dt.na_value, NAType), NAType)
99-
check(assert_type(i64dt.construct_array_type(), "type[IntegerArray]"), type)
101+
check(assert_type(i64dt.construct_array_type(), type[IntegerArray]), type)
100102

101103

102104
def test_categorical_dtype() -> None:
@@ -138,7 +140,7 @@ def test_boolean_dtype() -> None:
138140
b_dt = pd.BooleanDtype()
139141
check(assert_type(b_dt, pd.BooleanDtype), pd.BooleanDtype)
140142
check(assert_type(b_dt.na_value, NAType), NAType)
141-
check(assert_type(b_dt.construct_array_type(), "type[BooleanArray]"), type)
143+
check(assert_type(b_dt.construct_array_type(), type[BooleanArray]), type)
142144

143145

144146
def test_arrow_dtype() -> None:

0 commit comments

Comments
 (0)