Skip to content
Closed
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
26 changes: 26 additions & 0 deletions .github/actions/check-minimal-pip-and-certifi-versions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Check minimal Pip and Certifi package versions
description: Check that Pip package and Certifi package versions are at least as specified
inputs:
minimal-pip-version:
description: Minimal version required for Pip
required: true
minimal-certifi-version:
description: Minimal version required for Certifi
required: true
python:
description: Python executable (name on PATH or full path)
required: false
default: python
runs:
using: composite
steps:
- name: Check that the Pip and Certifi package versions are as specified
shell: bash
env:
PYTHON: ${{ inputs.python }}
MINIMAL_PIP_VERSION: ${{ inputs.minimal-pip-version }}
MINIMAL_CERTIFI_VERSION: ${{ inputs.minimal-certifi-version }}
run: |-
"$PYTHON" "$GITHUB_ACTION_PATH/check_minimal_pip_and_certifi_versions.py" \
"$MINIMAL_PIP_VERSION" "$MINIMAL_CERTIFI_VERSION"
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (c) 2023-2026 Orange. All rights reserved.
# This software is distributed under the BSD 3-Clause-clear License, the text
# of which is available at
# https://spdx.org/licenses/BSD-3-Clause-Clear.html or see the "LICENSE" file
# for more details.

import sys
from importlib.metadata import PackageNotFoundError, version

# Pip may be absent (e.g. in a uv virtual environment): fall back to the
# 'packaging' package, and to None if neither is available
try:
from pip._vendor.packaging.version import Version
except ImportError:
try:
from packaging.version import Version
except ImportError:
Version = None


def installed_version(package_name):
try:
return version(package_name)
except PackageNotFoundError:
return None


minimal_pip_version, minimal_certifi_version = sys.argv[1:3]

pip_version = installed_version("pip")
certifi_version = installed_version("certifi")

# Use Pip's vendored Certifi when Certifi is not installed
if certifi_version is None and pip_version is not None:
from pip._vendor import certifi

certifi_version = certifi.__version__

