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
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Keep changes inside these layer boundaries.

### Python Support Policy

- CI tests run against Python 3.10–3.14.
- CI tests run against Python 3.11-3.14.

### Versioning

Expand Down
92 changes: 65 additions & 27 deletions .github/instructions/ci-workflows.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,31 @@ the workflow file itself. Also supports `workflow_dispatch`.

Three job groups:

- **`run`** (Linux matrix): Runs across Python 3.10–3.14 in custom Docker
containers (`ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04`). Each
- **`run`** (Linux matrix): Runs across Python 3.11-3.14 on `ubuntu-24.04` in
custom Docker containers
(`ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu24.04`). Each
Comment thread
tpochon marked this conversation as resolved.
Resolved
Python version uses a dedicated Conda environment with native Khiops.
Conda and Pip are invoked through `conda run -n` without activation.
Coverage is collected with `coverage` and reported as XML. Test results use
JUnit XML via `unittest-xml-reporting`.
- **`check-khiops-integration-on-linux`**: Runs integration tests on multiple
Linux containers (ubuntu22.04, rocky8, rocky9, debian13). Validates Khiops
status, runs samples and the integration tests suite.
- **`check-khiops-integration-on-linux`**: Runs integration tests on
`ubuntu-24.04` in multiple Linux containers (ubuntu24.04, rocky8, rocky9,
debian13). The cloned sources are tested, not an installed package. The
interpreter is stored in `PYTHON` (via `$GITHUB_ENV`) and used directly in
all subsequent steps, hence no virtual environment is ever activated. On
Ubuntu and Debian, where the system Python is externally managed (PEP 668),
`PYTHON` is the interpreter of a `khiops-venv` virtual environment, whose
`bin` directory is also added to `$PATH` in the steps that need it (the Khiops
runner looks for `khiops_env` in the `PATH`). On Rocky, the system-wide Python
3.11 is used.
New Debian or Ubuntu containers must be added to the venv condition.
- **`check-khiops-integration-on-windows`**: Installs Khiops Desktop via NSIS
installer on Windows 2022 with Python 3.12. Runs integration tests and
samples outside a Python virtual environment, then installs khiops-python
inside a venv and validates the installation status.
installer on Windows 2022 with Python 3.14 (`setup-python`). Runs
integration tests and samples from the cloned sources with the
`setup-python` interpreter (system-wide dependencies; an "improper setup"
status is expected). It then creates `khiops-windows-venv` (never
activated; its `python.exe` is invoked directly), installs khiops-python
from the sources there, and requires the installation status to succeed.

**Expensive tests** (remote file access with S3/GCS/Azure): Skipped by default
on feature branches. Enabled on `main`/`main-v10` branches or via the
Expand All @@ -56,8 +69,17 @@ execution. MPI oversubscribe flags are set for Open MPI 4.x and 5+.

### `pip.yml`

Builds an **sdist** package (no wheel) and tests it in Docker containers
(ubuntu22.04, rocky9, debian13). Triggers on:
Builds an **sdist** package (no wheel) with Python 3.14, then tests it on brand
new environments (not the dev Docker images): `ubuntu-24.04` (bare runner, and
`debian:trixie` and `rockylinux/rockylinux:10` containers), `windows-2025` and
`macos-15`. Python is installed in the containers when missing. The package is
always installed in a virtual environment (`khiops-venv`): system-wide
installation is not supported, because the system-wide Python can be too old
and can contain EOL Python versions or outdated package versions. The virtual
environment is never activated: its interpreter is invoked directly through
Comment thread
tpochon marked this conversation as resolved.
Resolved
`VENV_PYTHON`, and its executables directory is added to `$PATH` in the step
that needs it, so that `khiops_env` and the `kh-*` scripts are found. Triggers
on:

- Tag pushes (any tag) — automatically publishes to GitHub Releases
- PRs touching `pyproject.toml`, `LICENSE.md`, or the workflow file
Expand All @@ -70,26 +92,33 @@ corresponding GitHub environment (`testpypi` or `pypi`). Only runs for the

### `api-docs.yml`

Builds Zensical documentation inside a dev Docker container for validation.
Triggers on:

- PRs touching `doc/site/**/*.md`, `doc/util/create-doc`, `doc/util/clean-doc`, `doc/util/*.py`,
`zensical.toml`, `khiops/**/*.py`, or the workflow file
Builds Zensical documentation on a `ubuntu-24.04` runner directly, with
a Python 3.14 virtual environment created by `uv venv` (`astral-sh/setup-uv`,
Comment thread
tpochon marked this conversation as resolved.
Resolved
with `UV_PYTHON_PREFERENCE: only-managed` so that no system-level Python is
used). The virtual environment is not activated: `VIRTUAL_ENV` and its `bin`
directory are exported through `$GITHUB_ENV` and prepended to `$PATH` where
needed, respectively. Triggers on:

