mirror of
https://github.com/docling-project/docling-core.git
synced 2026-11-18 20:27:00 +00:00
* What was removed The legacy_doc document model and the rec (Record) types, plus all code/resources/tests that existed only to serve them. Deleted packages/modules - docling_core/types/legacy_doc/ (whole folder) - docling_core/types/rec/ (whole folder) - docling_core/utils/legacy.py (legacy conversion functions) - docling_core/utils/validate.py (RAW/ANN/OCR CLI) Edited production code - types/__init__.py — dropped the Record export - utils/validators.py — removed validate_schema/validate_raw_schema/validate_ann_schema/validate_ocr_schema and their now-unused imports; kept validate_unique_list/validate_datetime - utils/generate_docs.py — dropped Record from MODELS Removed resources/artifacts - resources/schemas/doc/ (legacy RAW/ANN/OCR/DOC), resources/schemas/generated/ccs_document_schema.json, docs/Record.json Tests — deleted the 5 legacy/rec-only suites + 2 stale gold files; trimmed test_collection.py, test_base.py, test_doc_base.py to keep their non-legacy parts; replaced the _create_hash import in test_code_chunker.py with a local helper. Removed test/data/legacy_doc/ and test/data/rec/. Verification - No dangling code references remain (only string literals and the vendored _reference/chunker_repo scratch data, intentionally untouched). - from docling_core.types import DoclingDocument, Generic works; Record now correctly raises ImportError. - Full project suite: 496 passed. - generate_docs.py now emits only DoclingDocument.json and Generic.json. The full plan is saved at _plans/remove-legacy-doc-and-rec.md. Two notes worth flagging: - Breaking public API: docling_core.types.Record and the docling_core.utils.legacy conversion functions were public — downstream docling uses legacy_to_docling_document/docling_document_to_legacy. The branch name (dev/remove-legacy-document) suggests this is intended, but it'll need a coordinated bump downstream. - I left _reference/ and _plans/ alone (untracked scratch dirs). Nothing was committed — all changes are staged/working-tree only, per your edit-by-edit approval flow. Signed-off-by: Peter Staar <taa@zurich.ibm.com> * updated the checks.yaml Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed docling_core/types/gen/, docling_core/types/nlp, docling_core/types/legacy_doc, docling_core/types/rec Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed the minimal_document_schema_flat.json Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed docling_core/resources Signed-off-by: Peter Staar <taa@zurich.ibm.com> * removed the files and updated the imports according to Cesar's suggestion Signed-off-by: Peter Staar <taa@zurich.ibm.com> * fixed the ruff linter Signed-off-by: Peter Staar <taa@zurich.ibm.com> --------- Signed-off-by: Peter Staar <taa@zurich.ibm.com>
97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
push_coverage:
|
|
type: boolean
|
|
description: "If true, the coverage results are pushed to codecov.io."
|
|
default: true
|
|
secrets:
|
|
CODECOV_TOKEN:
|
|
required: false
|
|
|
|
env:
|
|
HF_HUB_DOWNLOAD_TIMEOUT: "60"
|
|
HF_HUB_ETAG_TIMEOUT: "60"
|
|
|
|
jobs:
|
|
run-checks:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Cache Hugging Face models
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/huggingface
|
|
key: huggingface-cache-py${{ matrix.python-version }}
|
|
- name: Install uv and set the python version
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
enable-cache: true
|
|
- name: pre-commit cache key
|
|
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pre-commit
|
|
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
|
- name: Install dependencies
|
|
run: uv sync --frozen --all-extras
|
|
- name: Check style and run tests
|
|
run: pre-commit run --all-files
|
|
- name: Upload coverage to Codecov
|
|
if: inputs.push_coverage
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./coverage.xml
|
|
|
|
build-package:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.12']
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install uv and set the python version
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
enable-cache: true
|
|
- name: Install dependencies
|
|
run: uv sync --all-extras
|
|
- name: Build package
|
|
run: uv build
|
|
- name: Check content of wheel
|
|
run: unzip -l dist/*.whl
|
|
- name: Store the distribution packages
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: python-package-distributions
|
|
path: dist/
|
|
|
|
test-package:
|
|
needs:
|
|
- build-package
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.12']
|
|
steps:
|
|
- name: Download all the dists
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: python-package-distributions
|
|
path: dist/
|
|
- name: Install uv and set the python version
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
enable-cache: true
|
|
- name: Install package
|
|
run: uv pip install dist/*.whl
|
|
- name: Load the DoclingDocument package
|
|
run: python -c 'from docling_core.types.doc import DoclingDocument'
|