Drop Python 3.8 too

(cherry picked from commit a8cdc5a191bdf1fe401e96c2dc9a5fba39b90d79)
This commit is contained in:
James R. Barlow
2023-09-21 00:05:39 -07:00
parent 35a1eaf62a
commit ec1c377532
6 changed files with 26 additions and 50 deletions
-4
View File
@@ -22,8 +22,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-20.04
python: "3.8"
- os: ubuntu-20.04
python: "3.9"
- os: ubuntu-20.04
@@ -34,8 +32,6 @@ jobs:
python: "3.10"
- os: ubuntu-latest
python: "3.11"
# - os: ubuntu-latest
# python: "pypy3.8"
#- os: ubuntu-latest
# python: "pypy3.9"
- os: ubuntu-latest
+5 -1
View File
@@ -16,8 +16,12 @@ formats:
- pdf
# Optionally set the version of Python and requirements required to build your docs
build:
os: ubuntu-22.04
tools:
python: "3.9"
python:
version: "3.8"
install:
- method: pip
path: .
+3 -3
View File
@@ -382,7 +382,7 @@ Native Windows
You must install the following for Windows:
* Python 3.8 (64-bit) or later
* Python 3.9 (64-bit) or later
* Tesseract 4.1.1 (64-bit) or later
* Ghostscript 9.50 (64-bit) or later
@@ -553,7 +553,7 @@ manager. ``pip`` cannot provide them.
The following versions are required:
- Python 3.8 or newer
- Python 3.9 or newer
- Ghostscript 9.50 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.8 or newer installed, you can install
If you have ``git`` and Python 3.9 or newer installed, you can install
from source. When the ``pip`` installer runs, it will alert you if
dependencies are missing.
+15 -26
View File
@@ -1,11 +1,7 @@
# SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
[build-system]
requires = [
"setuptools >= 61",
"setuptools_scm[toml] >= 7.0.5",
"wheel"
]
requires = ["setuptools >= 61", "setuptools_scm[toml] >= 7.0.5", "wheel"]
build-backend = "setuptools.build_meta"
[project]
@@ -13,12 +9,12 @@ name = "ocrmypdf"
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.8"
license = { text = "MPL-2.0" }
requires-python = ">=3.9"
dependencies = [
"Pillow>=8.2.0",
"deprecation>=2.1.0",
"img2pdf>=0.3.0", # pure Python
"img2pdf>=0.3.0", # pure Python
"packaging>=20",
"pdfminer.six>=20201018",
"pikepdf>=5.0.1",
@@ -26,10 +22,9 @@ dependencies = [
"reportlab>=3.5.66",
"rich>=13",
"tqdm>=4",
"importlib-resources>=5;python_version<'3.9'", # until Python 3.9
"typing-extensions>=4;python_version<'3.10'",
]
authors = [{name = "James R. Barlow", email="james@purplerock.ca"}]
authors = [{ name = "James R. Barlow", email = "james@purplerock.ca" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
@@ -47,13 +42,7 @@ classifiers = [
"Topic :: Text Processing :: Indexing",
"Topic :: Text Processing :: Linguistic",
]
keywords = [
"PDF",
"OCR",
"optical character recognition",
"PDF/A",
"scanning",
]
keywords = ["PDF", "OCR", "optical character recognition", "PDF/A", "scanning"]
[project.urls]
Documentation = "https://ocrmypdf.readthedocs.io/"
@@ -69,7 +58,7 @@ test = [
"pytest>=6.0.0",
"pytest-cov>=2.11.1",
"pytest-xdist>=2.2.0",
"python-xmp-toolkit==2.0.1", # also requires apt-get install libexempi3
"python-xmp-toolkit==2.0.1", # also requires apt-get install libexempi3
"types-Pillow",
"types-humanfriendly",
]
@@ -134,7 +123,7 @@ exclude_lines = [
"if 0:",
"if False:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:"
"if TYPE_CHECKING:",
]
[tool.pytest.ini_options]
@@ -156,18 +145,18 @@ module = [
'pdfminer.*',
'reportlab.*',
'fitz',
'libxmp.utils'
'libxmp.utils',
]
ignore_missing_imports = true
[tool.ruff]
select = [
"D", # pydocstyle
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"D", # pydocstyle
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"I001", # isort
"UP", # pyupgrade
"UP", # pyupgrade
]
target-version = "py38"
@@ -182,4 +171,4 @@ convention = "google"
"docs/conf.py" = ["D100", "D101", "D105"]
"tests/*.py" = ["D100", "D101", "D102", "D103", "D105"]
"misc/*.py" = ["D103", "D101", "D102"]
"src/ocrmypdf/builtin_plugins/*.py" = ["D103", "D102", "D105"]
"src/ocrmypdf/builtin_plugins/*.py" = ["D103", "D102", "D105"]
+2 -11
View File
@@ -95,15 +95,6 @@ def thread_init(q: Queue, user_init: UserInit, loglevel) -> None:
class StandardExecutor(Executor):
"""Standard OCRmyPDF concurrent task executor."""
def _cancel_futures_kwargs(self):
"""Shim older Pythons that do not have Executor.shutdown(...cancel_futures=).
Remove this code when support for Python 3.8 is dropped.
"""
if sys.version_info[:2] < (3, 9):
return {}
return dict(cancel_futures=True)
def _execute(
self,
*,
@@ -142,7 +133,7 @@ class StandardExecutor(Executor):
task_finished(result, pbar)
except KeyboardInterrupt:
# Terminate pool so we exit instantly
executor.shutdown(wait=False, **self._cancel_futures_kwargs())
executor.shutdown(wait=False, cancel_futures=True)
raise
except Exception:
if not os.environ.get("PYTEST_CURRENT_TEST", ""):
@@ -151,7 +142,7 @@ class StandardExecutor(Executor):
# results will be discard. But if the condition above is True,
# then we are running in pytest, and we want everything to exit
# as cleanly as possible so that we get good error messages.
executor.shutdown(wait=False, **self._cancel_futures_kwargs())
executor.shutdown(wait=False, cancel_futures=True)
raise
finally:
# Terminate log listener
+1 -5
View File
@@ -6,14 +6,10 @@
from __future__ import annotations
import base64
from importlib.resources import files as package_files
from pathlib import Path
from typing import Iterator
try:
from importlib.resources import files as package_files
except ImportError:
from importlib_resources import files as package_files # type: ignore
import pikepdf
SRGB_ICC_PROFILE_NAME = 'sRGB.icc'