Skip to content

Commit a5e812d

Browse files
authored
DEPS: Drop Python 3.9 (#58238)
* DEPS: Drop Python 3.9 * Update GHA files * remove 3.8 ref in test file * Move back to 3.9 for pypy * Bump pyupgrade * Run pyupgrade * Remove pandas.compat.compressors * Fix env file * Wronge error message * Ignore pypy * Test package checks with 3.12 * Modify subprocess test * revert conda-forge checks * Remove 3.9 from circleci * Pyupgrade * Don't build 39 wheels
1 parent 6c4903e commit a5e812d

File tree

104 files changed

+223
-446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+223
-446
lines changed

.circleci/config.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,9 @@ workflows:
141141
only: /^v.*/
142142
matrix:
143143
parameters:
144-
cibw-build: ["cp39-manylinux_aarch64",
145-
"cp310-manylinux_aarch64",
144+
cibw-build: ["cp310-manylinux_aarch64",
146145
"cp311-manylinux_aarch64",
147146
"cp312-manylinux_aarch64",
148-
"cp39-musllinux_aarch64",
149147
"cp310-musllinux_aarch64",
150148
"cp311-musllinux_aarch64",
151149
"cp312-musllinux_aarch64",]

.github/workflows/package-checks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
runs-on: ubuntu-22.04
5454
strategy:
5555
matrix:
56-
python-version: ['3.9', '3.10', '3.11']
56+
python-version: ['3.10', '3.11']
5757
fail-fast: false
5858
name: Test Conda Forge Recipe - Python ${{ matrix.python-version }}
5959
concurrency:

.github/workflows/unit-tests.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
timeout-minutes: 90
2727
strategy:
2828
matrix:
29-
env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml, actions-312.yaml]
29+
env_file: [actions-310.yaml, actions-311.yaml, actions-312.yaml]
3030
# Prevent the include jobs from overriding other jobs
3131
pattern: [""]
3232
include:
@@ -35,7 +35,7 @@ jobs:
3535
pattern: "not slow and not network and not single_cpu"
3636
pytest_target: "pandas/tests/test_downstream.py"
3737
- name: "Minimum Versions"
38-
env_file: actions-39-minimum_versions.yaml
38+
env_file: actions-310-minimum_versions.yaml
3939
pattern: "not slow and not network and not single_cpu"
4040
- name: "Locale: it_IT"
4141
env_file: actions-311.yaml
@@ -146,6 +146,8 @@ jobs:
146146
- name: Build Pandas
147147
id: build
148148
uses: ./.github/actions/build_pandas
149+
# TODO: Re-enable once Pypy has Pypy 3.10 on conda-forge
150+
if: ${{ matrix.name != 'Pypy' }}
149151
with:
150152
meson_args: ${{ matrix.meson_args }}
151153
cflags_adds: ${{ matrix.cflags_adds }}
@@ -170,7 +172,7 @@ jobs:
170172
matrix:
171173
# Note: Don't use macOS latest since macos 14 appears to be arm64 only
172174
os: [macos-13, macos-14, windows-latest]
173-
env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml, actions-312.yaml]
175+
env_file: [actions-310.yaml, actions-311.yaml, actions-312.yaml]
174176
fail-fast: false
175177
runs-on: ${{ matrix.os }}
176178
name: ${{ format('{0} {1}', matrix.os, matrix.env_file) }}

.github/workflows/wheels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
- [macos-14, macosx_arm64]
100100
- [windows-2022, win_amd64]
101101
# TODO: support PyPy?
102-
python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
102+
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
103103
env:
104104
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
105105
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ repos:
7575
rev: v3.15.2
7676
hooks:
7777
- id: pyupgrade
78-
args: [--py39-plus]
78+
args: [--py310-plus]
7979
- repo: https://github.com/pre-commit/pygrep-hooks
8080
rev: v1.10.0
8181
hooks:

ci/deps/actions-39-minimum_versions.yaml renamed to ci/deps/actions-310-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: pandas-dev
44
channels:
55
- conda-forge
66
dependencies:
7-
- python=3.9
7+
- python=3.10
88

99
# build dependencies
1010
- versioneer[toml]

ci/deps/actions-39.yaml

-63
This file was deleted.

doc/source/development/contributing_environment.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
130130
pyenv virtualenv <version> <name-to-give-it>
131131
132132
# For instance:
133-
pyenv virtualenv 3.9.10 pandas-dev
133+
pyenv virtualenv 3.10 pandas-dev
134134
135135
# Activate the virtualenv
136136
pyenv activate pandas-dev

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Python terminal.
161161
162162
>>> import pandas as pd
163163
>>> pd.test()
164-
running: pytest -m "not slow and not network and not db" /home/user/anaconda3/lib/python3.9/site-packages/pandas
164+
running: pytest -m "not slow and not network and not db" /home/user/anaconda3/lib/python3.10/site-packages/pandas
165165
166166
============================= test session starts ==============================
167167
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0

doc/source/whatsnew/v3.0.0.rst

+5
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ In cases with mixed-resolution inputs, the highest resolution is used:
190190
191191
.. _whatsnew_300.api_breaking.deps:
192192

193+
Increased minimum version for Python
194+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
195+
196+
pandas 3.0.0 supports Python 3.10 and higher.
197+
193198
Increased minimum versions for dependencies
194199
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
195200
Some minimum supported versions of dependencies were updated.

pandas/_config/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
from typing import (
5656
TYPE_CHECKING,
5757
Any,
58-
Callable,
5958
NamedTuple,
6059
cast,
6160
)
@@ -66,6 +65,7 @@
6665

6766
if TYPE_CHECKING:
6867
from collections.abc import (
68+
Callable,
6969
Generator,
7070
Sequence,
7171
)

