Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Misc] drop py 3.8 support #1457

Merged
merged 13 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.8, <3.12
- python>=3.9, <3.12
- setuptools

run:
Expand Down
4 changes: 2 additions & 2 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.8", "3.9"]
python: ["3.9", "3.10"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.8
python-version: 3.9
channels: pypdfium2-team,bblanchon,defaults,conda-forge
channel-priority: strict
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/demo.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.8"]
python: ["3.9"]
framework: [tensorflow, pytorch]
steps:
- if: matrix.os == 'macos-latest'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/doc-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
see-page-build-payload:
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
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.8-slim --build-arg SYSTEM=cpu .
run: docker build -t doctr-tf-py3.9-slim --build-arg SYSTEM=cpu .
- name: Run docker container
run: docker run doctr-tf-py3.8-slim python3 -c 'import doctr'
run: docker run doctr-tf-py3.9-slim python3 -c 'import doctr'

pytest-api:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.8"]
python: ["3.9"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
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.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
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.8.18", "3.9.18", "3.10.13"]
python: ["3.9.18", "3.10.13", "3.11.8"]
framework: ["tf", "torch"]
system: ["cpu", "gpu"]

Expand Down
10 changes: 5 additions & 5 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.8"]
python: ["3.9"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -50,11 +50,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8"]
python: ["3.9"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
Expand All @@ -73,7 +73,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.8
python-version: 3.9
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.8
python-version: 3.9
- name: Install package
shell: bash -el {0}
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
architecture: x64
- name: Cache python modules
uses: actions/cache@v3
Expand Down
26 changes: 13 additions & 13 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.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
pip install -e .[torch] --upgrade
- if: matrix.framework == 'tensorflow'
name: Benchmark latency (TF)
run: python references/recognition/latency_tensorflow.py crnn_vgg16_bn --it 5
run: python references/recognition/latency_tensorflow.py crnn_mobilenet_v3_small --it 5
- if: matrix.framework == 'pytorch'
name: Benchmark latency (PT)
run: python references/recognition/latency_pytorch.py crnn_mobilenet_v3_small --it 5
Expand All @@ -274,7 +274,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8"]
python: ["3.9"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -318,7 +318,7 @@ jobs:
unzip toy_detection_set-bbbb4243.zip -d det_set
- if: matrix.framework == 'tensorflow'
name: Train for a short epoch (TF)
run: python references/detection/train_tensorflow.py --train_path ./det_set --val_path ./det_set db_resnet50 -b 2 --epochs 1
run: python references/detection/train_tensorflow.py --train_path ./det_set --val_path ./det_set linknet_resnet18 -b 2 --epochs 1
- if: matrix.framework == 'pytorch'
name: Train for a short epoch (PT)
run: python references/detection/train_pytorch.py ./det_set ./det_set db_mobilenet_v3_large -b 2 --epochs 1
Expand All @@ -329,7 +329,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8"]
python: ["3.9"]
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.8"]
python: ["3.9"]
framework: [tensorflow, pytorch]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -408,18 +408,18 @@ jobs:
pip install -e .[torch] --upgrade
- if: matrix.framework == 'tensorflow'
name: Benchmark latency (TF)
run: python references/detection/latency_tensorflow.py linknet_resnet18 --it 5 --size 512
run: python references/detection/latency_tensorflow.py db_mobilenet_v3_large --it 5 --size 512
- if: matrix.framework == 'pytorch'
name: Benchmark latency (PT)
run: python references/detection/latency_pytorch.py linknet_resnet18 --it 5 --size 512
run: python references/detection/latency_pytorch.py db_mobilenet_v3_large --it 5 --size 512

latency-object-detection:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8"]
python: ["3.9"]
framework: [pytorch]
steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 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.8", "3.9"]
python: ["3.9", "3.10"]
framework: [tensorflow, pytorch]
steps:
- if: matrix.os == 'macos-latest'
Expand Down Expand Up @@ -51,15 +51,15 @@ jobs:
- name: Run analysis script
run: |
wget https://github.com/mindee/doctr/releases/download/v0.1.0/sample.pdf
python scripts/analyze.py sample.pdf --noblock
python scripts/analyze.py sample.pdf --noblock --detection db_mobilenet_v3_large

test-detect-text:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8", "3.9"]
python: ["3.9", "3.10"]
framework: [tensorflow, pytorch]
steps:
- if: matrix.os == 'macos-latest'
Expand Down Expand Up @@ -97,15 +97,15 @@ jobs:
- name: Run detection script
run: |
wget https://github.com/mindee/doctr/releases/download/v0.1.0/sample.pdf
python scripts/detect_text.py sample.pdf
python scripts/detect_text.py sample.pdf --detection db_mobilenet_v3_large

test-evaluate:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8", "3.9"]
python: ["3.9", "3.10"]
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.8", "3.9"]
python: ["3.9", "3.10"]
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.8"]
python: ["3.9"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.8"]
python: ["3.9"]
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 @@ -134,7 +134,7 @@ The KIE predictor results per page are in a dictionary format with each key repr

### Prerequisites

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

Since we use [weasyprint](https://weasyprint.org/), you will need extra dependencies if you are not running Linux.

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.8.2,<3.11" # pypdfium2 needs a python version above 3.8.2
python = ">=3.9,<3.12"
tensorflow = ">=2.11.0,<2.16.0" # cf. https://github.com/mindee/doctr/pull/1461
python-doctr = {git = "https://github.com/mindee/doctr.git", extras = ['tf'], branch = "main" }
# Fastapi: minimum version required to avoid pydantic error
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.8 or higher.
This library requires `Python <https://www.python.org/downloads/>`_ 3.9 or higher.


Prerequisites
Expand Down
4 changes: 2 additions & 2 deletions doctr/datasets/datasets/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def _read_sample(self, index: int) -> Tuple[torch.Tensor, Any]:
@staticmethod
def collate_fn(samples: List[Tuple[torch.Tensor, Any]]) -> Tuple[torch.Tensor, List[Any]]:
images, targets = zip(*samples)
images = torch.stack(images, dim=0)
images = torch.stack(images, dim=0) # type: ignore[assignment]

return images, list(targets)
return images, list(targets) # type: ignore[return-value]


class VisionDataset(AbstractDataset, _VisionDataset): # noqa: D101
Expand Down
2 changes: 1 addition & 1 deletion doctr/io/image/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ def tensor_from_numpy(npy_img: np.ndarray, dtype: torch.dtype = torch.float32) -

def get_img_shape(img: torch.Tensor) -> Tuple[int, int]:
"""Get the shape of an image"""
return img.shape[-2:]
return img.shape[-2:] # type: ignore[return-value]
Loading
Loading