Skip to content

Commit ef91e15

Browse files
committed
Upgrade to Python 3.12
Drop 3.10 & 3.11 Apply Ruff updates Remove old hacks Update requirements to match current usage: - Just say Python 3, active versions are always supported - Remove libsdl mention, this gets bundled in wheels - Update MacOS to match current wheels
1 parent 4e50c13 commit ef91e15

18 files changed

Lines changed: 56 additions & 73 deletions

‎.github/workflows/python-package.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ jobs:
109109
strategy:
110110
matrix:
111111
os: ["ubuntu-latest", "windows-latest"]
112-
python-version: ["3.10", "3.14t", "pypy-3.10"]
112+
python-version: ["3.12", "3.14t", "pypy-3.12"]
113113
architecture: ["x64"]
114114
include:
115115
- os: "windows-latest"
116-
python-version: "3.10"
116+
python-version: "3.12"
117117
architecture: "x86"
118118
- os: "windows-latest"
119119
python-version: "3.14t"
120120
architecture: "x86"
121121
- os: "windows-11-arm"
122-
python-version: "3.11"
122+
python-version: "3.12"
123123
architecture: "arm64"
124124
- os: "windows-11-arm"
125125
python-version: "3.14t"
@@ -239,7 +239,7 @@ jobs:
239239
strategy:
240240
matrix:
241241
arch: ["x86_64", "aarch64"]
242-
build: ["cp310-manylinux*", "pp311-manylinux*", "cp314t-manylinux*"]
242+
build: ["cp312-manylinux*", "pp312-manylinux*", "cp314t-manylinux*"]
243243
env:
244244
BUILD_DESC: ""
245245
steps:
@@ -296,7 +296,7 @@ jobs:
296296
strategy:
297297
fail-fast: true
298298
matrix:
299-
python: ["cp310-*_universal2", "cp314t-*_universal2", "pp311-*"]
299+
python: ["cp312-*_universal2", "cp314t-*_universal2", "pp312-*"]
300300
env:
301301
PYTHON_DESC: ""
302302
steps:

‎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+
- Dropped support for Python 3.10 & 3.11.
12+
913
## [21.2.5] - 2026-11-21
1014

1115
### Changed

‎README.rst‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ For the most part it's just::
4646
==============
4747
Requirements
4848
==============
49-
* Python 3.10+
50-
* Windows, Linux, or MacOS X 10.9+.
51-
* On Linux, requires libsdl3
49+
* Python 3
50+
* Windows, Linux, or MacOS X 10.15+.
5251

5352
===========
5453
Changelog

‎build_libtcod.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
if TYPE_CHECKING:
3030
from collections.abc import Iterable, Iterator
3131

32-
Py_LIMITED_API: int | None = 0x03100000
32+
Py_LIMITED_API: int | None = 0x03120000
3333

3434
HEADER_PARSE_PATHS = ("tcod/", "libtcod/src/libtcod/")
3535
HEADER_PARSE_EXCLUDES = ("gl2_ext_.h", "renderer_gl_internal.h", "event.h")
@@ -227,7 +227,7 @@ def walk_sources(directory: str) -> Iterator[str]:
227227
for include in includes:
228228
try:
229229
ffi.cdef(include.header)
230-
except Exception: # noqa: PERF203
230+
except Exception:
231231
# Print the source, for debugging.
232232
print(f"Error with: {include.path}")
233233
for i, line in enumerate(include.header.split("\n"), 1):

‎build_sdl.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ def check_sdl_version() -> None:
168168
)
169169
raise RuntimeError(msg) from exc
170170
except subprocess.CalledProcessError as exc:
171-
if sys.version_info >= (3, 11):
172-
exc.add_note(f"Note: {os.environ.get('PKG_CONFIG_PATH')=}")
171+
exc.add_note(f"Note: {os.environ.get('PKG_CONFIG_PATH')=}")
173172
raise
174173
logger.info(f"Found SDL {sdl_version_str}.")
175174
sdl_version = tuple(int(s) for s in sdl_version_str.split("."))

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dynamic = ["version"]
2121
description = "The official Python port of libtcod."
2222
authors = [{ name = "Kyle Benesch", email = "4b796c65+tcod@gmail.com" }]
2323
readme = "README.rst"
24-
requires-python = ">=3.10"
24+
requires-python = ">=3.12"
2525
license = "BSD-2-Clause"
2626
license-files = [
2727
"LICENSE.txt",

‎scripts/tag_release.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def parse_changelog(args: argparse.Namespace) -> tuple[str, str]:
3636
assert match
3737
header, changes, tail = match.groups()
3838

39-
iso_date = datetime.datetime.now(tz=datetime.timezone.utc).date().isoformat()
39+
iso_date = datetime.datetime.now(tz=datetime.UTC).date().isoformat()
4040
tagged = f"\n## [{args.tag}] - {iso_date}\n{changes}"
4141
if args.verbose:
4242
print("--- Tagged section:")

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_package_data() -> list[str]:
4242

4343
options = {
4444
"bdist_wheel": {
45-
"py_limited_api": "cp310",
45+
"py_limited_api": "cp312",
4646
}
4747
}
4848
if "free-threading build" in sys.version:

‎tcod/_internal.py‎

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

2020
FuncType = Callable[..., Any]
2121
F = TypeVar("F", bound=FuncType)
22-
T = TypeVar("T")
2322

2423

2524
def _deprecate_passthrough(
@@ -61,7 +60,7 @@ def _check(error: int) -> int:
6160
return error
6261

6362

64-
def _check_p(pointer: T) -> T:
63+
def _check_p[T](pointer: T) -> T:
6564
"""Treats NULL pointers as errors and raises a libtcod exception."""
6665
if not pointer:
6766
_raise_tcod_error()
@@ -94,13 +93,13 @@ def _int(int_or_str: SupportsInt | str | bytes) -> int:
9493
return int(int_or_str)
9594

9695

97-
def _bytes(string: AnyStr) -> bytes:
96+
def _bytes(string: AnyStr) -> bytes: # noqa: UP047
9897
if isinstance(string, str):
9998
return string.encode("utf-8")
10099
return string
101100

102101

103-
def _unicode(string: AnyStr, stacklevel: int = 2) -> str:
102+
def _unicode(string: AnyStr, stacklevel: int = 2) -> str: # noqa: UP047
104103
if isinstance(string, bytes):
105104
warnings.warn(
106105
"Passing byte strings as parameters to Unicode functions is deprecated.",
@@ -129,8 +128,7 @@ def _path_encode(path: Path) -> bytes:
129128
try:
130129
return str(path).encode(locale.getlocale()[1] or "utf-8") # Stay classy, Windows
131130
except UnicodeEncodeError as exc:
132-
if sys.version_info >= (3, 11):
133-
exc.add_note("""Consider calling 'locale.setlocale(locale.LC_CTYPES, ".UTF8")' to support Unicode paths.""")
131+
exc.add_note("""Consider calling 'locale.setlocale(locale.LC_CTYPES, ".UTF8")' to support Unicode paths.""")
134132
raise
135133

136134

‎tcod/console.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
import warnings
1111
from pathlib import Path
12-
from typing import TYPE_CHECKING, Any, Literal, overload
12+
from typing import TYPE_CHECKING, Any, Literal, Self, overload
1313

1414
import numpy as np
15-
from typing_extensions import Self, deprecated
15+
from typing_extensions import deprecated
1616

1717
import tcod._internal
1818
import tcod.constants

0 commit comments

Comments
 (0)