Skip to content

Commit

Permalink
DEPS: Drop Python 3.9 (pandas-dev#58238)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mroeschke authored Jun 21, 2024
1 parent 6c4903e commit a5e812d
Show file tree
Hide file tree
Showing 104 changed files with 223 additions and 446 deletions.
4 changes: 1 addition & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,9 @@ workflows:
only: /^v.*/
matrix:
parameters:
cibw-build: ["cp39-manylinux_aarch64",
"cp310-manylinux_aarch64",
cibw-build: ["cp310-manylinux_aarch64",
"cp311-manylinux_aarch64",
"cp312-manylinux_aarch64",
"cp39-musllinux_aarch64",
"cp310-musllinux_aarch64",
"cp311-musllinux_aarch64",
"cp312-musllinux_aarch64",]
2 changes: 1 addition & 1 deletion .github/workflows/package-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.10', '3.11']
fail-fast: false
name: Test Conda Forge Recipe - Python ${{ matrix.python-version }}
concurrency:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
timeout-minutes: 90
strategy:
matrix:
env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml, actions-312.yaml]
env_file: [actions-310.yaml, actions-311.yaml, actions-312.yaml]
# Prevent the include jobs from overriding other jobs
pattern: [""]
include:
Expand All @@ -35,7 +35,7 @@ jobs:
pattern: "not slow and not network and not single_cpu"
pytest_target: "pandas/tests/test_downstream.py"
- name: "Minimum Versions"
env_file: actions-39-minimum_versions.yaml
env_file: actions-310-minimum_versions.yaml
pattern: "not slow and not network and not single_cpu"
- name: "Locale: it_IT"
env_file: actions-311.yaml
Expand Down Expand Up @@ -146,6 +146,8 @@ jobs:
- name: Build Pandas
id: build
uses: ./.github/actions/build_pandas
# TODO: Re-enable once Pypy has Pypy 3.10 on conda-forge
if: ${{ matrix.name != 'Pypy' }}
with:
meson_args: ${{ matrix.meson_args }}
cflags_adds: ${{ matrix.cflags_adds }}
Expand All @@ -170,7 +172,7 @@ jobs:
matrix:
# Note: Don't use macOS latest since macos 14 appears to be arm64 only
os: [macos-13, macos-14, windows-latest]
env_file: [actions-39.yaml, actions-310.yaml, actions-311.yaml, actions-312.yaml]
env_file: [actions-310.yaml, actions-311.yaml, actions-312.yaml]
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ format('{0} {1}', matrix.os, matrix.env_file) }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- [macos-14, macosx_arm64]
- [windows-2022, win_amd64]
# TODO: support PyPy?
python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
env:
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ repos:
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py39-plus]
args: [--py310-plus]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: pandas-dev
channels:
- conda-forge
dependencies:
- python=3.9
- python=3.10

# build dependencies
- versioneer[toml]
Expand Down
63 changes: 0 additions & 63 deletions ci/deps/actions-39.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion doc/source/development/contributing_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
pyenv virtualenv <version> <name-to-give-it>
# For instance:
pyenv virtualenv 3.9.10 pandas-dev
pyenv virtualenv 3.10 pandas-dev
# Activate the virtualenv
pyenv activate pandas-dev
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Python terminal.
>>> import pandas as pd
>>> pd.test()
running: pytest -m "not slow and not network and not db" /home/user/anaconda3/lib/python3.9/site-packages/pandas
running: pytest -m "not slow and not network and not db" /home/user/anaconda3/lib/python3.10/site-packages/pandas
============================= test session starts ==============================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
Expand Down
5 changes: 5 additions & 0 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ In cases with mixed-resolution inputs, the highest resolution is used:
.. _whatsnew_300.api_breaking.deps:

Increased minimum version for Python
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

pandas 3.0.0 supports Python 3.10 and higher.

Increased minimum versions for dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some minimum supported versions of dependencies were updated.
Expand Down
2 changes: 1 addition & 1 deletion pandas/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
from typing import (
TYPE_CHECKING,
Any,
Callable,
NamedTuple,
cast,
)
Expand All @@ -66,6 +65,7 @@

if TYPE_CHECKING:
from collections.abc import (
Callable,
Generator,
Sequence,
)
Expand Down
3 changes: 2 additions & 1 deletion pandas/_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from sys import byteorder
from typing import (
TYPE_CHECKING,
Callable,
ContextManager,
cast,
)
Expand Down Expand Up @@ -85,6 +84,8 @@
from pandas.core.construction import extract_array

