From a92ad48b287bfcb134011dc0fc3f91ee04e067ee Mon Sep 17 00:00:00 2001 From: Michele Dolfi <97102151+dolfim-ibm@users.noreply.github.com> Date: Mon, 10 Mar 2025 16:19:34 +0100 Subject: [PATCH] fix: submodules in wheels (#85) Signed-off-by: Michele Dolfi --- .github/workflows/job-build.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/job-checks.yml | 26 ++++++++++++++++++++++++++ .github/workflows/pypi.yml | 18 ++++++++++-------- pyproject.toml | 3 ++- 4 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/job-build.yml diff --git a/.github/workflows/job-build.yml b/.github/workflows/job-build.yml new file mode 100644 index 0000000..fb86dca --- /dev/null +++ b/.github/workflows/job-build.yml @@ -0,0 +1,29 @@ +name: Run checks + +on: + workflow_call: + +jobs: + 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 --no-extra cu124 + - 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/ diff --git a/.github/workflows/job-checks.yml b/.github/workflows/job-checks.yml index 40b8982..8137bbe 100644 --- a/.github/workflows/job-checks.yml +++ b/.github/workflows/job-checks.yml @@ -21,6 +21,32 @@ jobs: - name: Run styling check run: uv run --no-sync pre-commit run --all-files + build-package: + uses: ./.github/workflows/job-build.yml + + 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: Create the server + run: python -c 'from docling_serve.app import create_app; create_app()' + markdown-lint: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index eed0b09..6d2de76 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -8,7 +8,13 @@ permissions: contents: read jobs: + + build-package: + uses: ./.github/workflows/job-build.yml + build-and-publish: + needs: + - build-package runs-on: ubuntu-latest environment: name: pypi @@ -16,15 +22,11 @@ jobs: permissions: id-token: write # IMPORTANT: mandatory for trusted publishing steps: - - uses: actions/checkout@v4 - - name: Install uv and set the python version - uses: astral-sh/setup-uv@v5 + - name: Download all the dists + uses: actions/download-artifact@v4 with: - enable-cache: true - - name: Install dependencies - run: uv sync --all-extras --no-extra cu124 - - name: Build - run: uv build + name: python-package-distributions + path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/pyproject.toml b/pyproject.toml index fafe2b0..7cb6c85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,7 +102,8 @@ url = "https://download.pytorch.org/whl/cu124" explicit = true [tool.setuptools.packages.find] -include = ["docling_serve"] +include = ["docling_serve*"] +namespaces = true [project.scripts] docling-serve = "docling_serve.__main__:main"