Skip to content

Commit 6d2e95c

Browse files
committed
DEP: drop support for Python 3.10
1 parent c7c3df7 commit 6d2e95c

12 files changed

Lines changed: 28 additions & 172 deletions

File tree

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5050
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
5151
with:
52-
python-version: '3.10'
52+
python-version: '3.11'
5353
enable-cache: true
5454
prune-cache: false
5555
cache-suffix: test-sdist

.github/workflows/check-pre-commit-hooks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
os:
3232
- ubuntu-latest
3333
python-version:
34-
- 3.10.0
34+
- '3.11'
3535
- '3.13'
3636
pre-commit-version:
3737
- 3.8.0 # minimal requirement for pre-commit-uv

.github/workflows/ci.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,18 @@ jobs:
1616
os:
1717
- ubuntu-latest
1818
python-version:
19-
- '3.11'
2019
- '3.12'
2120
- '3.13'
2221
include:
2322
- os: ubuntu-22.04
24-
python-version: 3.10.0
23+
python-version: '3.11'
2524
label: oldestdeps
2625
- os: macos-latest
27-
python-version: 3.10.0
26+
python-version: '3.11'
2827
- os: macos-latest
2928
python-version: '3.13'
3029
- os: windows-latest
31-
python-version: 3.10.0
30+
python-version: '3.11'
3231
- os: windows-latest
3332
python-version: '3.13'
3433

@@ -75,7 +74,7 @@ jobs:
7574
os:
7675
- ubuntu-latest
7776
python-version:
78-
- 3.10.0
77+
- '3.11'
7978
- '3.13'
8079
- 3.13t
8180

@@ -131,7 +130,7 @@ jobs:
131130
strategy:
132131
matrix:
133132
python-version:
134-
- '3.10'
133+
- '3.11'
135134
- '3.13'
136135
typechecker:
137136
- mypy

lib/inifix/pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ classifiers = [
1414
"Programming Language :: Python :: 3",
1515
"Typing :: Typed",
1616
]
17-
requires-python = ">=3.10"
18-
dependencies = [
19-
"exceptiongroup>=1.0.0 ; python_full_version < '3.11'",
20-
"typing-extensions>=4.2.0 ; python_full_version < '3.11'",
21-
]
17+
requires-python = ">=3.11"
18+
dependencies = []
2219

2320
[project.license]
2421
text = "GPL-3.0"

lib/inifix/src/inifix/_floatencoder.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import re
2-
import sys
32
from enum import Enum, auto
4-
5-
if sys.version_info >= (3, 11):
6-
from typing import assert_never
7-
else:
8-
from typing_extensions import assert_never
3+
from typing import assert_never
94

105
__all__ = ["FloatEncoder"]
116

lib/inifix/src/inifix/_validation.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
import re
2-
import sys
32
from enum import Enum, auto
4-
from typing import Literal
3+
from typing import Literal, assert_never
54

65
from inifix._typing import AnyConfig
76

8-
if sys.version_info >= (3, 11):
9-
from typing import assert_never
10-
else:
11-
from exceptiongroup import ExceptionGroup
12-
from typing_extensions import assert_never
13-
147
_PARAM_NAME_REGEXP = re.compile(r"[-\.\w]+")
158
SCALAR_TYPES = (int, float, bool, str)
169

lib/inifix/tests/test_schema_validation.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import sys
2-
31
import pytest
42
from pytest import RaisesExc, RaisesGroup
53

64
from inifix import dump, dumps, load, loads, validate_inifile_schema
75

86
from .utils import assert_dict_equal
97

10-
if sys.version_info < (3, 11):
11-
from exceptiongroup import ExceptionGroup
12-
138

149
def test_validate_known_files(inifile):
1510
conf = load(inifile)