if TYPE_CHECKING:
from collections.abc import Callable

from pandas._typing import (
Dtype,
NpDtype,
Expand Down
15 changes: 8 additions & 7 deletions pandas/_testing/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@
from typing import (
TYPE_CHECKING,
Any,
Callable,
)
import uuid
import zipfile

from pandas.compat import (
get_bz2_file,
get_lzma_file,
)
from pandas.compat._optional import import_optional_dependency

import pandas as pd
from pandas._testing.contexts import ensure_clean

if TYPE_CHECKING:
from collections.abc import Callable

from pandas._typing import (
FilePath,
ReadPickleBuffer,
Expand Down Expand Up @@ -129,11 +126,15 @@ def write_to_compressed(compression, path, data, dest: str = "test") -> None:
elif compression == "gzip":
compress_method = gzip.GzipFile
elif compression == "bz2":
compress_method = get_bz2_file()
import bz2

compress_method = bz2.BZ2File
elif compression == "zstd":
compress_method = import_optional_dependency("zstandard").open
elif compression == "xz":
compress_method = get_lzma_file()
import lzma

compress_method = lzma.LZMAFile
else:
raise ValueError(f"Unrecognized compression type: {compression}")

Expand Down
20 changes: 7 additions & 13 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from collections.abc import (
Callable,
Hashable,
Iterator,
Mapping,
Expand All @@ -18,7 +19,6 @@
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
Optional,
Protocol,
Expand Down Expand Up @@ -90,18 +90,12 @@
# Name "npt._ArrayLikeInt_co" is not defined [name-defined]
NumpySorter = Optional[npt._ArrayLikeInt_co] # type: ignore[name-defined]

from typing import SupportsIndex

if sys.version_info >= (3, 10):
from typing import Concatenate # pyright: ignore[reportUnusedImport]
from typing import ParamSpec
from typing import TypeGuard # pyright: ignore[reportUnusedImport]
else:
from typing_extensions import ( # pyright: ignore[reportUnusedImport]
Concatenate,
ParamSpec,
TypeGuard,
)
from typing import (
ParamSpec,
SupportsIndex,
)
from typing import Concatenate # pyright: ignore[reportUnusedImport]
from typing import TypeGuard # pyright: ignore[reportUnusedImport]

P = ParamSpec("P")

Expand Down
2 changes: 1 addition & 1 deletion pandas/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

"""Git implementation of _version.py."""

from collections.abc import Callable
import errno
import functools
import os
import re
import subprocess
import sys
from typing import Callable


def get_keywords():
Expand Down
49 changes: 0 additions & 49 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
from pandas.compat._constants import (
IS64,
ISMUSL,
PY310,
PY311,
PY312,
PYPY,
WASM,
)
import pandas.compat.compressors
from pandas.compat.numpy import is_numpy_dev
from pandas.compat.pyarrow import (
pa_version_under10p1,
Expand Down Expand Up @@ -148,52 +146,6 @@ def is_ci_environment() -> bool:
return os.environ.get("PANDAS_CI", "0") == "1"


def get_lzma_file() -> type[pandas.compat.compressors.LZMAFile]:
"""
Importing the `LZMAFile` class from the `lzma` module.
Returns
-------
class
The `LZMAFile` class from the `lzma` module.
Raises
------
RuntimeError
If the `lzma` module was not imported correctly, or didn't exist.
"""
if not pandas.compat.compressors.has_lzma:
raise RuntimeError(
"lzma module not available. "
"A Python re-install with the proper dependencies, "
"might be required to solve this issue."
)
return pandas.compat.compressors.LZMAFile


def get_bz2_file() -> type[pandas.compat.compressors.BZ2File]:
"""
Importing the `BZ2File` class from the `bz2` module.
Returns
-------
class
The `BZ2File` class from the `bz2` module.
Raises
------
RuntimeError
If the `bz2` module was not imported correctly, or didn't exist.
"""
if not pandas.compat.compressors.has_bz2:
raise RuntimeError(
"bz2 module not available. "
"A Python re-install with the proper dependencies, "
"might be required to solve this issue."
)
return pandas.compat.compressors.BZ2File


__all__ = [
"is_numpy_dev",
"pa_version_under10p1",
Expand All @@ -204,7 +156,6 @@ def get_bz2_file() -> type[pandas.compat.compressors.BZ2File]:
"pa_version_under16p0",
"IS64",
"ISMUSL",
"PY310",
"PY311",
"PY312",
"PYPY",
Expand Down
Loading

0 comments on commit a5e812d

Please sign in to comment.