pandas/_testing/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from sys import byteorder
77
from typing import (
88
TYPE_CHECKING,
9-
Callable,
109
ContextManager,
1110
cast,
1211
)
@@ -85,6 +84,8 @@
8584
from pandas.core.construction import extract_array
8685

8786
if TYPE_CHECKING:
87+
from collections.abc import Callable
88+
8889
from pandas._typing import (
8990
Dtype,
9091
NpDtype,

pandas/_testing/_io.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,18 @@
77
from typing import (
88
TYPE_CHECKING,
99
Any,
10-
Callable,
1110
)
1211
import uuid
1312
import zipfile
1413

15-
from pandas.compat import (
16-
get_bz2_file,
17-
get_lzma_file,
18-
)
1914
from pandas.compat._optional import import_optional_dependency
2015

2116
import pandas as pd
2217
from pandas._testing.contexts import ensure_clean
2318

2419
if TYPE_CHECKING:
20+
from collections.abc import Callable
21+
2522
from pandas._typing import (
2623
FilePath,
2724
ReadPickleBuffer,
@@ -129,11 +126,15 @@ def write_to_compressed(compression, path, data, dest: str = "test") -> None:
129126
elif compression == "gzip":
130127
compress_method = gzip.GzipFile
131128
elif compression == "bz2":
132-
compress_method = get_bz2_file()
129+
import bz2
130+
131+
compress_method = bz2.BZ2File
133132
elif compression == "zstd":
134133
compress_method = import_optional_dependency("zstandard").open
135134
elif compression == "xz":
136-
compress_method = get_lzma_file()
135+
import lzma
136+
137+
compress_method = lzma.LZMAFile
137138
else:
138139
raise ValueError(f"Unrecognized compression type: {compression}")
139140

pandas/_typing.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import (
4+
Callable,
45
Hashable,
56
Iterator,
67
Mapping,
@@ -18,7 +19,6 @@
1819
from typing import (
1920
TYPE_CHECKING,
2021
Any,
21-
Callable,
2222
Literal,
2323
Optional,
2424
Protocol,
@@ -90,18 +90,12 @@
9090
# Name "npt._ArrayLikeInt_co" is not defined [name-defined]
9191
NumpySorter = Optional[npt._ArrayLikeInt_co] # type: ignore[name-defined]
9292

93-
from typing import SupportsIndex
94-
95-
if sys.version_info >= (3, 10):
96-
from typing import Concatenate # pyright: ignore[reportUnusedImport]
97-
from typing import ParamSpec
98-
from typing import TypeGuard # pyright: ignore[reportUnusedImport]
99-
else:
100-
from typing_extensions import ( # pyright: ignore[reportUnusedImport]
101-
Concatenate,
102-
ParamSpec,
103-
TypeGuard,
104-
)
93+
from typing import (
94+
ParamSpec,
95+
SupportsIndex,
96+
)
97+
from typing import Concatenate # pyright: ignore[reportUnusedImport]
98+
from typing import TypeGuard # pyright: ignore[reportUnusedImport]
10599

106100
P = ParamSpec("P")
107101

pandas/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
"""Git implementation of _version.py."""
1212

13+
from collections.abc import Callable
1314
import errno
1415
import functools
1516
import os
1617
import re
1718
import subprocess
1819
import sys
19-
from typing import Callable
2020

2121

2222
def get_keywords():

pandas/compat/__init__.py

-49
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818
from pandas.compat._constants import (
1919
IS64,
2020
ISMUSL,
21-
PY310,
2221
PY311,
2322
PY312,
2423
PYPY,
2524
WASM,
2625
)
27-
import pandas.compat.compressors
2826
from pandas.compat.numpy import is_numpy_dev
2927
from pandas.compat.pyarrow import (
3028
pa_version_under10p1,
@@ -148,52 +146,6 @@ def is_ci_environment() -> bool:
148146
return os.environ.get("PANDAS_CI", "0") == "1"
149147

150148

151-
def get_lzma_file() -> type[pandas.compat.compressors.LZMAFile]:
152-
"""
153-
Importing the `LZMAFile` class from the `lzma` module.
154-
155-
Returns
156-
-------
157-
class
158-
The `LZMAFile` class from the `lzma` module.
159-
160-
Raises
161-
------
162-
RuntimeError
163-
If the `lzma` module was not imported correctly, or didn't exist.
164-
"""
165-
if not pandas.compat.compressors.has_lzma:
166-
raise RuntimeError(
167-
"lzma module not available. "
168-
"A Python re-install with the proper dependencies, "
169-
"might be required to solve this issue."
170-
)
171-
return pandas.compat.compressors.LZMAFile
172-
173-
174-
def get_bz2_file() -> type[pandas.compat.compressors.BZ2File]:
175-
"""
176-
Importing the `BZ2File` class from the `bz2` module.
177-
178-
Returns
179-
-------
180-
class
181-
The `BZ2File` class from the `bz2` module.
182-
183-
Raises
184-
------
185-
RuntimeError
186-
If the `bz2` module was not imported correctly, or didn't exist.
187-
"""
188-
if not pandas.compat.compressors.has_bz2:
189-
raise RuntimeError(
190-
"bz2 module not available. "
191-
"A Python re-install with the proper dependencies, "
192-
"might be required to solve this issue."
193-
)
194-
return pandas.compat.compressors.BZ2File
195-
196-
197149
__all__ = [
198150
"is_numpy_dev",
199151
"pa_version_under10p1",
@@ -204,7 +156,6 @@ def get_bz2_file() -> type[pandas.compat.compressors.BZ2File]:
204156
"pa_version_under16p0",
205157
"IS64",
206158
"ISMUSL",
207-
"PY310",
208159
"PY311",
209160
"PY312",
210161
"PYPY",

0 commit comments

Comments
 (0)