pyproject.toml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ description = "A command line interface for inifix."
99
authors = [
1010
{ name = "C.M.T. Robert" },
1111
]
12-
requires-python = ">=3.10"
12+
requires-python = ">=3.11"
1313
dependencies = [
14-
"exceptiongroup>=1.0.0", # TDOO: remove when support for Python 3.10 is dropped
1514
"inifix==6.1.1",
1615
"typer-slim>=0.15.1",
1716
]
@@ -35,8 +34,7 @@ concurrency = [
3534
]
3635
covcheck = [
3736
{include-group = "test"},
38-
"coverage[toml]>=6.5.0 ; python_version == '3.10'",
39-
"coverage>=6.5.0 ; python_version >= '3.11'",
37+
"coverage>=6.5.0",
4038
]
4139
typecheck = [
4240
"basedpyright>=1.26.0",
@@ -104,15 +102,8 @@ reportUnreachable = false
104102
reportUnnecessaryIsInstance = false
105103
reportUnnecessaryComparison = false
106104

107-
# in some instances, pyright and basedpyright may conflict over a single line,
108-
# where e.g. pyright reports an error that I wish to ignore, but basedpyright
109-
# complains about an unused `# pyright: ignore[...]` comment
110-
# At the time of writing, it appears that this setting can be lifted once
111-
# Python 3.10 is unsupported
112-
reportUnnecessaryTypeIgnoreComment = false
113-
114105
[tool.mypy]
115-
python_version = "3.10"
106+
python_version = "3.11"
116107
strict = true
117108
show_error_codes = true
118109
show_error_context = true

scripts/pre_publish_checks.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# /// script
2-
# requires-python = ">=3.10"
2+
# requires-python = ">=3.11"
33
# dependencies = [
44
# "loguru==0.7.3",
55
# "packaging==24.2",
6-
# "tomli==2.2.1 ; python_version < '3.11'",
76
# ]
87
# ///
98
import re
109
import subprocess
1110
import sys
11+
import tomllib
1212
from dataclasses import dataclass
1313
from difflib import unified_diff
1414
from pathlib import Path
@@ -18,12 +18,6 @@
1818
from packaging.specifiers import Specifier
1919
from packaging.version import Version
2020

21-
if sys.version_info >= (3, 11):
22-
import tomllib
23-
else:
24-
import tomli as tomllib
25-
26-
2721
logger.remove()
2822
logger.add(sys.stderr, colorize=True, format="<level>{level:<5} {message}</level>")
2923

src/inifix_cli/__init__.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010
from textwrap import indent
1111
import inifix
1212

13-
# TODO: replace this with except* when support for Python 3.10 is dropped
14-
from exceptiongroup import catch, BaseExceptionGroup
15-
1613
if TYPE_CHECKING: # pragma: no cover
17-
from inifix._typing import AnyConfig # pyright: ignore[reportPrivateImportUsage]
14+
from inifix._typing import AnyConfig
1815

1916

2017
__all__ = ["app"]
@@ -39,7 +36,7 @@ def get_cpu_count() -> int:
3936
base_cpu_count = os.process_cpu_count()
4037
elif hasattr(os, "sched_getaffinity"):
4138
# this function isn't available on all platforms
42-
base_cpu_count = len(os.sched_getaffinity(0)) # pyright: ignore[reportAttributeAccessIssue]
39+
base_cpu_count = len(os.sched_getaffinity(0))
4340
else: # pragma: no cover
4441
# this proxy is good enough in most situations
4542
base_cpu_count = os.cpu_count()
@@ -82,19 +79,16 @@ def _validate_single_file(file: str, sections: SectionsArg) -> TaskResults:
8279
messages.append(Message(f"Error: could not find {file}"))
8380
return TaskResults(status, messages)
8481

85-
# TODO: rewrite this section with try/except*/else when support for Python 3.10 is dropped
86-
def value_error_handler(exc: BaseExceptionGroup[Exception]) -> None:
87-
nonlocal status
82+
try:
83+
_ = inifix.load(file, sections=sections.value)
84+
messages.append(Message(f"Validated {file}"))
85+
except* ValueError as exc:
8886
status = 1
8987
exc_repr = "\n".join(str(e) for e in exc.exceptions)
9088
messages.append(
9189
Message(f"Failed to validate {file}:\n{indent(exc_repr, ' ')}")
9290
)
9391

94-
with catch({ValueError: value_error_handler}):
95-
_ = inifix.load(file, sections=sections.value)
96-
messages.append(Message(f"Validated {file}"))
97-
9892
return TaskResults(status, messages)
9993

10094

@@ -168,17 +162,14 @@ def _format_single_file(
168162

169163
validate_baseline: AnyConfig = {}
170164
if not skip_validation:
171-
# TODO: rewrite this section with try/except* when support for Python 3.10 is dropped
172-
def value_error_handler(exc: BaseExceptionGroup[Exception]) -> None:
173-
nonlocal status
165+
try:
166+
validate_baseline = inifix.load(file, sections=sections.value)
167+
except* ValueError as exc:
174168
status = 1
175169
exc_repr = "\n".join(str(e) for e in exc.exceptions)
176170
messages.append(
177171
Message(f"Failed to format {file}:\n{indent(exc_repr, ' ')}")
178172
)
179-
180-
with catch({ValueError: value_error_handler}):
181-
validate_baseline = inifix.load(file, sections=sections.value)
182173
if status != 0:
183174
return TaskResults(status, messages)
184175

0 commit comments

Comments
 (0)