Skip to content

Commit

Permalink
Support python 3.9 and above only
Browse files Browse the repository at this point in the history
Update CI workflows, axe support for EOL python versions

Bump version to 0.3.14
  • Loading branch information
bozhodimitrov committed Nov 22, 2024
1 parent bc0b6b0 commit b0ae13f
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 80 deletions.
84 changes: 52 additions & 32 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,64 @@ on:
branches: [main, master]
tags: '*'
pull_request:
workflow_call:
inputs:
os:
required: false
type: string
default: ubuntu-latest
env:
required: true
type: string
default: '["py39", "py310", "py311", "py312", "py313"]'
arch:
required: false
type: string
default: '[""]'
wheel-tags:
required: false
type: boolean
default: false
submodules:
required: false
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
tests:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
tox:
name: ${{ inputs.os }} / ${{ matrix.env }}${{ inputs.arch != '[""]' && format(' / {0}', matrix.arch) || '' }}
runs-on: ${{ inputs.os }}
strategy:
fail-fast: true
matrix:
include:
- {name: '3.12', python: '3.12', os: ubuntu-latest, tox: py312}
- {name: '3.11', python: '3.11', os: ubuntu-latest, tox: py311}
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
env: ${{ fromJSON(inputs.env) }}
arch: ${{ fromJSON(inputs.arch) }}
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'

- name: Upgrade bootstrap packages
run: python -m pip install --upgrade pip tox
- name: Install tesseract
run: sudo apt-get -y update && sudo apt-get install -y tesseract-ocr tesseract-ocr-fra

- name: Install tesseract
run: sudo apt-get -y update && sudo apt-get install -y tesseract-ocr tesseract-ocr-fra
- name: Print tesseract version
run: echo $(tesseract --version)

- name: Print tesseract version
run: echo $(tesseract --version)
- uses: asottile/workflows/.github/actions/fast-checkout@v1.8.0
with:
submodules: ${{ inputs.submodules }}

- name: Run tox
run: tox -e ${{ matrix.tox }}
env:
PY_COLORS: 1
TOX_TESTENV_PASSENV: PY_COLORS
- uses: actions/setup-python@v5
with:
python-version: |
${{
(matrix.env == 'py39' || startsWith(matrix.env, 'py39-')) && '3.9' ||
(matrix.env == 'py310' || startsWith(matrix.env, 'py310-')) && '3.10' ||
(matrix.env == 'py311' || startsWith(matrix.env, 'py311-')) && '3.11' ||
(matrix.env == 'py312' || startsWith(matrix.env, 'py312-')) && '3.12' ||
(matrix.env == 'py313' || startsWith(matrix.env, 'py313-')) && '3.13'
}}
cache: 'pip'
architecture: ${{ matrix.arch }}

- name: Test pytesseract package installation
run: pip install -U . && pip show pytesseract && python -c 'import pytesseract'
- name: Test pytesseract package installation
run: pip install -U . && pip show pytesseract && python -c 'import pytesseract'
36 changes: 18 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-yaml
- id: debug-statements
- id: double-quote-string-fixer
- id: name-tests-test
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/hhatto/autopep8
rev: v2.3.1
- id: check-docstring-first
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.7.0
hooks:
- id: autopep8
- id: setup-cfg-fmt
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.14.0
hooks:
- id: reorder-python-imports
args: [--py37-plus]
args: [--py39-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
args: [--py39-plus]
- repo: https://github.com/hhatto/autopep8
rev: v2.3.1
hooks:
- id: add-trailing-comma
# - repo: https://github.com/asottile/setup-cfg-fmt
# rev: v1.16.0
# hooks:
# - id: setup-cfg-fmt
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: local
hooks:
- id: rst
Expand Down
5 changes: 0 additions & 5 deletions pyproject.toml

This file was deleted.

4 changes: 3 additions & 1 deletion pytesseract/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# flake8: noqa: F401
from __future__ import annotations

from .pytesseract import ALTONotSupported
from .pytesseract import get_languages
from .pytesseract import get_tesseract_version
Expand All @@ -16,4 +18,4 @@
from .pytesseract import TSVNotSupported


__version__ = '0.3.13'
__version__ = '0.3.14'
8 changes: 4 additions & 4 deletions pytesseract/pytesseract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import annotations

import logging
import re
import shlex
Expand All @@ -20,8 +22,6 @@
from os.path import realpath
from tempfile import NamedTemporaryFile
from time import sleep
from typing import List
from typing import Optional

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

def run_and_get_multiple_output(
image,
extensions: List[str],
lang: Optional[str] = None,
extensions: list[str],
lang: str | None = None,
nice: int = 0,
timeout: int = 0,
return_bytes: bool = False,
Expand Down
34 changes: 14 additions & 20 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,43 +1,37 @@
[metadata]
name = pytesseract
version = attr: pytesseract.__version__
author = Samuel Hoffstaetter
author_email = samuel@hoffstaetter.com
maintainer = Matthias Lee
maintainer_email = pytesseract@madmaze.net
description = Python-tesseract is a python wrapper for Google's Tesseract-OCR
long_description = file: README.rst
long_description_content_type = text/x-rst
license = Apache License 2.0
license_file = LICENSE
keywords = python-tesseract OCR Python
url = https://github.com/madmaze/pytesseract
author = Samuel Hoffstaetter
author_email = samuel@hoffstaetter.com
maintainer = Matthias Lee
maintainer_email = pytesseract@madmaze.net
license = Apache-2.0
license_files = LICENSE
classifiers =
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
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
keywords = python-tesseract OCR Python
[options]
packages = find:
include_package_data = True
install_requires =
packaging>=21.3
Pillow>=8.0.0
python_requires = >=3.8
[options.entry_points]
console_scripts =
pytesseract = pytesseract.pytesseract:main
packaging>=21.3
python_requires = >=3.9
include_package_data = True
[options.packages.find]
exclude =
tests*
testing*
[options.entry_points]
console_scripts =
pytesseract = pytesseract.pytesseract:main
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from setuptools import setup


Expand Down
2 changes: 2 additions & 0 deletions tests/pytesseract_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from functools import partial
from glob import iglob
from multiprocessing import Pool
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ markers =
[testenv]
deps =
-r{toxinidir}/requirements-dev.txt
passenv = *
commands =
python -bb -m pytest {posargs:tests}

Expand All @@ -18,5 +19,6 @@ deps =
numpy
pandas
-r{toxinidir}/requirements-dev.txt
passenv = *
commands =
python -bb -m pytest {posargs:tests}

0 comments on commit b0ae13f

Please sign in to comment.