Skip to content

Commit 4ffca36

Browse files
committed
Drop Python 3.8 and 3.9 support
Apply Ruff safe fixes
1 parent 01ddb08 commit 4ffca36

30 files changed

+117
-110
lines changed

.github/workflows/python-package.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ jobs:
9595
strategy:
9696
matrix:
9797
os: ["ubuntu-latest", "windows-latest"]
98-
python-version: ["3.8", "pypy-3.8"]
98+
python-version: ["3.10", "pypy-3.10"]
9999
architecture: ["x64"]
100100
include:
101101
- os: "windows-latest"
102-
python-version: "3.8"
102+
python-version: "3.10"
103103
architecture: "x86"
104104
- os: "windows-latest"
105-
python-version: "pypy-3.8"
105+
python-version: "pypy-3.10"
106106
architecture: "x86"
107107
fail-fast: false
108108

@@ -215,9 +215,9 @@ jobs:
215215
strategy:
216216
matrix:
217217
arch: ["x86_64", "aarch64"]
218-
build: ["cp38-manylinux*", "pp38-manylinux*"]
218+
build: ["cp310-manylinux*", "pp310-manylinux*"]
219219
env:
220-
BUILD_DESC:
220+
BUILD_DESC: ""
221221
steps:
222222
- uses: actions/checkout@v4
223223
with:
@@ -272,9 +272,9 @@ jobs:
272272
strategy:
273273
fail-fast: true
274274
matrix:
275-
python: ["cp38-*_universal2", "pp38-*"]
275+
python: ["cp310-*_universal2", "pp310-*"]
276276
env:
277-
PYTHON_DESC:
277+
PYTHON_DESC: ""
278278
steps:
279279
- uses: actions/checkout@v4
280280
with:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- id: fix-byte-order-marker
1818
- id: detect-private-key
1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.11.8
20+
rev: v0.11.11
2121
hooks:
2222
- id: ruff
2323
args: [--fix-only, --exit-non-zero-on-fix]

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version
66

77
## [Unreleased]
88

9+
### Removed
10+
11+
- Support dropped for Python 3.8 and 3.9.
12+
913
## [18.1.0] - 2025-05-05
1014

1115
### Added

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ For the most part it's just::
4646
==============
4747
Requirements
4848
==============
49-
* Python 3.8+
49+
* Python 3.10+
5050
* Windows, Linux, or MacOS X 10.9+.
5151
* On Linux, requires libsdl2 (2.0.10+).
5252

build_libtcod.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
import platform
1010
import re
1111
import sys
12+
from collections.abc import Iterable, Iterator
1213
from pathlib import Path
13-
from typing import Any, ClassVar, Iterable, Iterator
14+
from typing import Any, ClassVar
1415

1516
from cffi import FFI
1617

@@ -20,7 +21,7 @@
2021

2122
import build_sdl
2223

23-
Py_LIMITED_API = 0x03060000
24+
Py_LIMITED_API = 0x03100000
2425

2526
HEADER_PARSE_PATHS = ("tcod/", "libtcod/src/libtcod/")
2627
HEADER_PARSE_EXCLUDES = ("gl2_ext_.h", "renderer_gl_internal.h", "event.h")

examples/eventget.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# https://creativecommons.org/publicdomain/zero/1.0/
66
"""An demonstration of event handling using the tcod.event module."""
77

8-
from typing import List, Set
9-
108
import tcod.context
119
import tcod.event
1210
import tcod.sdl.joystick
@@ -17,11 +15,11 @@
1715

1816
def main() -> None:
1917
"""Example program for tcod.event."""
20-
event_log: List[str] = []
18+
event_log: list[str] = []
2119
motion_desc = ""
2220
tcod.sdl.joystick.init()
23-
controllers: Set[tcod.sdl.joystick.GameController] = set()
24-
joysticks: Set[tcod.sdl.joystick.Joystick] = set()
21+
controllers: set[tcod.sdl.joystick.GameController] = set()
22+
joysticks: set[tcod.sdl.joystick.Joystick] = set()
2523

2624
with tcod.context.new(width=WIDTH, height=HEIGHT) as context:
2725
console = context.new_console()

examples/framerate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import statistics
99
import time
1010
from collections import deque
11-
from typing import Deque, Optional
1211

1312
import tcod
1413

