Skip to content

Commit 08670e5

Browse files
committed
Add Python 3.14 support and remove 3.8 support
* Remove @cache substitute decorator since 3.8 is EOL * Replace usages with 3.9's functools.cache * Remove tests for functools.cache * Update to Pillow 12.0.0 * Update the pyproject.toml's version tag info * Update build script helpers to remove mention of 3.8 * Add 3.14 to the GitHub actions config for tests
1 parent 52bacdf commit 08670e5

File tree

10 files changed

+14
-35
lines changed

10 files changed

+14
-35
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
# 2. Avoid forward referencing whenever possible
2626
strategy:
2727
matrix:
28-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
28+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
2929
architecture: ['x64']
3030
os: [ 'ubuntu-latest' ]
3131

DOCKER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ I've found two options:
6565

6666
* [act][], a golang utility with some rough edges
6767
* Whatever [Red Hat is doing][] with a heavy-looking pair of JS-based repos
68-
(haven't tried this)
68+
(haven't tried this)

container.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# Helper script to kick off install & run tests.
33

44
# This is run separately from the main container build because it can
5-
# break before the test suite does under 3.8.
5+
# break before the test suite under some Python versions.
66
python -m pip install -e .[dev]
7-
pytest tests
7+
pytest tests

fontknife/colors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from functools import cache
12
from typing import (
23
Dict,
34
FrozenSet,
@@ -9,7 +10,7 @@
910

1011

1112
from fontknife.custom_types import ColorMode, ModeRGBA, ModeRGB, ModeL, Mode1, ModeAny
12-
from fontknife.utils import cache, steps
13+
from fontknife.utils import steps
1314

1415
MODE_TO_BYTE_SIZE: Dict[ColorMode, int] = {
1516
ModeRGBA: 4,

fontknife/iohelpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
from collections import deque
55
from collections.abc import Mapping as MappingABC
66
from contextlib import ExitStack
7+
from functools import cache
78
from io import BytesIO, TextIOWrapper
89
from pathlib import Path
910
from typing import Optional, Tuple, Iterable, Union, Mapping, Callable, Any, BinaryIO, TypeVar
1011

1112
from fontknife.custom_types import PathLike, HasReadline, HasWrite, PathLikeOrHasRead, HasRead, PathLikeOrHasStreamFunc
12-
from fontknife.utils import cache, value_of_first_attribute_present
13+
from fontknife.utils import value_of_first_attribute_present
1314

1415

1516
PairTypeStr = Tuple[type, str]

fontknife/octo/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
from functools import cache
12
from collections import deque
23
from math import log
34
from typing import Iterable, Optional
45

5-
from fontknife.utils import cache, ordered_calc_missing
6+
from fontknife.utils import ordered_calc_missing
67
from fontknife.formats import RasterFont
78
from fontknife.iohelpers import OutputHelper, padded_hex, exit_error
89
from fontknife.custom_types import HasWrite, GlyphSequence, MissingGlyphError

fontknife/utils.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from typing import Iterable, Tuple, Dict, Optional, Any, Callable, Union, Mapping, overload, TypeVar, Hashable, \
88
Pattern, Generator, MutableMapping, List, AbstractSet as SetABC
99
from collections.abc import Mapping as MappingABC
10-
from functools import lru_cache as _lru_cache
1110

1211
from PIL import Image, ImageDraw
1312

@@ -21,12 +20,6 @@
2120
)
2221

2322

24-
# Compatibility: functools.cache was only added in 3.9
25-
# https://docs.python.org/3/library/functools.html#functools.cache
26-
def cache(fn: Callable):
27-
return _lru_cache(maxsize=None)(fn)
28-
29-
3023
def dashes_to_underscores(s: str) -> str:
3124
return s.replace('-', '_')
3225

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ classifiers=[
1616
"Programming Language :: Python :: 3.11",
1717
"Programming Language :: Python :: 3.12",
1818
"Programming Language :: Python :: 3.13",
19+
"Programming Language :: Python :: 3.14",
1920
"License :: OSI Approved :: MIT License",
2021
"Operating System :: OS Independent",
2122
"Intended Audience :: Developers",
@@ -30,7 +31,7 @@ classifiers=[
3031
"Topic :: Software Development :: Libraries",
3132
]
3233
dependencies = [
33-
'Pillow~=11.1.0',
34+
'Pillow~=12.0.0',
3435
'regex~=2024.11.6', # Provides unicode grapheme support
3536
'typing_extensions',
3637
'types-regex~=2024.11.6.20241221'

test_in_docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ error() {
3333
if [[ "$1" == '--help' ]]; then
3434
Usage
3535
exit 0
36-
elif [[ "$1" =~ ^3\.(8|9|10|11|12) ]]; then
36+
elif [[ "$1" =~ ^3\.(9|10|11|12|13|14) ]]; then
3737
PYTHON_VERSION="$1"
3838
else
39-
error "Expected a PYTHON_VERSION or --help"
39+
error "Expected a supported PYTHON_VERSION or --help"
4040
exit 1
4141
fi
4242

tests/utils/test_3_8_cache_fix.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)