Skip to content

Commit 9c90c76

Browse files
authored
Add support for Python 3.14 (#206)
* Add support for Python 3.14 * Add support for Python 3.14 t-strings and resolve codec deprecations
1 parent 42d07e9 commit 9c90c76

File tree

16 files changed

+85
-35
lines changed

16 files changed

+85
-35
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
max-parallel: 5
1818
matrix:
1919
platform: [ubuntu-latest] #, windows-latest]
20-
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
20+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13, 3.14]
2121
include:
2222
- python-version: 3.9
2323
continue-on-error: false
@@ -29,6 +29,8 @@ jobs:
2929
continue-on-error: false
3030
- python-version: 3.13
3131
continue-on-error: false
32+
- python-version: 3.14
33+
continue-on-error: false
3234
# exclude:
3335
# - platform: windows-latest
3436
# python-version: 3.9

docs/src/markdown/about/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
dictionary already exists. Changes to a custom dictionary will be ignored.
77
- **NEW**: Drop support for Python 3.8.
88
- **NEW**: Add official support for Python 3.13.
9+
- **NEW**: Add official support for Python 3.14.
10+
- **NEW**: Python filter is now aware of Python 3.14+ t-strings.
911

1012
## 2.10
1113

docs/src/markdown/filters/python.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ types are `b` for bytes, `f` for format, `u` for Unicode, and `r` for raw. `f`
4646
form `#!py3 "my string {}".format(value)"`, and though f-strings are Unicode, they are treated as a separate string type
4747
from Unicode. Case is not important, and the default value is `fu`.
4848

49-
If specifying `r`, you must also specify either `u`, `b`, or `f` as raw strings are also either `u`, `b`, or `f`
50-
strings. Selecting `ur` will select both Unicode strings and Unicode raw strings. If you need to target just raw
49+
If specifying `r`, you must also specify either `u`, `b`, `f`, or `t` as raw strings are also either `u`, `b`, `f`, or
50+
`t` strings. Selecting `ur` will select both Unicode strings and Unicode raw strings. If you need to target just raw
5151
strings, you can use `r*` which will target all raw strings types: raw Unicode, raw format, and raw bytes. You can use
5252
`*` for other types as well. You can also just specify `*` by itself to target all string types.
5353

54+
/// new | New in 2.11
55+
Template string support was added in 2.11 and is only available for Python 3.14+.
56+
///
57+
5458
## Options
5559

5660
Options | Type | Default | Description
@@ -60,7 +64,7 @@ Options | Type | Default | Description
6064
`group_comments` | bool | `#!py3 False` | Group consecutive Python comments as one `SourceText` entry.
6165
`decode_escapes` | bool | `#!py3 True` | Decode escapes and strip out format variables. Behavior is based on the string type that is encountered. This affects both docstrings and non-docstrings.
6266
`strings` | string | `#!py3 False` | Return `SourceText` entries for each string (non-docstring).
63-
`string_types` | string | `#!py3 fu` | Specifies which string types `strings` searches: bytes (`b`), format (`f`), raw (`r`), and Unicode (`u`). `*` captures all strings, or when used with a type, captures all variants of that type `r*`. This does not affect docstrings. When `docstrings` is enabled, all docstrings are parsed.
67+
`string_types` | string | `#!py3 'ftu'` | Specifies which string types `strings` searches: bytes (`b`), format (`f`), template (`t`), raw (`r`), and Unicode (`u`). `*` captures all strings, or when used with a type, captures all variants of that type `r*`. This does not affect docstrings. When `docstrings` is enabled, all docstrings are parsed.
6468

6569
## Categories
6670

hatch_build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def update(self, metadata):
3434
'Programming Language :: Python :: 3.11',
3535
'Programming Language :: Python :: 3.12',
3636
'Programming Language :: Python :: 3.13',
37+
'Programming Language :: Python :: 3.14',
3738
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3839
'Topic :: Software Development :: Libraries :: Python Modules'
3940
]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ legacy_tox_ini = """
121121
[tox]
122122
isolated_build = true
123123
envlist =
124-
py39,py310,py311,py312,py313,lint
124+
py39,py310,py311,py312,py313,py314,lint
125125
126126
[testenv]
127127
passenv = LANG,TOX_SPELL_PATH,TOX_SPELL_REQUIRE,HOME

pyspelling/filters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def header_check(self, content):
238238
def filter(self, source_file, encoding): # noqa A001
239239
"""Open and filter the file from disk."""
240240

241-
with codecs.open(source_file, 'r', encoding=encoding) as f:
241+
with open(source_file, 'r', encoding=encoding, errors='strict') as f:
242242
text = f.read()
243243
return [SourceText(text, source_file, encoding, 'text')]
244244

pyspelling/filters/context.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Text parser."""
22
from .. import filters
33
from .. import util
4-
import codecs
54
import re
65
from collections import OrderedDict
76

@@ -77,7 +76,7 @@ def setup(self):
7776
def filter(self, source_file, encoding): # noqa A001
7877
"""Parse file."""
7978

80-
with codecs.open(source_file, 'r', encoding=encoding) as f:
79+
with open(source_file, 'r', encoding=encoding, errors='strict') as f:
8180
text = f.read()
8281

8382
return [filters.SourceText(self._filter(text), source_file, encoding, 'context')]

pyspelling/filters/cpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def _filter(self, text, context, encoding):
445445
def filter(self, source_file, encoding): # noqa A001
446446
"""Parse CPP file."""
447447

448-
with codecs.open(source_file, 'r', encoding=encoding) as f:
448+
with open(source_file, 'r', encoding=encoding, errors='strict') as f:
449449
text = f.read()
450450

451451
return self._filter(text, source_file, encoding)

pyspelling/filters/javascript.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""JavaScript filter."""
22
import re
33
import textwrap
4-
import codecs
54
from .. import filters
65

76
RE_JSDOC = re.compile(r"(?s)^/\*\*$(.*?)[ \t]*\*/", re.MULTILINE)
@@ -282,7 +281,7 @@ def _filter(self, text, context, encoding):
282281
def filter(self, source_file, encoding): # noqa A001
283282
"""Parse JavaScript file."""
284283

285-
with codecs.open(source_file, 'r', encoding=encoding) as f:
284+
with open(source_file, 'r', encoding=encoding, errors='strict') as f:
286285
text = f.read()
287286

288287
return self._filter(text, source_file, encoding)

pyspelling/filters/markdown.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Markdown filter."""
22
from .. import filters
3-
import codecs
43
import markdown
54

65

@@ -37,7 +36,7 @@ def setup(self):
3736
def filter(self, source_file, encoding): # noqa A001
3837
"""Parse Markdown file."""
3938

40-
with codecs.open(source_file, 'r', encoding=encoding) as f:
39+
with open(source_file, 'r', encoding=encoding, errors='strict') as f:
4140
text = f.read()
4241
return [filters.SourceText(self._filter(text), source_file, encoding, 'markdown')]
4342

0 commit comments

Comments
 (0)