Skip to content

Commit b9ff7eb

Browse files
authored
fix: allow flexibility for opencv (#130)
Signed-off-by: Michele Dolfi <[email protected]>
1 parent 16278cd commit b9ff7eb

File tree

5 files changed

+179
-79
lines changed

5 files changed

+179
-79
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
path: ~/.cache/pre-commit
4040
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
4141
- name: Install dependencies
42-
run: uv sync --frozen --all-extras
42+
run: uv sync --frozen
4343
- name: Check code quality and consistency
4444
run: pre-commit run --all-files
4545
- name: Run tests
@@ -65,7 +65,7 @@ jobs:
6565
python-version: ${{ matrix.python-version }}
6666
enable-cache: true
6767
- name: Install dependencies
68-
run: uv sync --all-extras
68+
run: uv sync
6969
- name: Build package
7070
run: uv build
7171
- name: Check content of wheel

.github/workflows/pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
python-version: ${{ matrix.python-version }}
3030
enable-cache: true
3131
- name: Install dependencies
32-
run: uv sync --all-extras
32+
run: uv sync
3333
- name: Build package
3434
run: uv build
3535
- name: Publish distribution 📦 to PyPI

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ AI modules to support the Docling PDF document conversion project.
1515
- Layout model is an AI model that provides among other things ability to detect tables on the page. This package contains inference code for Layout model.
1616

1717

18+
## Install
19+
20+
The package provides two variants which allow to seemlessly switch between `opencv-python` and `opencv-python-headless`.
21+
22+
```sh
23+
# Option 1: with opencv-python-headless
24+
pip install "docling-ibm-models[opencv-python-headless]"
25+
26+
# Option 2: with opencv-python
27+
pip install "docling-ibm-models[opencv-python]"
28+
```
29+
1830
## Pipeline Overview
1931
![Architecture](docs/tablemodel_overview_color.png)
2032

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ dependencies = [
3535
'jsonlines (>=3.1.0,<4.0.0)',
3636
'Pillow (>=10.0.0,<12.0.0)',
3737
'tqdm (>=4.64.0,<5.0.0)',
38-
'opencv-python-headless (>=4.6.0.66,<5.0.0.0)',
3938
'huggingface_hub (>=0.23,<1)',
4039
'safetensors[torch] (>=0.4.3,<1)',
4140
'pydantic (>=2.0.0,<3.0.0)',
@@ -46,6 +45,10 @@ dependencies = [
4645
'accelerate (>=1.2.1,<2.0.0)',
4746
]
4847

48+
[project.optional-dependencies]
49+
opencv-python-headless = ['opencv-python-headless (>=4.6.0.66,<5.0.0.0)']
50+
opencv-python = ['opencv-python-headless (>=4.6.0.66,<5.0.0.0)']
51+
4952
[project.urls]
5053
homepage = "https://github.com/docling-project/docling-ibm-models"
5154
repository = "https://github.com/docling-project/docling-ibm-models"
@@ -54,6 +57,7 @@ changelog = "https://github.com/docling-project/docling-ibm-models/blob/main/CHA
5457

5558
[dependency-groups]
5659
dev = [
60+
"opencv-python-headless (>=4.6.0.66,<5.0.0.0)",
5761
"pre-commit~=3.7",
5862
"mypy~=1.10",
5963
"black~=24.4",
@@ -75,6 +79,12 @@ dev = [
7579

7680
[tool.uv]
7781
package = true
82+
conflicts = [
83+
[
84+
{ extra = "opencv-python-headless" },
85+
{ extra = "opencv-python" },
86+
]
87+
]
7888

7989
[tool.setuptools.packages.find]
8090
include = ["docling_ibm_models*"]

0 commit comments

Comments
 (0)