- PRs touching `doc/site/**/*.md`, `doc/util/create-doc`, `doc/util/clean-doc`,
`doc/util/*.py`, `zensical.toml`, `khiops/**/*.py`, `pyproject.toml`,
`doc/util/requirements.txt`,
`scripts/extract_dependencies_from_pyproject_toml.py`, or the workflow file
- `workflow_dispatch` with optional tutorial and samples revision inputs

Uses the `khiopspydev-ubuntu22.04` Docker image and runs
`doc/util/create-doc -t -d -g <revision>`. The built HTML is uploaded as a
`api-docs` artifact for review.
Installs the dependencies (khiops-core and khiops-drivers-* from TestPyPI) and
Comment thread
tpochon marked this conversation as resolved.
Resolved
khiops-python with `uv pip`, then runs
`doc/util/create-doc -t -d -g <revision>`. The built HTML is uploaded as
a `api-docs` artifact for review.

Note: the production API docs are built by the
[khiops-doc](https://github.com/KhiopsML/khiops-doc) CI, which clones this
repository and builds the docs using mkdocstrings.

### `dev-docker.yml`

Builds development Docker images for multiple OS targets (ubuntu22.04, rocky8,
rocky9, debian13) with configurable Khiops revision, server revision, Python
versions (3.10–3.14), and remote file driver versions (GCS, S3, Azure).
Builds development Docker images for multiple OS targets (ubuntu24.04, rocky8,
rocky9, debian13) with configurable image tag (default `dev`), server revision
(default `main`), Python versions (3.11-3.14).
Triggers on PRs touching `packaging/docker/khiopspydev/Dockerfile.*` or the
workflow file, and on `workflow_dispatch`. Images are pushed to
`ghcr.io/khiopsml/khiops-python/khiopspydev-*` only when manually requested via
Expand All @@ -99,18 +128,27 @@ branches.
### `test-conda-forge-package.yml`

Manual-only workflow that tests the released `khiops` Conda package on the
`conda-forge` channel across a broad matrix: Python 3.10–3.14 × multiple OS
environments (Ubuntu 20.04/22.04/24.04, Rocky 8/9, Windows 2022/2025, macOS
14/15/15-Intel). Tests both normal Conda environments and "Conda-based
environments" (where `CONDA_PREFIX` is unset to simulate non-Conda invocation).
`conda-forge` channel across Python 3.11 and 3.14 on `ubuntu-24.04`,
`windows-2025` and `macos-15`, using `conda-incubator/setup-miniconda` with
`miniforge-version: latest`. Tests both normal Conda environments and
"Conda-based environments" (where `CONDA_PREFIX` is unset to simulate non-Conda
Comment thread
tpochon marked this conversation as resolved.
Resolved
invocation).

## Editing Rules

- Workflow YAML files are validated by pre-commit hooks
(`check-github-workflows`, `check-github-actions`) and formatted by `yamlfix`.
- The dev Docker images are the test environment for both `tests.yml` and
`pip.yml`. If you need new system dependencies in CI, they go into the
- The dev Docker images are the test environment for `tests.yml`.
Comment thread
tpochon marked this conversation as resolved.
Resolved
If you need new system dependencies in CI, they go into the
Dockerfiles under `packaging/docker/khiopspydev/`.
- Do not activate virtual environments in workflows. Store the interpreter
path in an environment variable (`PYTHON`, `VENV_PYTHON`) and add the venv
executables directory to `PATH` inside the step that needs it. Always quote
the interpreter (`"$PYTHON"`). Inline commands like `run: "$PYTHON" -m ...`
are invalid YAML: use a `|-` block. Never use `$GITHUB_PATH`  for the virtual
environment: in container jobs it breaks the `PATH`  of subsequent steps (e.g.
`bash`  is not found on Rocky).
- Prefer `ubuntu-24.04` over `ubuntu-latest` for runners.
- Test dependencies are in `test-requirements.txt` (`coverage`, `wrapt`).
Package dependencies are extracted from `pyproject.toml` at CI time via
`scripts/extract_dependencies_from_pyproject_toml.py`.
34 changes: 20 additions & 14 deletions .github/instructions/doc-changes.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,27 @@ The `create-doc` script accepts the following options:
The **API Docs** workflow (`.github/workflows/api-docs.yml`) validates
documentation builds. It triggers on:

- **PRs** touching `doc/site/**.md`, `doc/util/create-doc`, `doc/util/clean-doc`, `doc/util/*.py`,
`zensical.toml`, `khiops/**.py`, or the workflow file itself
- **PRs** touching `doc/site/**.md`, `doc/util/create-doc`, `doc/util/clean-doc`,
`doc/util/*.py`, `zensical.toml`, `khiops/**.py`, `pyproject.toml`,
`doc/util/requirements.txt`, `scripts/extract_dependencies_from_pyproject_toml.py`
or the workflow file itself
- **`workflow_dispatch`** with optional inputs:
- `khiops-revision` (default `11.0.1`)
- `khiops-python-tutorial-revision` (default: `11.0.0.0`)
- `khiops-samples-revision` (default: `11.0.0`)

**Build job**

1. Installs the khiops-core package (`uv pip install khiops-core`) and
khiops-python package itself (`uv pip install .`)
2. Downloads sample datasets via `kh-download-datasets`
3. Installs doc Python requirements from `doc/util/requirements.txt`
4. Runs `doc/util/create-doc -t -d -g <tutorial-revision>`
5. Uploads the built HTML as a `api-docs` artifact
- `khiops-python-tutorial-revision` (default: `11.0.0.0`, but can change)
- `khiops-samples-revision` (default: `11.0.0`, but can change)

**Build job** (on a bare `ubuntu-24.04` GitHub runner)


1. Sets up `uv` and Python 3.14 (never the system-level Python,
`UV_PYTHON_PREFERENCE: only-managed`), creates a virtual environment with
`uv venv`, and exports `VIRTUAL_ENV` to the subsequent steps
2. Installs the dependencies extracted from `pyproject.toml` (khiops-core and
khiops-drivers-* from TestPyPI) and khiops-python itself with `uv pip`
3. Downloads sample datasets via `kh-download-datasets`; `kh-status` failure is
tolerated (uv is not officially supported by Khiops yet, see issue #602)
4. Installs doc Python requirements from `doc/util/requirements.txt`
5. Runs `doc/util/create-doc -t -d -g <tutorial-revision>`
6. Uploads the built HTML as an `api-docs` artifact

Note: the production API docs are built by the
[khiops-doc](https://github.com/KhiopsML/khiops-doc) CI, which clones this
Expand Down
58 changes: 32 additions & 26 deletions .github/instructions/docker-changes.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ packaging-specific guidance.
## Scope

The Dockerfiles in `packaging/docker/khiopspydev/` build **development images**
used by the CI workflows `tests.yml`, `pip.yml`, and `api-docs.yml` to run
tests, build packages, and generate documentation. They are built and published
used by the CI workflow `tests.yml` to run tests. They are built and published
by the `dev-docker.yml` workflow.

## Image Variants
Expand All @@ -21,39 +20,48 @@ There are two Dockerfiles:

| Dockerfile | OS targets | Package manager | Remote file drivers |
|----------------------------|------------------|---|---|
| `Dockerfile.ubuntu-debian` | Ubuntu 22.04 or Debian 13 | apt | System-wide `.deb` (GCS, S3, Azure) + fakeS3 |
| `Dockerfile.ubuntu-debian` | Ubuntu 24.04 or Debian 13 | apt | fakeS3 |
| `Dockerfile.rocky` | Rocky 8, Rocky 9 | dnf | None |

All images are published to `ghcr.io/khiopsml/khiops-python/khiopspydev-<os>`.

### Debian and Ubuntu

`Dockerfile.ubuntu-debian` is a unique Dockerfile to build either a Ubuntu or a Debian target image
because there is no difference except for the base image used.
`Dockerfile.ubuntu-debian` is a unique Dockerfile to build either a Ubuntu or
a Debian target image because there is no difference except for the base image
used.

A dedicated `RUN` creates the `ubuntu` user (`-rm -d /home/ubuntu -s /bin/bash
Comment thread
tpochon marked this conversation as resolved.
Resolved
-g root -u 1000`) only if it does not exist yet, as on `ubuntu24.04`, where
it already exists; otherwise `usermod` enforces the home directory, shell,
group and UID and ensures the home directory exists. Debian 13 has no such
user, hence it is created. The Rocky Dockerfile still creates the `rocky` user
unconditionally.

### Rocky

`Dockerfile.rocky` uses `dnf` instead of `apt` and installs Python 3.11
explicitly on Rocky 8/9 (which ship with Python ≤ 3.9). It does **not** install
system-wide remote file drivers or fakeS3 (no Ruby/gem support). It also does
not copy `run_fake_remote_file_servers.sh` (only `run_service.sh`).
Dockerfile.rocky  also creates the `rocky`  user (UID 1000, group `root`) and sets `python`  and `pip`  to 3.11 through  alternatives  on Rocky 8/9.

## Build Arguments

All Dockerfiles accept these `ARG` values, supplied by `dev-docker.yml`:

| ARG | Description | Example |
|---|---|---|
| `KHIOPSDEV_OS` | OS tag for the base image (`ubuntu22.04`, `rocky8`, `rocky9`, `debian13`) | `ubuntu22.04` |
| `KHIOPSDEV_OS` | OS tag for the base image (`ubuntu24.04`, `rocky8`, `rocky9`, `debian13`) | `ubuntu24.04` |
| `SERVER_REVISION` | Git ref for the `khiops-server` image (copied into the final stage) | `main` |
| `PYTHON_VERSIONS` | Space-separated Python versions for Conda environments | `3.10 3.11 3.12 3.13 3.14` |
| `PYTHON_VERSIONS` | Space-separated Python versions for Conda environments | `3.11 3.12 3.13 3.14` |

## Multi-Stage Build Structure

Each Dockerfile uses a multi-stage build:

1. **`khiopsdev`** — Based on `ghcr.io/khiopsml/khiops/khiopsdev-<os>:latest`.
Installs dev tools (git, pip, pandoc, wget, zip, unzip) and Miniforge for Conda.
Installs dev tools (git, pip, pandoc, wget, zip, unzip, plus python3-venv on Debian/Ubuntu, needed by `ensurepip`) and Miniforge for Conda.
On Debian/Ubuntu, also installs `ruby-dev` (needed for fakeS3).
2. **`server`** — Pulls the `khiops-server` binary from
`ghcr.io/khiopsml/khiops-server:<SERVER_REVISION>`.
Expand All @@ -64,7 +72,7 @@ Each Dockerfile uses a multi-stage build:

For each Python version in `PYTHON_VERSIONS`, a Conda environment is created:

- **`py<version>`** — Bare Python (for pip-based test installs).
- **`py<version>`** - Bare Python (Conda and Pip packages are installed in them with `conda run`, without activation).

## Helper Scripts

Expand All @@ -79,12 +87,13 @@ For each Python version in `PYTHON_VERSIONS`, a Conda environment is created:

- **Triggers**: PRs touching `Dockerfile.*` or the workflow file;
`workflow_dispatch` for manual builds.
- **Matrix**: `ubuntu22.04`, `rocky8`, `rocky9`, `debian13`.
- **Matrix**: `ubuntu24.04`, `rocky8`, `rocky9`, `debian13`.
- **Concurrency**: Per-workflow + per-PR/ref, with `cancel-in-progress: true`.
- **Push**: Only on manual dispatch with `push: true`. The `set-latest` tag is
restricted to the `main` or `main-v10` branches.
- **Image tags**: `<CURRENT_IMAGE_TAG>` (e.g., `pip-packages`),
optionally also `latest`.
- **Image tags**: `<CURRENT_IMAGE_TAG>` (default `latest`), optionally also
`latest`. `python-versions` and `server-revision` are workflow dispatch
inputs.
- **Build context**: `./packaging/docker/khiopspydev/`.
- **Build args**: Passes `KHIOPSDEV_OS`, `SERVER_REVISION`,
`PYTHON_VERSIONS`.
Expand All @@ -93,27 +102,24 @@ For each Python version in `PYTHON_VERSIONS`, a Conda environment is created:
be added inside the Dockerfile.

### `tests.yml` (Consumer)
Runs the main test matrix inside `khiopspydev-ubuntu24.04` containers across
Python 3.11-3.14, with `latest` as default image tag. Integration tests also run
on `ubuntu24.04`, `rocky8`, `rocky9` and `debian13` containers.

Runs the main test matrix inside `khiopspydev-ubuntu22.04` containers across
Python 3.10–3.14. Integration tests also run on `rocky8`, `rocky9`, and
`debian13` containers.

### `pip.yml` (Consumer)

Builds and tests the source distribution package inside
`khiopspydev-ubuntu22.04`, `khiopspydev-rocky9`, and `khiopspydev-debian13`
containers.
### `pip.yml`
The workflow tests the sdist on bare runners and public base images (`debian:trixie`, `rockylinux/rockylinux:10`).

### `api-docs.yml` (Consumer)
### `api-docs.yml`

Builds the Zensical documentation inside the `khiopspydev-ubuntu22.04` container.
Builds the Zensical documentation on a bare `ubuntu-24.04` runner with `uv`.

## Editing Rules

- **Apply shared changes to all relevant Dockerfiles.** Ubuntu and Debian
Dockerfiles are near-duplicates; always update both.
- **Apply shared changes to all relevant Dockerfiles.** Ubuntu and Debian share
 Dockerfile.ubuntu-debian ; apply shared changes to it and to
`Dockerfile.rocky`.
- **Bump Miniforge version** by updating the download URL, filename, and SHA-256
checksum in all three Dockerfiles.
checksum in both Dockerfiles.
- **Adding Python versions**: Update `DEFAULT_PYTHON_VERSIONS` in
`dev-docker.yml` and add the new version to the `matrix.python-version` lists
in consumer workflows (`tests.yml`, etc.).
Expand Down
Loading
Loading