From 5ff468d1a41834fd85319422737222f1487476c1 Mon Sep 17 00:00:00 2001 From: Alexandre Menezes Date: Mon, 23 Oct 2023 15:27:50 -0300 Subject: [PATCH] Added support to Python 3.12 --- .coveragerc | 4 ++-- .github/workflows/ci.yml | 2 +- .tool-versions | 1 + aiopytesseract/__init__.py | 23 +++++++++++++++++------ aiopytesseract/base_command.py | 12 +++++++----- aiopytesseract/validators.py | 11 +++++++---- setup.cfg | 5 +++-- 7 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 .tool-versions diff --git a/.coveragerc b/.coveragerc index 623af58..9081243 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ [run] branch = True -omit = **__init__.py** - **__main__.py +omit = *__init__.py* + *__main__.py* [report] show_missing = True diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f52a7f5..1fec8d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: tests: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8', 'pypy-3.9'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9'] os: [ubuntu] fail-fast: true runs-on: ${{ matrix.os }}-latest diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..1569bf5 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +python 3.12.0 diff --git a/aiopytesseract/__init__.py b/aiopytesseract/__init__.py index e52bed9..af59836 100644 --- a/aiopytesseract/__init__.py +++ b/aiopytesseract/__init__.py @@ -1,11 +1,22 @@ -from .commands import (confidence, deskew, get_languages, - get_tesseract_version, image_to_boxes, image_to_data, - image_to_hocr, image_to_osd, image_to_pdf, - image_to_string, languages, run, tesseract_parameters, - tesseract_version) +from .commands import ( + confidence, + deskew, + get_languages, + get_tesseract_version, + image_to_boxes, + image_to_data, + image_to_hocr, + image_to_osd, + image_to_pdf, + image_to_string, + languages, + run, + tesseract_parameters, + tesseract_version, +) from .models import OSD, Box, Data, Parameter -__version__ = "0.10.0" +__version__ = "0.11.0" __all__ = [ "__version__", "OSD", diff --git a/aiopytesseract/base_command.py b/aiopytesseract/base_command.py index 83c08d4..f66ca30 100644 --- a/aiopytesseract/base_command.py +++ b/aiopytesseract/base_command.py @@ -6,13 +6,15 @@ from typing import Any, List, Optional, Tuple from ._logger import logger -from .constants import (AIOPYTESSERACT_DEFAULT_ENCODING, - AIOPYTESSERACT_DEFAULT_TIMEOUT, OUTPUT_FILE_EXTENSIONS, - TESSERACT_CMD) +from .constants import ( + AIOPYTESSERACT_DEFAULT_ENCODING, + AIOPYTESSERACT_DEFAULT_TIMEOUT, + OUTPUT_FILE_EXTENSIONS, + TESSERACT_CMD, +) from .exceptions import TesseractRuntimeError, TesseractTimeoutError from .returncode import ReturnCode -from .validators import (file_exists, language_is_valid, oem_is_valid, - psm_is_valid) +from .validators import file_exists, language_is_valid, oem_is_valid, psm_is_valid async def execute_cmd(cmd_args: str, timeout: float = AIOPYTESSERACT_DEFAULT_TIMEOUT): diff --git a/aiopytesseract/validators.py b/aiopytesseract/validators.py index 7080aaa..636e66b 100644 --- a/aiopytesseract/validators.py +++ b/aiopytesseract/validators.py @@ -1,9 +1,12 @@ from pathlib import Path -from .constants import (OCR_ENGINE_MODES, PAGE_SEGMENTATION_MODES, - TESSERACT_LANGUAGES) -from .exceptions import (LanguageInvalidException, NoSuchFileException, - OEMInvalidException, PSMInvalidException) +from .constants import OCR_ENGINE_MODES, PAGE_SEGMENTATION_MODES, TESSERACT_LANGUAGES +from .exceptions import ( + LanguageInvalidException, + NoSuchFileException, + OEMInvalidException, + PSMInvalidException, +) async def psm_is_valid(psm: int) -> None: diff --git a/setup.cfg b/setup.cfg index 71e5ce4..4920766 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,7 @@ description = asyncio tesseract wrapper for Tesseract-OCR long_description = file: README.md long_description_content_type = text/markdown license = Apache-2.0 -license_file = LICENSE +license_files = LICENSE url = https://github.com/amenezes/aiopytesseract project_urls = Documentation = https://github.com/amenezes/aiopytesseract @@ -28,6 +28,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Topic :: Software Development :: Libraries @@ -78,7 +79,7 @@ warn_unused_ignores = True warn_unreachable = True [tox:tox] -envlist = py{38,39,310,311},pypy{3.8,3.9} +envlist = py{38,39,310,311,312},pypy{3.8,3.9} [testenv] deps = -rrequirements-dev.txt