From 82ceb44984917141a481a72ec3706cdfb94be469 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 21 Jul 2026 11:25:58 +0200 Subject: [PATCH 1/6] [misc] Drop py3.10 and update install options --- .github/workflows/builds.yml | 6 +++--- .github/workflows/main.yml | 5 ++--- .gitignore | 3 +++ .pre-commit-config.yaml | 2 +- README.md | 7 +++++-- pyproject.toml | 18 +++++++++--------- setup.py | 2 +- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 9b42d53..22ea791 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -13,14 +13,14 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python: ["3.10", "3.11", "3.12"] + python: ["3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v6 - name: Set up Python uses: actions/setup-python@v6 with: # MacOS issue ref.: https://github.com/actions/setup-python/issues/855 & https://github.com/actions/setup-python/issues/865 - python-version: ${{ matrix.os == 'macos-latest' && matrix.python == '3.10' && '3.11' || matrix.python }} + python-version: ${{ matrix.python }} architecture: x64 # MacOS: use crnn_vgg16_bn as recognition architecture to avoid onnxruntime error - name: Set recognition arch for macOS @@ -34,6 +34,6 @@ jobs: - name: Install package run: | python -m pip install --upgrade pip - pip install -e . --upgrade + pip install -e .[cpu] --upgrade - name: Import package run: python -c "import labeler; print(labeler.__version__)" \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 307862b..5d3f966 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,14 +12,13 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python: ["3.10", "3.11", "3.12"] + python: ["3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v6 - name: Set up Python uses: actions/setup-python@v6 with: - # MacOS issue ref.: https://github.com/actions/setup-python/issues/855 & https://github.com/actions/setup-python/issues/865 - python-version: ${{ matrix.os == 'macos-latest' && matrix.python == '3.10' && '3.11' || matrix.python }} + python-version: ${{ matrix.python }} architecture: x64 # MacOS: use crnn_vgg16_bn as recognition architecture to avoid onnxruntime error - name: Set recognition arch for macOS diff --git a/.gitignore b/.gitignore index 315e076..aa85f92 100644 --- a/.gitignore +++ b/.gitignore @@ -125,6 +125,9 @@ venv.bak/ .dmypy.json dmypy.json +# ruff +.ruff_cache/ + # Pyre type checker .pyre/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c72ec2f..c5c920a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: no-commit-to-branch args: ['--branch', 'main'] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.0 + rev: v0.15.22 hooks: - id: ruff args: [ --fix ] diff --git a/README.md b/README.md index ad9fc43..56e9fb9 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,13 @@ Python 3.10 (or higher) and [pip](https://pip.pypa.io/en/stable/) are required t ### Latest release -You can then install the latest release of the package using [pypi](https://pypi.org/project/OnnxTR/) as follows: +You can then install the latest release of the package using [pypi](https://pypi.org/project/doctr-labeler/) as follows: ```bash -pip3 install doctr-labeler +# Install the CPU version +pip3 install "doctr-labeler[cpu]" +# Or with GPU support +pip3 install "doctr-labeler[gpu]" ``` ## Keybindings diff --git a/pyproject.toml b/pyproject.toml index 4a65827..1e81a56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ maintainers = [ {name = "Felix Dittrich"}, ] readme = "README.md" -requires-python = ">=3.10.0,<4" +requires-python = ">=3.11.0,<4" license = {file = "LICENSE"} keywords=["OCR", "document processing", "labeling", "annotation", "docTR", "OnnxTR"] classifiers=[ @@ -22,26 +22,21 @@ classifiers=[ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering", ] dynamic = ["version"] dependencies = [ "numpy>=1.16.0, <3.0.0", - "opencv-python>=4.5.0, <5.0.0", + "opencv-python>=4.5.0, <6.0.0", "Pillow>=9.2.0", "tqdm>=4.30.0", "huggingface-hub>=0.23.0,<2.0.0", # GUI "sv-ttk>=2.6.0", "darkdetect>=0.8.0", - # AutoML - # Linux & Windows - "onnxtr[gpu]>=0.6.0, <1.0.0; sys_platform != 'darwin'", - # MacOS compatibility - "onnxtr[cpu]>=0.6.0, <1.0.0; sys_platform == 'darwin'", ] [project.scripts] @@ -69,7 +64,12 @@ dev = [ "ruff>=0.1.5", "mypy>=0.812", "pre-commit>=2.17.0", + # AutoML + "onnxtr[cpu]>=0.6.0, <1.0.0", ] +# AutoML +cpu = ["onnxtr[cpu]>=0.6.0, <1.0.0"] +gpu = ["onnxtr[gpu]>=0.6.0, <1.0.0"] [project.urls] repository = "https://github.com/text2knowledge/docTR-Labeler" @@ -113,7 +113,7 @@ ignore_missing_imports = true [tool.ruff] exclude = [".git", "venv*", "build", "**/__init__.py"] line-length = 120 -target-version = "py310" +target-version = "py311" preview=true [tool.ruff.lint] diff --git a/setup.py b/setup.py index 0eee916..f9abdb2 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup PKG_NAME = "doctr-labeler" -VERSION = os.getenv("BUILD_VERSION", "0.2.3") +VERSION = os.getenv("BUILD_VERSION", "0.3.0") if __name__ == "__main__": From 00592a62a56c0bf74e0f1d6d6b8253d96fb7dbeb Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 21 Jul 2026 11:28:38 +0200 Subject: [PATCH 2/6] update version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f9abdb2..e8926b5 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup PKG_NAME = "doctr-labeler" -VERSION = os.getenv("BUILD_VERSION", "0.3.0") +VERSION = os.getenv("BUILD_VERSION", "0.4.0") if __name__ == "__main__": From 8d3162234048e9ea19fb33fce6fa2b1c7b62398c Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 21 Jul 2026 11:39:34 +0200 Subject: [PATCH 3/6] Update py versions --- .github/workflows/publish.yml | 4 ++-- .github/workflows/style.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d020995..22368bd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python: ["3.10"] + python: ["3.11"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 @@ -49,7 +49,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python: ["3.10"] + python: ["3.11"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 36583fe..76bf712 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python: ["3.10"] + python: ["3.11"] steps: - uses: actions/checkout@v7 - name: Set up Python @@ -31,7 +31,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python: ["3.10"] + python: ["3.11"] steps: - uses: actions/checkout@v7 - name: Set up Python From d7915ef4883ff1a37c372efc27ee2b20b4be4c32 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 21 Jul 2026 11:52:45 +0200 Subject: [PATCH 4/6] Update py versions --- .github/workflows/builds.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 04db230..c210a06 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -22,10 +22,6 @@ jobs: # MacOS issue ref.: https://github.com/actions/setup-python/issues/855 & https://github.com/actions/setup-python/issues/865 python-version: ${{ matrix.python }} architecture: x64 - # MacOS: use crnn_vgg16_bn as recognition architecture to avoid onnxruntime error - - name: Set recognition arch for macOS - if: matrix.os == 'macos-latest' - run: echo "RECOGNITION_ARCH=crnn_vgg16_bn" >> $GITHUB_ENV - name: Cache python modules uses: actions/cache@v6 with: From 4542e990f0d44699a35c56c722e2ec1e86cbc0aa Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 21 Jul 2026 11:53:11 +0200 Subject: [PATCH 5/6] Update py versions --- .github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 267aa4a..2c4529d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,10 +20,6 @@ jobs: with: python-version: ${{ matrix.python }} architecture: x64 - # MacOS: use crnn_vgg16_bn as recognition architecture to avoid onnxruntime error - - name: Set recognition arch for macOS - if: matrix.os == 'macos-latest' - run: echo "RECOGNITION_ARCH=crnn_vgg16_bn" >> $GITHUB_ENV - name: Cache python modules uses: actions/cache@v6 with: From 958cc4598faaafda2c0e54dd0769458f7ca64440 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 21 Jul 2026 11:56:38 +0200 Subject: [PATCH 6/6] Update py versions --- .github/workflows/builds.yml | 4 ++++ .github/workflows/main.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index c210a06..04db230 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -22,6 +22,10 @@ jobs: # MacOS issue ref.: https://github.com/actions/setup-python/issues/855 & https://github.com/actions/setup-python/issues/865 python-version: ${{ matrix.python }} architecture: x64 + # MacOS: use crnn_vgg16_bn as recognition architecture to avoid onnxruntime error + - name: Set recognition arch for macOS + if: matrix.os == 'macos-latest' + run: echo "RECOGNITION_ARCH=crnn_vgg16_bn" >> $GITHUB_ENV - name: Cache python modules uses: actions/cache@v6 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c4529d..267aa4a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,6 +20,10 @@ jobs: with: python-version: ${{ matrix.python }} architecture: x64 + # MacOS: use crnn_vgg16_bn as recognition architecture to avoid onnxruntime error + - name: Set recognition arch for macOS + if: matrix.os == 'macos-latest' + run: echo "RECOGNITION_ARCH=crnn_vgg16_bn" >> $GITHUB_ENV - name: Cache python modules uses: actions/cache@v6 with: