Skip to content

Commit deff509

Browse files
committed
Support python 3.9 and above only
Update CI workflows, axe support for EOL python versions Bump version to 0.3.14
1 parent bc0b6b0 commit deff509

File tree

9 files changed

+78
-84
lines changed

9 files changed

+78
-84
lines changed

.github/workflows/ci.yaml

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,40 @@ on:
66
tags: '*'
77
pull_request:
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
913
jobs:
10-
tests:
11-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
12-
name: ${{ matrix.name }}
13-
runs-on: ${{ matrix.os }}
14+
tox:
15+
name: ${{ matrix.env }}
16+
runs-on: ubuntu-latest
1417
strategy:
15-
fail-fast: true
1618
matrix:
17-
include:
18-
- {name: '3.12', python: '3.12', os: ubuntu-latest, tox: py312}
19-
- {name: '3.11', python: '3.11', os: ubuntu-latest, tox: py311}
20-
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310}
21-
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
22-
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
19+
env: [py39, py310, py311, py312, py313, py-slow]
2320
steps:
24-
- uses: actions/checkout@v4
25-
26-
- name: Setup Python
27-
uses: actions/setup-python@v5
28-
with:
29-
python-version: ${{ matrix.python }}
30-
cache: 'pip'
31-
32-
- name: Upgrade bootstrap packages
33-
run: python -m pip install --upgrade pip tox
34-
35-
- name: Install tesseract
36-
run: sudo apt-get -y update && sudo apt-get install -y tesseract-ocr tesseract-ocr-fra
37-
38-
- name: Print tesseract version
39-
run: echo $(tesseract --version)
40-
41-
- name: Run tox
42-
run: tox -e ${{ matrix.tox }}
43-
env:
44-
PY_COLORS: 1
45-
TOX_TESTENV_PASSENV: PY_COLORS
46-
47-
- name: Test pytesseract package installation
48-
run: pip install -U . && pip show pytesseract && python -c 'import pytesseract'
21+
- uses: asottile/workflows/.github/actions/fast-checkout@v1.8.0
22+
with:
23+
submodules: false
24+
- uses: actions/setup-python@v5
25+
with:
26+
python-version: |
27+
${{
28+
(matrix.env == 'py39' || startsWith(matrix.env, 'py39-')) && '3.9' ||
29+
(matrix.env == 'py310' || startsWith(matrix.env, 'py310-')) && '3.10' ||
30+
(matrix.env == 'py311' || startsWith(matrix.env, 'py311-')) && '3.11' ||
31+
(matrix.env == 'py312' || startsWith(matrix.env, 'py312-')) && '3.12' ||
32+
(matrix.env == 'py313' || startsWith(matrix.env, 'py313-')) && '3.13' ||
33+
(matrix.env == 'py-slow') && '3.13'
34+
}}
35+
- name: Install tesseract
36+
run: sudo apt-get -y update && sudo apt-get install -y tesseract-ocr tesseract-ocr-fra
37+
- name: Print tesseract version
38+
run: echo $(tesseract --version)
39+
- name: Update tools
40+
run: python -mpip install --upgrade setuptools tox virtualenv
41+
- name: Run tox
42+
run: tox -e ${{ matrix.env }}
43+
- name: Test pytesseract package installation
44+
if: ${{ matrix.env == 'py-slow' }}
45+
run: python -mpip install -U . && python -mpip show pytesseract && python -c 'import pytesseract'

.pre-commit-config.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,38 @@ repos:
1010
hooks:
1111
- id: trailing-whitespace
1212
- id: end-of-file-fixer
13-
- id: check-docstring-first
1413
- id: check-yaml
1514
- id: debug-statements
15+
- id: double-quote-string-fixer
1616
- id: name-tests-test
1717
- id: requirements-txt-fixer
18-
- id: double-quote-string-fixer
19-
- repo: https://github.com/PyCQA/flake8
20-
rev: 7.1.1
21-
hooks:
22-
- id: flake8
23-
- repo: https://github.com/hhatto/autopep8
24-
rev: v2.3.1
18+
- id: check-docstring-first
19+
- repo: https://github.com/asottile/setup-cfg-fmt
20+
rev: v2.7.0
2521
hooks:
26-
- id: autopep8
22+
- id: setup-cfg-fmt
2723
- repo: https://github.com/asottile/reorder-python-imports
2824
rev: v3.14.0
2925
hooks:
3026
- id: reorder-python-imports
31-
args: [--py37-plus]
27+
args: [--py39-plus, --add-import, 'from __future__ import annotations']
28+
- repo: https://github.com/asottile/add-trailing-comma
29+
rev: v3.1.0
30+
hooks:
31+
- id: add-trailing-comma
3232
- repo: https://github.com/asottile/pyupgrade
3333
rev: v3.19.0
3434
hooks:
3535
- id: pyupgrade
36-
args: [--py37-plus]
37-
- repo: https://github.com/asottile/add-trailing-comma
38-
rev: v3.1.0
36+
args: [--py39-plus]
37+
- repo: https://github.com/hhatto/autopep8
38+
rev: v2.3.1
3939
hooks:
40-
- id: add-trailing-comma
41-
# - repo: https://github.com/asottile/setup-cfg-fmt
42-
# rev: v1.16.0
43-
# hooks:
44-
# - id: setup-cfg-fmt
40+
- id: autopep8
41+
- repo: https://github.com/PyCQA/flake8
42+
rev: 7.1.1
43+
hooks:
44+
- id: flake8
4545
- repo: local
4646
hooks:
4747
- id: rst