@@ -25,11 +24,11 @@ class Clock:
2524
def __init__(self) -> None:
2625
"""Initialize this object with empty data."""
2726
self.last_time = time.perf_counter() # Last time this was synced.
28-
self.time_samples: Deque[float] = deque() # Delta time samples.
27+
self.time_samples: deque[float] = deque() # Delta time samples.
2928
self.max_samples = 64 # Number of fps samples to log. Can be changed.
3029
self.drift_time = 0.0 # Tracks how much the last frame was overshot.
3130

32-
def sync(self, fps: Optional[float] = None) -> float:
31+
def sync(self, fps: float | None = None) -> float:
3332
"""Sync to a given framerate and return the delta time.
3433
3534
`fps` is the desired framerate in frames-per-second. If None is given

examples/samples_tcod.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ def on_draw(self) -> None:
12091209
# new pixels are based on absolute elapsed time
12101210
int_abs_t = int(self.abs_t)
12111211

1212-
texture = np.roll(texture, -int_t, 1)
1212+
texture = np.roll(texture, -int_t, 1) # type: ignore[assignment]
12131213
# replace new stretch of texture with new values
12141214
for v in range(RES_V - int_t, RES_V):
12151215
for u in range(RES_U):

examples/thread_jobs.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import platform
2020
import sys
2121
import timeit
22-
from typing import Callable, List, Tuple
22+
from collections.abc import Callable
2323

2424
import tcod.map
2525

@@ -37,35 +37,35 @@ def test_fov(map_: tcod.map.Map) -> tcod.map.Map:
3737
return map_
3838

3939

40-
def test_fov_single(maps: List[tcod.map.Map]) -> None:
40+
def test_fov_single(maps: list[tcod.map.Map]) -> None:
4141
for map_ in maps:
4242
test_fov(map_)
4343

4444

45-
def test_fov_threads(executor: concurrent.futures.Executor, maps: List[tcod.map.Map]) -> None:
45+
def test_fov_threads(executor: concurrent.futures.Executor, maps: list[tcod.map.Map]) -> None:
4646
for _result in executor.map(test_fov, maps):
4747
pass
4848

4949

50-
def test_astar(map_: tcod.map.Map) -> List[Tuple[int, int]]:
50+
def test_astar(map_: tcod.map.Map) -> list[tuple[int, int]]:
5151
astar = tcod.path.AStar(map_)
5252
return astar.get_path(0, 0, MAP_WIDTH - 1, MAP_HEIGHT - 1)
5353

5454

55-
def test_astar_single(maps: List[tcod.map.Map]) -> None:
55+
def test_astar_single(maps: list[tcod.map.Map]) -> None:
5656
for map_ in maps:
5757
test_astar(map_)
5858

5959

60-
def test_astar_threads(executor: concurrent.futures.Executor, maps: List[tcod.map.Map]) -> None:
60+
def test_astar_threads(executor: concurrent.futures.Executor, maps: list[tcod.map.Map]) -> None:
6161
for _result in executor.map(test_astar, maps):
6262
pass
6363

6464

6565
def run_test(
66-
maps: List[tcod.map.Map],
67-
single_func: Callable[[List[tcod.map.Map]], None],
68-
multi_func: Callable[[concurrent.futures.Executor, List[tcod.map.Map]], None],
66+
maps: list[tcod.map.Map],
67+
single_func: Callable[[list[tcod.map.Map]], None],
68+
multi_func: Callable[[concurrent.futures.Executor, list[tcod.map.Map]], None],
6969
) -> None:
7070
"""Run a function designed for a single thread and compare it to a threaded version.
7171

examples/ttf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# To the extent possible under law, the libtcod maintainers have waived all
1010
# copyright and related or neighboring rights to this example script.
1111
# https://creativecommons.org/publicdomain/zero/1.0/
12-
from typing import TYPE_CHECKING, Tuple
12+
from typing import TYPE_CHECKING
1313

1414
import freetype # type: ignore # pip install freetype-py
1515
import numpy as np
@@ -25,7 +25,7 @@
2525
FONT = "VeraMono.ttf"
2626

2727

28-
def load_ttf(path: str, size: Tuple[int, int]) -> tcod.tileset.Tileset:
28+
def load_ttf(path: str, size: tuple[int, int]) -> tcod.tileset.Tileset:
2929
"""Load a TTF file and return a tcod Tileset.
3030
3131
`path` is the file path to the font, this can be any font supported by the

0 commit comments

Comments
 (0)