Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 6 additions & 7 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ jobs:


- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
python-version: "3.11"
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
python-version: "3.11"

- name: Install dependencies
run: UV=$(which uv) PIP=$(which pip) make install
run: make install

- name: Publish documentation
run: |
mkdocs gh-deploy --force
run: uv run mkdocs gh-deploy --force
7 changes: 3 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ jobs:
- uses: actions/checkout@v4

- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
python-version: "3.11"

- name: Install dependencies
run: UV=$(which uv) PIP=$(which pip) make install
run: make install

- name: Run linting
run: |
UV=$(which uv) PIP=$(which pip) make lint
run: make lint
4 changes: 2 additions & 2 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
uses: actions/checkout@v4

- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
python-version: "3.11"

- name: Install dependencies
run: UV=$(which uv) PIP=$(which pip) make install
run: make install

- name: Build documentation (without strict mode due to known warnings)
run: |
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test-sftp-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ jobs:
- uses: actions/checkout@v4

- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
python-version: "3.11"
activate-environment: true

- name: Generate SSH key pair (SSH key auth only)
if: matrix.auth-type == 'ssh-key'
Expand Down Expand Up @@ -93,9 +92,7 @@ jobs:
fi

- name: Install dependencies
run: |
uv lock
uv --no-progress pip install -e ".[test, sftp]"
run: uv sync --extra test --extra sftp

- name: Setup test data on SFTP server
run: |
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Cache venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
venv-${{ runner.os }}-${{ matrix.python-version }}-

- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
python-version: ${{ matrix.python-version }}
activate-environment: true

- name: Install dependencies (minimal)
if: matrix.test-type == 'minimal'
run: |
uv lock
uv --no-progress pip install -e ".[test]"
run: uv sync --extra test

- name: Install dependencies (full)
if: matrix.test-type == 'full'
run: |
uv lock
uv lock
make install UV="uv" PIP="pip" SYSTEM_PYTHON="python${{ matrix.python-version }}"
run: make install

- name: Test minimal installation
if: matrix.test-type == 'minimal'
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
72 changes: 24 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,73 +1,49 @@
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
#
# SPDX-License-Identifier: CC0-1.0
.PHONY: install test clean
# Requires uv (https://docs.astral.sh/uv/). First-time: run 'make lock' then 'make install'.
.PHONY: install test clean build lock lint documentation reuse-lint
SRC_DIR = ./wurzel
TEST_DIR= ./tests
TEST_DIR = ./tests
VENV = .venv
SYSTEM_PYTHON?= python3.12
SHELL := bash

$(VENV)/.venv_created:
@uv venv $(VENV)
@touch $(VENV)/.venv_created

ifeq ($(OS),Windows_NT)
PY ?= $(VENV)/Scripts/python.exe
PIP ?= $(VENV)/Scripts/pip.exe
UV ?= $(VENV)/Scripts/uv.exe
else
PY ?= $(VENV)/bin/python
PIP ?= $(VENV)/bin/pip
UV ?= $(VENV)/bin/uv
endif

install: $(VENV)/.venv_created
uv sync --all-extras
uv run pre-commit install

build: install
$(UV) pip install build
$(PY) -m build .

$(VENV)/touchfile: pyproject.toml $(UV)
$(UV) --no-progress pip install -r pyproject.toml --all-extras
@$(shell if [ "$(OS)" = "Windows_NT" ]; then echo type nul > $(VENV)\\touchfile; else echo touch $(VENV)/touchfile; fi)
$(PY):
$(SYSTEM_PYTHON) -m venv $(VENV)

$(UV): $(PY)
$(PIP) install --upgrade pip
$(PIP) install uv

install: $(VENV)/touchfile
$(UV) run pre-commit install

UNAME_S := $(shell uname)
uv build

test: install
@echo "🧪 Running tests..."
ifeq ($(UNAME_S),Darwin)
ifneq ($(GITHUB_ACTIONS),)
@echo "Running tests on MacOS in GitHub pipeline"
@echo "Skipping coverage check"
# https://github.com/actions/runner-images/issues/9918
# Docling coverage is not working when tests are skipped on MacOS
$(UV) run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov=$(SRC_DIR)
else
$(UV) run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR)
endif
else
$(UV) run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR)
endif
@UNAME_S=$$(uname); \
if [ "$$UNAME_S" = "Darwin" ] && [ -n "$$GITHUB_ACTIONS" ]; then \
echo "Running tests on MacOS in GitHub pipeline"; \
echo "Skipping coverage check"; \
uv run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov=$(SRC_DIR); \
elif [ "$$UNAME_S" = "Darwin" ]; then \
uv run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR); \
else \
uv run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR); \
fi

lint: install
@echo "🔍 Running lint checks..."
$(UV) run pre-commit run --all-files
uv run pre-commit run --all-files

clean:
@echo "🧹 Cleaning up..."
@rm -rf __pycache__ ${SRC_DIR}/*.egg-info **/__pycache__ .pytest_cache
@rm -rf .coverage reports dist
@rm -rf .coverage reports dist $(VENV)

documentation: install
@echo "📚 Serving documentation..."
$(UV) run mkdocs serve
uv run mkdocs serve

.PHONY: reuse-lint
reuse-lint:
$(UV) run reuse lint
uv run reuse lint
1 change: 1 addition & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ path = [
"**/requirements.txt",
"**/*.pyc",
"**/__pycache__/**",
".python-version",
]
precedence = "override"
SPDX-FileCopyrightText = "NONE"
Expand Down
Loading