pyproject.toml

Lines changed: 0 additions & 5 deletions
This file was deleted.

pytesseract/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# flake8: noqa: F401
2+
from __future__ import annotations
3+
24
from .pytesseract import ALTONotSupported
35
from .pytesseract import get_languages
46
from .pytesseract import get_tesseract_version
@@ -16,4 +18,4 @@
1618
from .pytesseract import TSVNotSupported
1719

1820

19-
__version__ = '0.3.13'
21+
__version__ = '0.3.14'

pytesseract/pytesseract.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python
2+
from __future__ import annotations
3+
24
import logging
35
import re
46
import shlex
@@ -20,8 +22,6 @@
2022
from os.path import realpath
2123
from tempfile import NamedTemporaryFile
2224
from time import sleep
23-
from typing import List
24-
from typing import Optional
2525

2626
from packaging.version import InvalidVersion
2727
from packaging.version import parse
@@ -293,8 +293,8 @@ def _read_output(filename: str, return_bytes: bool = False):
293293

294294
def run_and_get_multiple_output(
295295
image,
296-
extensions: List[str],
297-
lang: Optional[str] = None,
296+
extensions: list[str],
297+
lang: str | None = None,
298298
nice: int = 0,
299299
timeout: int = 0,
300300
return_bytes: bool = False,

setup.cfg

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,37 @@
11
[metadata]
22
name = pytesseract
33
version = attr: pytesseract.__version__
4-
author = Samuel Hoffstaetter
5-
author_email = [email protected]
6-
maintainer = Matthias Lee
7-
maintainer_email = [email protected]
84
description = Python-tesseract is a python wrapper for Google's Tesseract-OCR
95
long_description = file: README.rst
106
long_description_content_type = text/x-rst
11-
license = Apache License 2.0
12-
license_file = LICENSE
13-
keywords = python-tesseract OCR Python
147
url = https://github.com/madmaze/pytesseract
8+
author = Samuel Hoffstaetter
9+
author_email = [email protected]
10+
maintainer = Matthias Lee
11+
maintainer_email = [email protected]
12+
license = Apache-2.0
13+
license_files = LICENSE
1514
classifiers =
1615
License :: OSI Approved :: Apache Software License
1716
Programming Language :: Python :: 3
1817
Programming Language :: Python :: 3 :: Only
19-
Programming Language :: Python :: 3.8
20-
Programming Language :: Python :: 3.9
21-
Programming Language :: Python :: 3.10
22-
Programming Language :: Python :: 3.11
23-
Programming Language :: Python :: 3.12
2418
Programming Language :: Python :: Implementation :: CPython
2519
Programming Language :: Python :: Implementation :: PyPy
20+
keywords = python-tesseract OCR Python
2621
2722
[options]
2823
packages = find:
29-
include_package_data = True
3024
install_requires =
31-
packaging>=21.3
3225
Pillow>=8.0.0
33-
34-
python_requires = >=3.8
35-
36-
[options.entry_points]
37-
console_scripts =
38-
pytesseract = pytesseract.pytesseract:main
26+
packaging>=21.3
27+
python_requires = >=3.9
28+
include_package_data = True
3929
4030
[options.packages.find]
4131
exclude =
4232
tests*
4333
testing*
34+
35+
[options.entry_points]
36+
console_scripts =
37+
pytesseract = pytesseract.pytesseract:main

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from setuptools import setup
24

35

tests/pytesseract_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from functools import partial
24
from glob import iglob
35
from multiprocessing import Pool

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ markers =
1010
[testenv]
1111
deps =
1212
-r{toxinidir}/requirements-dev.txt
13+
passenv = *
1314
commands =
1415
python -bb -m pytest {posargs:tests}
1516

@@ -18,5 +19,6 @@ deps =
1819
numpy
1920
pandas
2021
-r{toxinidir}/requirements-dev.txt
22+
passenv = *
2123
commands =
2224
python -bb -m pytest {posargs:tests}

0 commit comments

Comments
 (0)