diff --git a/CHANGELOG.md b/CHANGELOG.md index 088dd5e..48b3f18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +* Import `@override` from `typing_extensions` conditionally. + ## 2.6.3 - 2026-05-07 * Add an "ocr" extra. diff --git a/pyproject.toml b/pyproject.toml index f133703..36e1329 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ "djvulibre-python (>=0.9.3)", "fpdf2 (>=2.8)", "loguru (>=0.7)", + "typing_extensions (>=4.5.0); python_version < '3.12'", "pdfrw (>=0.4)", "pillow (>=12.2.0)", ] diff --git a/src/dpsprep/options.py b/src/dpsprep/options.py index d7c7558..340cb6a 100644 --- a/src/dpsprep/options.py +++ b/src/dpsprep/options.py @@ -1,10 +1,16 @@ import json +import sys from collections.abc import Iterator, Mapping from dataclasses import dataclass from typing import Any, Literal, cast, get_args import click -from typing_extensions import override + + +if sys.version_info < (3, 12): + from typing_extensions import override +else: + from typing import override from dpsprep.exceptions import DpsPrepConfigError from dpsprep.ranges import ( diff --git a/uv.lock b/uv.lock index 6fd170f..78e9606 100644 --- a/uv.lock +++ b/uv.lock @@ -357,6 +357,7 @@ dependencies = [ { name = "loguru" }, { name = "pdfrw" }, { name = "pillow" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, ] [package.optional-dependencies] @@ -387,6 +388,7 @@ requires-dist = [ { name = "ocrmypdf", marker = "extra == 'ocr'", specifier = ">=17" }, { name = "pdfrw", specifier = ">=0.4" }, { name = "pillow", specifier = ">=12.2.0" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.5.0" }, ] provides-extras = ["compress", "ocr"]