version_check_failure = False
for package_name, current_version, minimal_version in [
("pip", pip_version, minimal_pip_version),
("certifi", certifi_version, minimal_certifi_version),
]:
# An absent package cannot be older than the minimal version
if current_version is None:
print(f"'{package_name}' is not installed: nothing to check")
continue
if Version is None:
print(
f"::error::Neither Pip nor 'packaging' is available to compare "
f"the '{package_name}' version"
)
version_check_failure = True
continue
if Version(current_version) < Version(minimal_version):
print(
f"::error::'{package_name}' {current_version} found, >= "
f"{minimal_version} required"
)
version_check_failure = True
else:
print(
f"'{package_name}' version is OK: {current_version} (>= "
f"{minimal_version})"
)
sys.exit(1 if version_check_failure else 0)
69 changes: 41 additions & 28 deletions .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
name: API Docs
env:
DEFAULT_KHIOPS_REVISION: 11.0.1
DEFAULT_KHIOPS_PYTHON_TUTORIAL_REVISION: 11.0.0.0
DEFAULT_KHIOPS_SAMPLES_REVISION: 11.0.0
MINIMAL_PIP_VERSION: 26.2.2
MINIMAL_CERTIFI_VERSION: 2026.10.19
# Never use system-level Python
UV_PYTHON_PREFERENCE: only-managed
on:
workflow_dispatch:
inputs:
khiops-revision:
description: Khiops core version
default: 11.0.1
khiops-python-tutorial-revision:
default: 11.0.0.0
description: khiops-python-tutorial repo revision
Expand All @@ -25,6 +25,10 @@ on:
- zensical.toml
- khiops/**.py
- .github/workflows/api-docs.yml
- .github/actions/check-minimal-pip-and-certifi-versions/**
- pyproject.toml
- doc/util/requirements.txt
- scripts/extract_dependencies_from_pyproject_toml.py
permissions:
contents: read
concurrency:
Expand All @@ -35,57 +39,66 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout khiops-python
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Add pip scripts directory to path
run: echo PATH="$PATH:/github/home/.local/bin" >> "$GITHUB_ENV"
- name: Generate version constraints
run: |
printf 'pip>=%s\ncertifi>=%s\n' \
"$MINIMAL_PIP_VERSION" "$MINIMAL_CERTIFI_VERSION" > "$RUNNER_TEMP/constraints.txt"
echo "UV_CONSTRAINT=$RUNNER_TEMP/constraints.txt" >> "$GITHUB_ENV"
echo "UV_BUILD_CONSTRAINT=$RUNNER_TEMP/constraints.txt" >> "$GITHUB_ENV"
- name: Setup uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v10.3.2
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install Khiops core
enable-cache: false
version: 0.13.5
python-version: '3.14'
- name: Create the virtual environment
run: |
# Create the .venv virtual environment and activate it
uv venv
. .venv/bin/activate

# Building the Python API docs always executes khiops-python's own
# tutorial notebooks (create-doc -t -d), so a real Khiops core
# install is required unconditionally.
uv pip install khiops-core==${{ inputs.khiops-revision || env.DEFAULT_KHIOPS_REVISION }}
# Persist the activation for all later steps
echo "VIRTUAL_ENV=$PWD/.venv" >> "$GITHUB_ENV"
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
- name: Install doc build requirements
env:
KHIOPS_SAMPLES_REVISION: ${{ inputs.khiops-samples-revision || env.DEFAULT_KHIOPS_SAMPLES_REVISION }}
run: |
# Install package itself to install the samples datasets
# Add homogeneous TOML support (Python >= 3.12 has standard tomllib)
uv pip install tomli
# First, install all dependencies except khiops-core and khiops-drivers-*
uv run scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" --exclude-khiops-family > requires-no-khiops.txt
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" --exclude-khiops-family > requires-no-khiops.txt
uv pip install `cat requires-no-khiops.txt`
# khiops-core and khiops-drivers-* must always be installed from TestPyPI in order to avoid distorting usage statistics
uv run scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" --khiops-family-only > requires-khiops.txt
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" --khiops-family-only > requires-khiops.txt
uv pip install --index-url https://test.pypi.org/simple `cat requires-khiops.txt`
rm -f requires-khiops.txt requires-no-khiops.txt
# Lastly, install khiops-python
uv pip install .
uv run kh-download-datasets --force-overwrite --version ${{ inputs.khiops-samples-revision || env.DEFAULT_KHIOPS_SAMPLES_REVISION }}
kh-download-datasets --force-overwrite --version "${KHIOPS_SAMPLES_REVISION}"

# Discard error as this is expected (Uv is not yet officially
# supported by khiops, but this should pose no issue in practice)
# TODO: Revert as soon as issue
# https://github.com/KhiopsML/khiops-python/issues/602 is tackled
uv run kh-status || true
kh-status || true

# Install the doc python requirements
uv pip install -U -r doc/util/requirements.txt
# After all installs, on the interpreter of the .venv that builds the
# docs. Pip and Certifi are checked if installed.
- name: Check minimal Pip and Certifi versions
uses: ./.github/actions/check-minimal-pip-and-certifi-versions
with:
minimal-pip-version: ${{ env.MINIMAL_PIP_VERSION }}
minimal-certifi-version: ${{ env.MINIMAL_CERTIFI_VERSION }}
python: ${{ github.workspace }}/.venv/bin/python
# Clone the Khiops Python tutorial repository while building the documentation
- name: Build Zensical Documentation
run: |
doc/util/create-doc -t -d -g \
${{ inputs.khiops-python-tutorial-revision || env.DEFAULT_KHIOPS_PYTHON_TUTORIAL_REVISION }}
env:
KHIOPS_PYTHON_TUTORIAL_REVISION: ${{ inputs.khiops-python-tutorial-revision || env.DEFAULT_KHIOPS_PYTHON_TUTORIAL_REVISION }}
run: doc/util/create-doc -t -d -g "${KHIOPS_PYTHON_TUTORIAL_REVISION}"
- name: Upload the docs as an artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: api-docs
path: ./doc/build/html/
12 changes: 6 additions & 6 deletions .github/workflows/dev-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Dev Docker
env:
DEFAULT_CURRENT_IMAGE_TAG: dev
DEFAULT_SERVER_REVISION: main
DEFAULT_PYTHON_VERSIONS: 3.10 3.11 3.12 3.13 3.14
DEFAULT_PYTHON_VERSIONS: 3.11 3.12 3.13 3.14
on:
pull_request:
paths: [packaging/docker/khiopspydev/Dockerfile.*, .github/workflows/dev-docker.yml]
Expand All @@ -23,7 +23,7 @@ on:
description: Set as 'latest' (if the current branch is 'main')
python-versions:
type: string
default: 3.10 3.11 3.12 3.13 3.14
default: 3.11 3.12 3.13 3.14
description: Python versions to support
server-revision:
type: string
Expand Down Expand Up @@ -65,12 +65,12 @@ jobs:
echo "SERVER_REVISION=${{ inputs.server-revision || env.DEFAULT_SERVER_REVISION }}" >> "$GITHUB_ENV"
echo "IMAGE_URL=ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.khiopsdev-os }}" >> "$GITHUB_ENV"
- name: Checkout khiops-python sources
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Set up Docker Buildx
id: docker-build
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4.4.1
- name: Login to Github Packages
uses: docker/login-action@v3
uses: docker/login-action@v4.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -88,7 +88,7 @@ jobs:
fi
echo "DOCKER_IMAGE_TAGS=$DOCKER_IMAGE_TAGS" >> "$GITHUB_ENV"
- name: Build image and push it to GitHub Container Registry
uses: docker/build-push-action@v5
uses: docker/build-push-action@v7.4.0
with:
# Special hostname used by the integration tests for remote file access
# added using inputs because /etc/hosts is read-only for alternate builders (buildx via moby buildkit)
Expand Down
Loading
Loading