Skip to content

Commit 02f87ce

Browse files
authored
Drop python 3.9 support (#930)
* Drop py3.9 support * Fix lint issues * Upgrade ruff hook and fix lint issues
1 parent aea611d commit 02f87ce

File tree

14 files changed

+28
-83
lines changed

14 files changed

+28
-83
lines changed

.github/workflows/codspeed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1717
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
1818
with:
19-
python-version: "3.9"
19+
python-version: "3.10"
2020

2121
- name: Get full Python version
2222
id: full-python-version

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ jobs:
2121
platform: linux
2222
- os: windows
2323
ls: dir
24-
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11
24+
interpreter: 3.10 3.11 3.12 3.13 3.14 pypy3.11
2525
- os: windows
2626
ls: dir
2727
target: aarch64
2828
interpreter: 3.11 3.12 3.13 3.14
2929
- os: macos
3030
target: aarch64
31-
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11
31+
interpreter: 3.10 3.11 3.12 3.13 3.14 pypy3.11
3232
- os: ubuntu
3333
platform: linux
3434
target: aarch64
@@ -44,11 +44,11 @@ jobs:
4444
- os: ubuntu
4545
platform: linux
4646
target: ppc64le
47-
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14
47+
interpreter: 3.10 3.11 3.12 3.13 3.14
4848
- os: ubuntu
4949
platform: linux
5050
target: s390x
51-
interpreter: 3.9 3.10 3.11 3.12 3.13 3.14
51+
interpreter: 3.10 3.11 3.12 3.13 3.14
5252

5353
runs-on: ${{ matrix.os }}-latest
5454
steps:
@@ -66,7 +66,7 @@ jobs:
6666
target: ${{ matrix.target }}
6767
manylinux: ${{ matrix.manylinux || 'auto' }}
6868
container: ${{ matrix.container }}
69-
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' }} ${{ matrix.extra-build-args }}
69+
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.10 3.11 3.12 3.13 3.14 pypy3.11' }} ${{ matrix.extra-build-args }}
7070
rust-toolchain: stable
7171
docker-options: -e CI
7272

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
os: [Ubuntu, MacOS, Windows]
36-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
36+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3737
defaults:
3838
run:
3939
shell: bash

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: debug-statements
1313

1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.11.2
15+
rev: v0.14.11
1616
hooks:
1717
- id: ruff
1818
- id: ruff-format

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Pendulum
1313

1414
Python datetimes made easy.
1515

16-
Supports Python **3.9 and newer**.
16+
Supports Python **3.10 and newer**.
1717

1818

1919
.. code-block:: python

poetry.lock

Lines changed: 5 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ name = "pendulum"
33
version = "3.2.0"
44
description = "Python datetimes made easy"
55
readme = "README.rst"
6-
requires-python = ">=3.9"
6+
requires-python = ">=3.10"
77
license = { text = "MIT License" }
88
authors = [{ name = "Sébastien Eustace", email = "sebastien@eustace.io" }]
99
keywords = ['datetime', 'date', 'time']
1010
classifiers = [
1111
"License :: OSI Approved :: MIT License",
1212
"Programming Language :: Python :: 3",
13-
"Programming Language :: Python :: 3.9",
1413
"Programming Language :: Python :: 3.10",
1514
"Programming Language :: Python :: 3.11",
1615
"Programming Language :: Python :: 3.12",
@@ -72,7 +71,7 @@ include = [
7271
[tool.ruff]
7372
fix = true
7473
line-length = 88
75-
target-version = "py39"
74+
target-version = "py310"
7675
extend-exclude = [
7776
# External to the project's coding standards:
7877
"docs/*",

src/pendulum/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from functools import cache
66
from typing import TYPE_CHECKING
77
from typing import Any
8-
from typing import Union
98
from typing import cast
109
from typing import overload
1110

@@ -117,7 +116,7 @@ def _safe_timezone(
117116

118117
obj = int(offset.total_seconds())
119118

120-
obj = cast("Union[str, int]", obj)
119+
obj = cast("str | int", obj)
121120

122121
return timezone(obj)
123122

src/pendulum/datetime.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
from typing import TYPE_CHECKING
88
from typing import Any
9-
from typing import Callable
109
from typing import ClassVar
11-
from typing import Optional
1210
from typing import cast
1311
from typing import overload
1412

@@ -42,7 +40,9 @@
4240

4341

4442
if TYPE_CHECKING:
45-
from typing_extensions import Literal
43+
from collections.abc import Callable
44+
from typing import Literal
45+
4646
from typing_extensions import Self
4747
from typing_extensions import SupportsIndex
4848

@@ -1006,7 +1006,7 @@ def nth_of(self, unit: str, nth: int, day_of_week: WeekDay) -> Self:
10061006
if unit not in ["month", "quarter", "year"]:
10071007
raise ValueError(f'Invalid unit "{unit}" for first_of()')
10081008

1009-
dt = cast("Optional[Self]", getattr(self, f"_nth_of_{unit}")(nth, day_of_week))
1009+
dt = cast("Self | None", getattr(self, f"_nth_of_{unit}")(nth, day_of_week))
10101010
if not dt:
10111011
raise PendulumException(
10121012
f"Unable to find occurrence {nth}"

src/pendulum/formatting/formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from re import Match
77
from typing import TYPE_CHECKING
88
from typing import Any
9-
from typing import Callable
109
from typing import ClassVar
1110
from typing import cast
1211

@@ -16,6 +15,7 @@
1615

1716

1817
if TYPE_CHECKING:
18+
from collections.abc import Callable
1919
from collections.abc import Sequence
2020

2121
from pendulum import Timezone

0 commit comments

Comments
 (0)