Skip to content

Commit 95a0e12

Browse files
✨ ⬆️ add support for mindee-lite and bump dependencies (#419)
1 parent 84d68ea commit 95a0e12

57 files changed

Lines changed: 579 additions & 100 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/_publish-code.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ on:
77
workflow_call:
88
workflow_dispatch:
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
publish:
12-
name: Publish release to PyPi
15+
name: Publish ${{ matrix.variant }} release to PyPi
1316
runs-on: ubuntu-latest
1417
strategy:
18+
fail-fast: false
19+
max-parallel: 1
1520
matrix:
16-
python-version: [ "3.11" ]
21+
variant: [ full, lite ]
22+
env:
23+
PYTHON_VERSION: "3.13"
1724
steps:
18-
- uses: actions/checkout@v5
25+
- uses: actions/checkout@v6
1926

20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v5
27+
- name: Set up Python ${{ env.PYTHON_VERSION }}
28+
uses: actions/setup-python@v6
2229
with:
23-
python-version: ${{ matrix.python-version }}
30+
python-version: ${{ env.PYTHON_VERSION }}
2431

2532
- name: Cache dependencies
2633
uses: actions/cache@v5
@@ -31,7 +38,17 @@ jobs:
3138
${{ runner.os }}-build-
3239
3340
- name: Install dependencies
34-
run: python -m pip install -e .[build]
41+
run: |
42+
if [ "${{ matrix.variant }}" = "lite" ]; then
43+
python -m pip install toml
44+
fi
45+
python -m pip install -e '.[build]'
46+
47+
- name: Generate lite TOML
48+
if: matrix.variant == 'lite'
49+
run: |
50+
python scripts/generate_lite_toml.py
51+
cp pyproject-lite.toml pyproject.toml
3552
3653
- name: Build
3754
run: |
@@ -49,6 +66,7 @@ jobs:
4966
run: twine upload --disable-progress-bar --repository testpypi ./dist/*
5067

5168
- name: Upload
69+
if: startsWith(github.ref, 'refs/tags/')
5270
env:
5371
TWINE_NON_INTERACTIVE: "1"
5472
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}

.github/workflows/_publish-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
matrix:
1616
python-version: ["3.11"]
1717
steps:
18-
- uses: actions/checkout@v5
18+
- uses: actions/checkout@v6
1919

2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@v6
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

@@ -32,7 +32,7 @@ jobs:
3232
3333
- name: Install dependencies
3434
run: |
35-
python -m pip install -e .[docs]
35+
python -m pip install -e '.[docs]'
3636
3737
- name: Sphinx make
3838
run: |

.github/workflows/_smoke-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
- "3.14"
2626
runs-on: "ubuntu-22.04"
2727
steps:
28-
- uses: actions/checkout@v5
28+
- uses: actions/checkout@v6
2929
with:
3030
submodules: recursive
3131

3232
- name: Set up Python ${{ matrix.python-version }}
33-
uses: actions/setup-python@v5
33+
uses: actions/setup-python@v6
3434
with:
3535
python-version: ${{ matrix.python-version }}
3636

@@ -45,7 +45,7 @@ jobs:
4545
- name: Install dependencies
4646
run: |
4747
python -m pip install pip
48-
pip install -e .
48+
pip install -e '.'
4949
5050
- name: Tests v2 sample code
5151
run: |

.github/workflows/_static-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
matrix:
1515
python-version: ["3.11"]
1616
steps:
17-
- uses: actions/checkout@v5
17+
- uses: actions/checkout@v6
1818

1919
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v5
20+
uses: actions/setup-python@v6
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

@@ -33,15 +33,15 @@ jobs:
3333
run: |
3434
python -m pip install pip
3535
pip install pylic~=3.6.1
36-
pip install -e .
36+
pip install -e '.'
3737
3838
- name: License check
3939
run: |
4040
pylic check --allow-extra-safe-licenses
4141
4242
- name: Install lint dependencies
4343
run: |
44-
pip install -e .[lint]
44+
pip install -e '.[lint]'
4545
4646
- name: Cache pre-commit
4747
uses: actions/cache@v5

.github/workflows/_test-integrations.yml

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
workflow_call:
88
workflow_dispatch:
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
pytest:
1215
name: Run Integration Tests
@@ -21,12 +24,12 @@ jobs:
2124
- "3.14"
2225
runs-on: ${{ matrix.os }}
2326
steps:
24-
- uses: actions/checkout@v5
27+
- uses: actions/checkout@v6
2528
with:
2629
submodules: recursive
2730

2831
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@v6
3033
with:
3134
python-version: ${{ matrix.python-version }}
3235

@@ -41,7 +44,7 @@ jobs:
4144
- name: Install dependencies
4245
run: |
4346
python -m pip install pip
44-
pip install -e .[test]
47+
pip install -e '.[test]'
4548
- name: Run Integration Testing
4649
env:
4750
MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }}
@@ -57,11 +60,60 @@ jobs:
5760
pytest --cov mindee -m integration
5861
5962
- name: Notify Slack Action on Failure
60-
uses: ravsamhq/notify-slack-action@2.3.0
63+
uses: ravsamhq/notify-slack-action@2.5.0
6164
if: ${{ always() && github.ref_name == 'main' }}
6265
with:
6366
status: ${{ job.status }}
6467
notify_when: "failure"
6568
notification_title: "[Python] Integration test '{workflow}' is failing"
6669
env:
6770
SLACK_WEBHOOK_URL: ${{ secrets.PRODUCTION_ISSUES_SLACK_HOOK_URL }}
71+
72+
pytest-lite:
73+
name: Run Integration Tests
74+
timeout-minutes: 30
75+
strategy:
76+
matrix:
77+
os:
78+
- "ubuntu-22.04"
79+
python-version:
80+
- "3.10"
81+
runs-on: ${{ matrix.os }}
82+
steps:
83+
- uses: actions/checkout@v6
84+
with:
85+
submodules: recursive
86+
87+
- name: Set up Python ${{ matrix.python-version }}
88+
uses: actions/setup-python@v6
89+
with:
90+
python-version: ${{ matrix.python-version }}
91+
92+
- name: Cache dependencies
93+
uses: actions/cache@v5
94+
with:
95+
path: ~/.cache/pip
96+
key: ${{ runner.os }}-test-${{ hashFiles('pyproject.toml') }}
97+
restore-keys: |
98+
${{ runner.os }}-test-
99+
100+
- name: Install dependencies
101+
run: |
102+
pip install toml
103+
python scripts/generate_lite_toml.py
104+
mv -f pyproject-lite.toml pyproject.toml
105+
pip install -e '.[test]'
106+
shell: bash
107+
- name: Run Integration Testing
108+
env:
109+
MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }}
110+
WORKFLOW_ID: ${{ secrets.WORKFLOW_ID_SE_TESTS }}
111+
MINDEE_V2_API_KEY: ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }}
112+
MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }}
113+
MINDEE_V2_SE_TESTS_BLANK_PDF_URL: ${{ secrets.MINDEE_V2_SE_TESTS_BLANK_PDF_URL }}
114+
MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID }}
115+
MINDEE_V2_SE_TESTS_CROP_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CROP_MODEL_ID }}
116+
MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID }}
117+
MINDEE_V2_SE_TESTS_OCR_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_OCR_MODEL_ID }}
118+
run: |
119+
pytest -m "integration and not pypdfium2 and not pillow"

.github/workflows/_test-regressions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Install dependencies
4242
run: |
4343
python -m pip install pip
44-
pip install -e .[test]
44+
pip install -e '.[test]'
4545
- name: Run Regression Testing
4646
env:
4747
MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }}

.github/workflows/_test-units.yml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
- "3.14"
2424
runs-on: ${{ matrix.os }}
2525
steps:
26-
- uses: actions/checkout@v5
26+
- uses: actions/checkout@v6
2727
with:
2828
submodules: recursive
2929

3030
- name: Set up Python ${{ matrix.python-version }}
31-
uses: actions/setup-python@v5
31+
uses: actions/setup-python@v6
3232
with:
3333
python-version: ${{ matrix.python-version }}
3434

@@ -43,10 +43,53 @@ jobs:
4343
- name: Install dependencies
4444
run: |
4545
python -m pip install pip
46-
pip install -e .[test]
46+
pip install -e '.[test]'
4747
4848
- name: Unit testing with pytest
49-
env:
50-
MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }}
5149
run: |
5250
pytest --cov mindee --cov-fail-under 87
51+
52+
pytest-lite:
53+
name: Run Unit Tests (Lite)
54+
timeout-minutes: 30
55+
strategy:
56+
matrix:
57+
os:
58+
- "ubuntu-22.04"
59+
- "windows-2022"
60+
python-version:
61+
- "3.10"
62+
- "3.11"
63+
- "3.12"
64+
- "3.13"
65+
- "3.14"
66+
runs-on: ${{ matrix.os }}
67+
steps:
68+
- uses: actions/checkout@v6
69+
with:
70+
submodules: recursive
71+
72+
- name: Set up Python ${{ matrix.python-version }}
73+
uses: actions/setup-python@v6
74+
with:
75+
python-version: ${{ matrix.python-version }}
76+
77+
- name: Cache dependencies
78+
uses: actions/cache@v5
79+
with:
80+
path: ~/.cache/pip
81+
key: ${{ runner.os }}-test-${{ hashFiles('pyproject.toml') }}
82+
restore-keys: |
83+
${{ runner.os }}-test-
84+
85+
- name: Install dependencies
86+
run: |
87+
pip install toml
88+
python scripts/generate_lite_toml.py
89+
mv -f pyproject-lite.toml pyproject.toml
90+
pip install -e '.[test]'
91+
shell: bash
92+
- name: Unit testing with pytest
93+
run: |
94+
pytest
95+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint workflows
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
actionlint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Download actionlint
15+
id: get_actionlint
16+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
17+
shell: bash
18+
- name: Run actionlint
19+
run: ${{ steps.get_actionlint.outputs.executable }} -color
20+
shell: bash

.github/workflows/pull-request.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ permissions:
88
pull-requests: read
99

1010
jobs:
11+
workflow-lint:
12+
uses: ./.github/workflows/_workflow_lint.yml
1113
static-analysis:
1214
uses: ./.github/workflows/_static-analysis.yml
15+
needs: workflow-lint
1316
test-units:
1417
uses: ./.github/workflows/_test-units.yml
1518
needs: static-analysis

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,4 @@ _test.py
140140
_test*.py
141141
_test.json
142142
local_test
143+
pyproject-lite.toml

0 commit comments

Comments
 (0)