Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7da8b90
:rewind: revert URL safety checks (#455)
sebO-S Jul 21, 2026
a45b562
:sparkles: add full support for image processing through bernard l'édit
sebO-S Jun 26, 2026
c5865c4
rehaul all to accomodate newer changes in bernie
sebO-S Oct 13, 2026
b69b78d
fix
sebO-S Oct 14, 2026
b8e3f98
update syntax to use more bernard logic
sebO-S Oct 16, 2026
9542f99
upgrade test so that it's less ugly
sebO-S Oct 16, 2026
0ccdd4f
fix stuff
sebO-S Oct 16, 2026
400b366
fix bernard-linking
sebO-S Oct 16, 2026
05e9940
fix mypy in CI?
sebO-S Oct 19, 2026
531736b
add debug
sebO-S Oct 19, 2026
4242c14
bump bernie
sebO-S Oct 19, 2026
6c131ad
move debug step
sebO-S Oct 19, 2026
98b5631
fix build
sebO-S Oct 19, 2026
fe4d598
fix missing step
sebO-S Oct 19, 2026
cc16b3d
fix broken bernie import
sebO-S Oct 19, 2026
018ea04
fix test?
sebO-S Oct 19, 2026
770bebb
add missing mark (huhh?)
sebO-S Oct 19, 2026
b307376
fix test
sebO-S Oct 19, 2026
2b3465a
Sync image compression API and remove fallback
bashirmindee Nov 12, 2026
b2bbb72
Use shared format inference for extracted files
bashirmindee Nov 13, 2026
80e8134
Render PDF pages through the page API
bashirmindee Nov 13, 2026
5d4eda4
Use to_bytes for PDF serialization
bashirmindee Nov 13, 2026
018dfc2
use read bytes instead of passing a file like object
bashirmindee Nov 13, 2026
d1d7011
fix tests
bashirmindee Nov 27, 2026
eceead1
use bernard-ledit submodule
bashirmindee Nov 27, 2026
6da4c8e
chg: Merge main into Bernard branch
bashirmindee Nov 27, 2026
6472d9f
fix lint
bashirmindee Nov 27, 2026
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
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ updates:
- "requests"
optional-dependencies:
patterns:
- "pypdfium2"
- "Pillow"
- "bernard_ledit"
test-dependencies:
patterns:
- "pytest"
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/_build-bernard-ledit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build bernard-ledit Wheel

on:
workflow_call:
workflow_dispatch:

permissions:
contents: read

jobs:
build-wheel:
name: Build bernard-ledit wheel
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- "ubuntu-24.04"
- "windows-2022"
- "macos-latest"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"

- uses: ./bernard-ledit/.github/actions/setup-libheif

- uses: ./bernard-ledit/.github/actions/setup-pdfium

- uses: dtolnay/rust-toolchain@1.99.0

- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: bernard-ledit

- name: Build bernard-ledit wheel
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip wheel --no-deps --wheel-dir ./.github/artifacts/bernard-ledit bernard-ledit/bindings/python/

- name: Upload bernard-ledit build
uses: actions/upload-artifact@v4
with:
name: bernard-ledit-wheel-${{ runner.os }}
path: ./.github/artifacts/bernard-ledit/*.whl
if-no-files-found: error
11 changes: 10 additions & 1 deletion .github/workflows/_smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version:
- "3.10"
- "3.14"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
steps:
- uses: actions/checkout@v7
with:
Expand All @@ -42,9 +42,18 @@ jobs:
restore-keys: |
${{ runner.os }}-samples-

- name: Download prebuilt bernard-ledit wheel
uses: actions/download-artifact@v5
with:
name: bernard-ledit-wheel-${{ runner.os }}
path: ./.github/artifacts/bernard-ledit

- uses: ./bernard-ledit/.github/actions/setup-libheif

- name: Install dependencies
run: |
python -m pip install pip
python -c "from pathlib import Path; import subprocess, sys; wheels = list(Path('.github/artifacts/bernard-ledit').glob('*.whl')); assert len(wheels) == 1, 'Expected one Bernard wheel'; subprocess.check_call([sys.executable, '-m', 'pip', 'install', str(wheels[0])])"
pip install -e '.'

- name: Tests v2 sample code
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/_static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ on:
jobs:
static-check:
name: Run Static Analysis
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v7
Expand All @@ -26,15 +29,28 @@ jobs:
restore-keys: |
${{ runner.os }}-lint-

- name: Download prebuilt bernard-ledit wheel
uses: actions/download-artifact@v5
with:
name: bernard-ledit-wheel-${{ runner.os }}
path: ./.github/artifacts/bernard-ledit

- uses: ./bernard-ledit/.github/actions/setup-libheif

- name: Install dependencies
run: |
python -m pip install pip
python -c "from pathlib import Path; import subprocess, sys; wheels = list(Path('.github/artifacts/bernard-ledit').glob('*.whl')); assert len(wheels) == 1, 'Expected one Bernard wheel'; subprocess.check_call([sys.executable, '-m', 'pip', 'install', str(wheels[0])])"
pip install -e '.[lint]'

- name: License check
run: |
pylic check --allow-extra-safe-licenses

- name: Audit dependencies
run: |
pip-audit --local --skip-editable

- name: Cache pre-commit
uses: actions/cache@v6
with:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/_test-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
max-parallel: 4
matrix:
os:
- "ubuntu-22.04"
- "ubuntu-24.04"
- "macos-latest"
- "windows-2022"
python-version:
Expand All @@ -48,9 +48,18 @@ jobs:
restore-keys: |
${{ runner.os }}-cli-

- name: Download prebuilt bernard-ledit wheel
uses: actions/download-artifact@v5
with:
name: bernard-ledit-wheel-${{ runner.os }}
path: ./.github/artifacts/bernard-ledit

- uses: ./bernard-ledit/.github/actions/setup-libheif

- name: Install dependencies
run: |
python -m pip install pip
python -c "from pathlib import Path; import subprocess, sys; wheels = list(Path('.github/artifacts/bernard-ledit').glob('*.whl')); assert len(wheels) == 1, 'Expected one Bernard wheel'; subprocess.check_call([sys.executable, '-m', 'pip', 'install', str(wheels[0])])"
pip install -e '.'

- name: Test V1 CLI
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/_test-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
os:
- "ubuntu-22.04"
- "ubuntu-24.04"
- "windows-2022"
python-version:
- "3.10"
Expand All @@ -52,9 +52,18 @@ jobs:
restore-keys: |
${{ runner.os }}-test-

- name: Download prebuilt bernard-ledit wheel
uses: actions/download-artifact@v5
with:
name: bernard-ledit-wheel-${{ runner.os }}
path: ./.github/artifacts/bernard-ledit

- uses: ./bernard-ledit/.github/actions/setup-libheif

- name: Install dependencies
run: |
python -m pip install pip
python -c "from pathlib import Path; import subprocess, sys; wheels = list(Path('.github/artifacts/bernard-ledit').glob('*.whl')); assert len(wheels) == 1, 'Expected one Bernard wheel'; subprocess.check_call([sys.executable, '-m', 'pip', 'install', str(wheels[0])])"
pip install -e '.[test]'
- name: Run Integration Testing
run: |
Expand Down Expand Up @@ -107,4 +116,4 @@ jobs:
shell: bash
- name: Run Integration Testing
run: |
pytest -n 2 -m "integration and not pypdfium2 and not pillow"
pytest -m "integration and not bernard_ledit"
11 changes: 10 additions & 1 deletion .github/workflows/_test-regressions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os:
- "ubuntu-22.04"
- "ubuntu-24.04"
- "windows-2022"
python-version:
- "3.10"
Expand All @@ -38,9 +38,18 @@ jobs:
restore-keys: |
${{ runner.os }}-test-

- name: Download prebuilt bernard-ledit wheel
uses: actions/download-artifact@v5
with:
name: bernard-ledit-wheel-${{ runner.os }}
path: ./.github/artifacts/bernard-ledit

- uses: ./bernard-ledit/.github/actions/setup-libheif

- name: Install dependencies
run: |
python -m pip install pip
python -c "from pathlib import Path; import subprocess, sys; wheels = list(Path('.github/artifacts/bernard-ledit').glob('*.whl')); assert len(wheels) == 1, 'Expected one Bernard wheel'; subprocess.check_call([sys.executable, '-m', 'pip', 'install', str(wheels[0])])"
pip install -e '.[test]'
- name: Run Regression Testing
env:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/_test-units.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ jobs:
strategy:
matrix:
os:
- "ubuntu-22.04"
- "ubuntu-24.04"
- "windows-2022"
- "macos-latest"
python-version:
- "3.10"
- "3.11"
Expand All @@ -40,9 +41,18 @@ jobs:
restore-keys: |
${{ runner.os }}-test-

- name: Download prebuilt bernard-ledit wheel
uses: actions/download-artifact@v5
with:
name: bernard-ledit-wheel-${{ runner.os }}
path: ./.github/artifacts/bernard-ledit

- uses: ./bernard-ledit/.github/actions/setup-libheif

- name: Install dependencies
run: |
python -m pip install pip
python -c "from pathlib import Path; import subprocess, sys; wheels = list(Path('.github/artifacts/bernard-ledit').glob('*.whl')); assert len(wheels) == 1, 'Expected one Bernard wheel'; subprocess.check_call([sys.executable, '-m', 'pip', 'install', str(wheels[0])])"
pip install -e '.[test]'

- name: Unit testing with pytest
Expand All @@ -57,6 +67,7 @@ jobs:
os:
- "ubuntu-22.04"
- "windows-2022"
- "macos-latest"
python-version:
- "3.10"
- "3.14"
Expand Down Expand Up @@ -90,4 +101,3 @@ jobs:
- name: Unit testing with pytest
run: |
pytest

5 changes: 5 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ permissions:
actions: read

jobs:
build-bernard-ledit:
uses: mindee/mindee-api-python/.github/workflows/_build-bernard-ledit.yml@main
test-regressions:
uses: mindee/mindee-api-python/.github/workflows/_test-regressions.yml@main
needs: build-bernard-ledit
secrets: inherit
test-code-samples:
uses: mindee/mindee-api-python/.github/workflows/_smoke-test.yml@main
needs: build-bernard-ledit
secrets: inherit
test-cli:
uses: mindee/mindee-api-python/.github/workflows/_test-cli.yml@main
needs: build-bernard-ledit
secrets: inherit
8 changes: 6 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ permissions:
jobs:
workflow-lint:
uses: mindee/client-lib-actions/.github/workflows/workflow-lint.yml@main
build-bernard-ledit:
uses: ./.github/workflows/_build-bernard-ledit.yml
betterleaks:
uses: mindee/client-lib-actions/.github/workflows/betterleaks.yml@main
needs: workflow-lint
secrets: inherit
static-analysis:
uses: ./.github/workflows/_static-analysis.yml
needs: workflow-lint
needs:
- workflow-lint
- build-bernard-ledit
test-units:
uses: ./.github/workflows/_test-units.yml
needs: [ betterleaks, static-analysis ]
needs: [ build-bernard-ledit, betterleaks, static-analysis ]
secrets: inherit
test-regressions:
uses: ./.github/workflows/_test-regressions.yml
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/push-main-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
- main

jobs:
build-bernard-ledit:
uses: ./.github/workflows/_build-bernard-ledit.yml
betterleaks:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
uses: mindee/client-lib-actions/.github/workflows/betterleaks.yml@main
secrets: inherit
static-analysis:
uses: ./.github/workflows/_static-analysis.yml
needs: build-bernard-ledit
test-units:
uses: ./.github/workflows/_test-units.yml
needs: [ betterleaks, static-analysis ]
needs: [ build-bernard-ledit, betterleaks, static-analysis ]
secrets: inherit
tag:
uses: mindee/client-lib-actions/.github/workflows/tag-version.yml@main
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "tests/data"]
path = tests/data
url = git@github.com:mindee/client-lib-test-data.git
[submodule "bernard-ledit"]
path = bernard-ledit
url = https://github.com/mindee/bernard-ledit.git
branch = refacto
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ Please follow these steps to have your contribution considered by the maintainer

While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.

### Bernard l'Édit

Initialize the submodules before you build or test:

```bash
git submodule update --init --recursive
```

Follow the [Bernard build prerequisites](bernard-ledit/README.md#development), then install the
Python binding from the submodule:

```bash
python -m pip install -e ./bernard-ledit/bindings/python
python -m pip install -e '.[test]'
```

CI builds the same submodule commit. To use a newer commit from `refacto`, update the submodule
and commit its new revision.

## Styleguides

### Git Commit Messages
Expand Down
1 change: 1 addition & 0 deletions bernard-ledit
Submodule bernard-ledit added at cb09a3
10 changes: 4 additions & 6 deletions mindee/dependencies/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from mindee.dependencies.checkers import PILLOW_AVAILABLE, PYPDFIUM2_AVAILABLE
from mindee.dependencies.decorators import requires_pillow, requires_pypdfium2
from mindee.dependencies.checkers import BERNARD_LEDIT_AVAILABLE
from mindee.dependencies.decorators import requires_bernard_ledit

__all__ = [
"PILLOW_AVAILABLE",
"PYPDFIUM2_AVAILABLE",
"requires_pillow",
"requires_pypdfium2",
"BERNARD_LEDIT_AVAILABLE",
"requires_bernard_ledit",
]
Loading
Loading