diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f19037a3..ecfd3ca8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,20 +22,18 @@ jobs: strategy: matrix: include: - - os: ubuntu-22.04 - python: "3.9" - os: ubuntu-22.04 python: "3.10" - os: ubuntu-22.04 python: "3.11" - os: ubuntu-22.04 - python: "3.9" + python: "3.10" tesseract5: true - os: ubuntu-latest python: "3.12" tesseract5: true - #- os: ubuntu-latest - # python: "pypy3.9" + - os: ubuntu-latest + python: "pypy3.10" env: OS: ${{ matrix.os }} @@ -219,7 +217,7 @@ jobs: - uses: actions/setup-python@v4 name: Setup Python with: - python-version: "3.9" + python-version: "3.10" cache: "pip" - name: Make wheels and sdist diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 0ae35f32..ccfc0840 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -19,7 +19,7 @@ formats: build: os: ubuntu-22.04 tools: - python: "3.9" + python: "3.10" python: install: diff --git a/docs/installation.rst b/docs/installation.rst index 18a83841..232403fa 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -452,7 +452,7 @@ Cygwin64 First install the the following prerequisite Cygwin packages using ``setup-x86_64.exe``:: - python39 (or later) + python310 (or later) python3?-devel python3?-pip python3?-lxml @@ -550,7 +550,7 @@ manager. ``pip`` cannot provide them. The following versions are required: -- Python 3.9 or newer +- Python 3.10 or newer - Ghostscript 9.55 or newer - Tesseract 4.1.1 or newer - jbig2enc 0.29 or newer @@ -586,7 +586,7 @@ unfortunately, the ``pip install`` command cannot satisfy all of them. Installing HEAD revision from sources ===================================== -If you have ``git`` and Python 3.9 or newer installed, you can install +If you have ``git`` and Python 3.10 or newer installed, you can install from source. When the ``pip`` installer runs, it will alert you if dependencies are missing. diff --git a/pyproject.toml b/pyproject.toml index ff82cef9..1dd4ace6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ dynamic = ["version"] description = "OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched" readme = "README.md" license = { text = "MPL-2.0" } -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "Pillow>=10.0.1", "deprecation>=2.1.0", @@ -20,7 +20,6 @@ dependencies = [ "pikepdf>=8.7.1", "pluggy>=0.13.0", "rich>=13", - "typing-extensions>=4;python_version<'3.10'", ] authors = [{ name = "James R. Barlow", email = "james@purplerock.ca" }] classifiers = [ diff --git a/src/ocrmypdf/_exec/unpaper.py b/src/ocrmypdf/_exec/unpaper.py index 493d9b3a..7efc51b6 100644 --- a/src/ocrmypdf/_exec/unpaper.py +++ b/src/ocrmypdf/_exec/unpaper.py @@ -14,6 +14,7 @@ from contextlib import contextmanager from decimal import Decimal from pathlib import Path from subprocess import PIPE, STDOUT +from tempfile import TemporaryDirectory from typing import Union from packaging.version import Version @@ -26,27 +27,6 @@ from ocrmypdf.subprocess import get_version, run # https://github.com/Flameeyes/unpaper/blob/main/doc/basic-concepts.md -if sys.version_info >= (3, 10): - from tempfile import TemporaryDirectory -else: - from tempfile import TemporaryDirectory as _TemporaryDirectory - - class TemporaryDirectory(_TemporaryDirectory): - """Shim to consume ignore_cleanup_errors kwarg on Python 3.9 and older. - - The argument is consumed without action. If users are getting errors related - to temporary file cleanup, they should upgrade to Python 3.10 which properly - cleans up temporary directories on Windows. - - See: https://github.com/python/cpython/pull/24793 - """ - - def __init__(self, ignore_cleanup_errors=False, **kwargs): - super().__init__(**kwargs) - - del _TemporaryDirectory - - UNPAPER_IMAGE_PIXEL_LIMIT = 256 * 1024 * 1024 DecFloat = Union[Decimal, float]