Skip to content

Commit

Permalink
Upgrade py 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
felixdittrich92 committed Nov 6, 2024
1 parent b411109 commit 545e2c8
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build:

requirements:
host:
- python>=3.9, <3.12
- python>=3.10, <3.13
- setuptools

run:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python: ["3.9", "3.10"]
python: ["3.10", "3.11"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand All @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-python@v5
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' && '3.11' || matrix.python }}
python-version: ${{ matrix.os == 'macos-latest' && matrix.python == '3.10' && '3.11' || matrix.python }}
architecture: x64
- if: matrix.framework == 'tensorflow'
name: Cache python modules (TF)
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
python-version: "3.10"
channels: pypdfium2-team,bblanchon,defaults,conda-forge
channel-priority: strict
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- if: matrix.os == 'macos-latest'
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.10"
architecture: x64
- name: check status
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build docker image
run: docker build -t doctr-tf-py3.9-slim --build-arg SYSTEM=cpu .
run: docker build -t doctr-tf-py3.10-slim --build-arg SYSTEM=cpu .
- name: Run docker container
run: docker run doctr-tf-py3.9-slim python3 -c 'import doctr'
run: docker run doctr-tf-py3.10-slim python3 -c 'import doctr'

pytest-api:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/public_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
# Must match version at https://www.python.org/ftp/python/
python: ["3.9.18", "3.10.13", "3.11.8"]
python: ["3.10.13", "3.11.8", "3.12.7"]
framework: ["tf", "torch", "tf,viz,html,contrib", "torch,viz,html,contrib"]
system: ["cpu", "gpu"]

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -73,7 +73,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
python-version: "3.10"
channels: pypdfium2-team,bblanchon,defaults,conda-forge
channel-priority: strict
- name: Install dependencies
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
python-version: "3.10"
- name: Install package
shell: bash -el {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.10"
architecture: x64
- name: Cache python modules
uses: actions/cache@v4
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/references.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -329,7 +329,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -375,7 +375,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9", "3.10"]
python: ["3.10", "3.11"]
framework: [tensorflow, pytorch]
steps:
- if: matrix.os == 'macos-latest'
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9", "3.10"]
python: ["3.10", "3.11"]
framework: [tensorflow, pytorch]
steps:
- if: matrix.os == 'macos-latest'
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9", "3.10"]
python: ["3.10", "3.11"]
framework: [tensorflow, pytorch]
steps:
- if: matrix.os == 'macos-latest'
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.9", "3.10"]
python: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.9"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ The KIE predictor results per page are in a dictionary format with each key repr

### Prerequisites

Python 3.9 (or higher) and [pip](https://pip.pypa.io/en/stable/) are required to install docTR.
Python 3.10 (or higher) and [pip](https://pip.pypa.io/en/stable/) are required to install docTR.

### Latest release

Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9-slim
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = ["Mindee <[email protected]>"]
license = "Apache-2.0"

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
python = ">=3.10,<3.13"
python-doctr = {git = "https://github.com/mindee/doctr.git", extras = ['tf'], branch = "main" }
# Fastapi: minimum version required to avoid pydantic error
# cf. https://github.com/tiangolo/fastapi/issues/4168
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
************

This library requires `Python <https://www.python.org/downloads/>`_ 3.9 or higher.
This library requires `Python <https://www.python.org/downloads/>`_ 3.10 or higher.


Prerequisites
Expand Down
6 changes: 3 additions & 3 deletions doctr/models/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def estimate_orientation(
gray_img = cv2.medianBlur(gray_img, 5)
thresh = cv2.threshold(gray_img, thresh=0, maxval=255, type=cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
else:
thresh = img.astype(np.uint8) # type: ignore[assignment]
thresh = img.astype(np.uint8)

page_orientation, orientation_confidence = general_page_orientation or (None, 0.0)
if page_orientation and orientation_confidence >= min_confidence:
# We rotate the image to the general orientation which improves the detection
# No expand needed bitmap is already padded
thresh = rotate_image(thresh, -page_orientation) # type: ignore
thresh = rotate_image(thresh, -page_orientation)
else: # That's only required if we do not work on the detection models bin map
# try to merge words in lines
(h, w) = img.shape[:2]
Expand All @@ -91,7 +91,7 @@ def estimate_orientation(

angles = []
for contour in contours[:n_ct]:
_, (w, h), angle = cv2.minAreaRect(contour) # type: ignore[assignment]
_, (w, h), angle = cv2.minAreaRect(contour)
if w / h > ratio_threshold_for_lines: # select only contours with ratio like lines
angles.append(angle)
elif w / h < 1 / ratio_threshold_for_lines: # if lines are vertical, substract 90 degree
Expand Down
2 changes: 1 addition & 1 deletion doctr/models/detection/differentiable_binarization/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def bitmap_to_boxes(
contours, _ = cv2.findContours(bitmap.astype(np.uint8), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for contour in contours:
# Check whether smallest enclosing bounding box is not too small
if np.any(contour[:, 0].max(axis=0) - contour[:, 0].min(axis=0) < min_size_box): # type: ignore[index]
if np.any(contour[:, 0].max(axis=0) - contour[:, 0].min(axis=0) < min_size_box):
continue
# Compute objectness
if self.assume_straight_pages:
Expand Down
2 changes: 1 addition & 1 deletion doctr/models/detection/fast/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def bitmap_to_boxes(
contours, _ = cv2.findContours(bitmap.astype(np.uint8), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for contour in contours:
# Check whether smallest enclosing bounding box is not too small
if np.any(contour[:, 0].max(axis=0) - contour[:, 0].min(axis=0) < 2): # type: ignore[index]
if np.any(contour[:, 0].max(axis=0) - contour[:, 0].min(axis=0) < 2):
continue
# Compute objectness
if self.assume_straight_pages:
Expand Down
2 changes: 1 addition & 1 deletion doctr/models/detection/linknet/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def bitmap_to_boxes(
contours, _ = cv2.findContours(bitmap.astype(np.uint8), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for contour in contours:
# Check whether smallest enclosing bounding box is not too small
if np.any(contour[:, 0].max(axis=0) - contour[:, 0].min(axis=0) < 2): # type: ignore[index]
if np.any(contour[:, 0].max(axis=0) - contour[:, 0].min(axis=0) < 2):
continue
# Compute objectness
if self.assume_straight_pages:
Expand Down
2 changes: 1 addition & 1 deletion doctr/models/kie_predictor/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def __call__(
boxes_per_page,
objectness_scores_per_page,
text_preds_per_page,
origin_page_shapes, # type: ignore[arg-type]
origin_page_shapes,
crop_orientations_per_page,
orientations,
languages_dict,
Expand Down
Loading

0 comments on commit 545e2c8

Please sign in to comment.