Skip to content

Commit 85ce064

Browse files
authored
Merge pull request #432 from KhiopsML/update-to-khiops-core-on-conda-forge-backport-from-v10
Update to khiops core on conda forge backport from v10
2 parents e8f7e2b + 5179738 commit 85ce064

File tree

9 files changed

+76
-39
lines changed

9 files changed

+76
-39
lines changed

.github/workflows/api-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
default: main
1010
description: khiops-python-tutorial repo revision
1111
image-tag:
12-
default: 10.7.3-a.0.0
12+
default: 11.0.0-a.0.0
1313
description: Development Docker Image Tag
1414
pull_request:
1515
paths:
@@ -41,7 +41,7 @@ jobs:
4141
# because the `env` context is only accessible at the step level;
4242
# hence, it is hard-coded
4343
image: |-
44-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '10.7.3-a.0.0' }}
44+
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '11.0.0-a.0.0' }}
4545
# Use the 'runner' user (1001) from github so checkout actions work properly
4646
# https://github.com/actions/runner/issues/2033#issuecomment-1598547465
4747
options: --user 1001

.github/workflows/conda.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Conda Package
33
env:
44
# Note: The default Khiops version must never be an alpha release as they are
55
# ephemeral. To test alpha versions run the workflow manually.
6-
DEFAULT_KHIOPS_CORE_VERSION: 10.7.3a.0
6+
DEFAULT_KHIOPS_CORE_VERSION: 11.0.0a.0
77
DEFAULT_SAMPLES_VERSION: 11.0.0
88
on:
99
workflow_dispatch:
1010
inputs:
1111
khiops-core-version:
12-
default: 10.7.3a.0
12+
default: 11.0.0a.0
1313
description: khiops-core version for testing
1414
khiops-samples-version:
1515
default: 11.0.0
@@ -57,10 +57,8 @@ jobs:
5757
- name: Install Dependency Requirements for Building Conda Packages
5858
run: conda install -y conda-build
5959
- name: Build the Conda Package
60-
# Note: The "khiops-dev" conda channel is needed to retrieve the "khiops-core" package.
61-
# The "test" part of the conda recipe needs this package.
6260
run: |
63-
conda build --channel khiops-dev --output-folder ./khiops-conda ./packaging/conda
61+
conda build --output-folder ./khiops-conda ./packaging/conda
6462
- name: Upload Conda Package Artifact
6563
uses: actions/upload-artifact@v4
6664
with:
@@ -80,8 +78,8 @@ jobs:
8078
- {os: ubuntu-24.04, json-image: '{"image": null}'}
8179
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux:8"}'}
8280
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux:9"}'}
83-
- {os: windows-2019, json-image: '{"image": null}'}
8481
- {os: windows-2022, json-image: '{"image": null}'}
82+
- {os: windows-2025, json-image: '{"image": null}'}
8583
- {os: macos-13, json-image: '{"image": null}'}
8684
- {os: macos-14, json-image: '{"image": null}'}
8785
- {os: macos-15, json-image: '{"image": null}'}
@@ -105,7 +103,13 @@ jobs:
105103
echo "KHIOPS_CORE_VERSION=$KHIOPS_CORE_VERSION" >> "$GITHUB_ENV"
106104
- name: Install the Khiops Conda package
107105
run: |
108-
conda install --channel khiops-dev khiops-core=$KHIOPS_CORE_VERSION
106+
# Add the Conda `rc` label for alpha or RC pre-releases
107+
if [[ $(echo ${KHIOPS_CORE_VERSION} | grep -E ".*(a|rc)\.[0-9]+") ]]; then
108+
RC_LABEL="conda-forge/label/rc::"
109+
else
110+
RC_LABEL=""
111+
fi
112+
conda install ${RC_LABEL}khiops-core=$KHIOPS_CORE_VERSION
109113
conda install --channel ./khiops-conda/ khiops
110114
- name: Test Khiops Installation Status
111115
run: kh-status

.github/workflows/dev-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Dev Docker
33
env:
4-
DEFAULT_KHIOPS_REVISION: 10.7.3-a.0
4+
DEFAULT_KHIOPS_REVISION: 11.0.0-a.0
55
DEFAULT_IMAGE_INCREMENT: 0
66
DEFAULT_SERVER_REVISION: main
77
DEFAULT_PYTHON_VERSIONS: 3.8 3.9 3.10 3.11 3.12 3.13
@@ -14,7 +14,7 @@ on:
1414
inputs:
1515
khiops-revision:
1616
type: string
17-
default: 10.7.3-a.0
17+
default: 11.0.0-a.0
1818
description: Khiops Revision
1919
image-increment:
2020
type: number

.github/workflows/pip.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
default: 11.0.0
1010
description: khiops-samples repo revision
1111
image-tag:
12-
default: 10.7.3-a.0.0
12+
default: 11.0.0-a.0.0
1313
description: Development Docker Image Tag
1414
pull_request:
1515
paths:
@@ -64,7 +64,7 @@ jobs:
6464
# because the `env` context is only accessible at the step level;
6565
# hence, it is hard-coded
6666
image: |-
67-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '10.7.3-a.0.0' }}
67+
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '11.0.0-a.0.0' }}
6868
steps:
6969
- name: Set parameters as env
7070
run: |
@@ -106,9 +106,11 @@ jobs:
106106
kh-samples core -i train_coclustering -e
107107
kh-samples sklearn -i khiops_classifier -e
108108
109-
# Test that the line containing "MPI command" also contains
110-
# an executable named "mpiexec"
111-
kh-status | grep "MPI command" | grep -wq "mpiexec"
109+
# Test that the line containing "MPI command" does not contain "<empty>"
110+
# (as given by kh-status in the absence of MPI support)
111+
# The MPI command is not always named mpiexec, but can be orterun etc
112+
# (as given by khiops_env)
113+
kh-status | grep "MPI command" | grep -vwq "<empty>"
112114
release:
113115
if: github.ref_type == 'tag'
114116
needs: [build, test]

.github/workflows/tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
name: Tests
33
env:
44
DEFAULT_SAMPLES_REVISION: 11.0.0
5-
DEFAULT_KHIOPS_DESKTOP_REVISION: 10.7.3-a.0
5+
DEFAULT_KHIOPS_DESKTOP_REVISION: 11.0.0-a.0
66
on:
77
workflow_dispatch:
88
inputs:
99
samples-revision:
1010
default: 11.0.0
1111
description: Git Tag/Branch/Commit for the khiops-samples Repo
1212
image-tag:
13-
default: 10.7.3-a.0.0
13+
default: 11.0.0-a.0.0
1414
description: Development Docker Image Tag
1515
khiops-desktop-revision:
16-
default: 10.7.3-a.0
16+
default: 11.0.0-a.0
1717
description: Khiops Windows Desktop Application Version
1818
run-expensive-tests:
1919
type: boolean
@@ -43,7 +43,7 @@ jobs:
4343
# because the `env` context is only accessible at the step level;
4444
# hence, it is hard-coded
4545
image: |-
46-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '10.7.3-a.0.0' }}
46+
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '11.0.0-a.0.0' }}
4747
credentials:
4848
username: ${{ github.actor }}
4949
password: ${{ secrets.GITHUB_TOKEN }}
@@ -214,7 +214,7 @@ jobs:
214214
tests/resources/general_options/general_options/*/*._kh
215215
retention-days: 7
216216
check-khiops-integration-on-windows:
217-
runs-on: windows-2019
217+
runs-on: windows-2022
218218
steps:
219219
- name: Download the Khiops Desktop NSIS Installer
220220
shell: pwsh
@@ -315,7 +315,7 @@ jobs:
315315
# because the `env` context is only accessible at the step level;
316316
# hence, it is hard-coded
317317
image: |-
318-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '10.7.3-a.0.0' }}
318+
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '11.0.0-a.0.0' }}
319319
credentials:
320320
username: ${{ github.actor }}
321321
password: ${{ secrets.GITHUB_TOKEN }}

khiops/core/internals/runner.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ def _infer_env_bin_dir_for_conda_based_installations():
146146
# Match $CONDA_PREFIX/[Ll]ib/python3.X/site-packages/khiops/core/internals/runner.py
147147
else:
148148
conda_env_dir = current_file_path.parents[6]
149-
env_bin_dir = os.path.join(str(conda_env_dir), "bin")
149+
150+
# Conda env binary dir is:
151+
# - on Windows: conda_env_dir\Library\bin
152+
# - on Linux/macOS: conda_env_dir\bin
153+
if platform.system() == "Windows":
154+
env_bin_dir = os.path.join(str(conda_env_dir), "Library", "bin")
155+
else:
156+
env_bin_dir = os.path.join(str(conda_env_dir), "bin")
150157

151158
return env_bin_dir
152159

@@ -168,7 +175,10 @@ def _check_conda_env_bin_dir(conda_env_bin_dir):
168175

169176
# Conda env dir is not equal to its root dir
170177
# Conda env bin dir exists, along with the `conda-meta` dir
178+
# Note: On Windows, Conda env bin dir equals conda env dir\Library\bin
171179
conda_env_dir_path = conda_env_bin_dir_path.parent
180+
if platform.system() == "Windows":
181+
conda_env_dir_path = conda_env_dir_path.parent
172182
if (
173183
str(conda_env_dir_path) != conda_env_dir_path.root # `.root` is an `str`
174184
and conda_env_bin_dir_path.is_dir()
@@ -180,20 +190,25 @@ def _check_conda_env_bin_dir(conda_env_bin_dir):
180190

181191
def _infer_khiops_installation_method(trace=False):
182192
"""Return the Khiops installation method"""
183-
# We are in a conda environment if
184-
# - if the CONDA_PREFIX environment variable exists and,
185-
# - if MODL, MODL_Coclustering and mpiexec files exists in
186-
# `$CONDA_PREFIX/bin`
187-
#
188-
# Note: The check that MODL and MODL_Coclustering are actually executable is done
193+
# We are in a Conda environment if
194+
# - the CONDA_PREFIX environment variable exists and,
195+
# - the khiops_env script exists within:
196+
# - `%CONDA_PREFIX\Library\bin%` on Windows
197+
# - `$CONDA_PREFIX/bin` on Linux and MacOS
198+
# Note: The check that the Khiops binaries are actually executable is done
189199
# afterwards by the initializations method.
190-
# We are in a conda env if the Khiops binaries exists within `$CONDA_PREFIX/bin`
191-
if "CONDA_PREFIX" in os.environ and _khiops_env_file_exists(
192-
os.path.join(os.environ["CONDA_PREFIX"], "bin")
193-
):
194-
installation_method = "conda"
195-
# Otherwise, we choose between conda-based and local (default choice)
196-
else:
200+
installation_method = "unknown"
201+
if "CONDA_PREFIX" in os.environ:
202+
conda_env_dir = os.environ["CONDA_PREFIX"]
203+
if platform.system() == "Windows":
204+
conda_binary_dir = os.path.join(conda_env_dir, "Library", "bin")
205+
else:
206+
conda_binary_dir = os.path.join(conda_env_dir, "bin")
207+
if _khiops_env_file_exists(conda_binary_dir):
208+
installation_method = "conda"
209+
# Otherwise (installation_method is still "unknown"), we choose between
210+
# conda-based and local (default choice)
211+
if installation_method == "unknown":
197212
env_bin_dir = _infer_env_bin_dir_for_conda_based_installations()
198213
if trace:
199214
print(f"Environment binary dir: '{env_bin_dir}'")

packaging/conda/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ requirements:
2626
- python
2727
run:
2828
- python
29-
- khiops-core =10.7.3a.0
29+
- conda-forge/label/rc::khiops-core =11.0.0a.0
3030
- pandas >=0.25.3
3131
- scikit-learn >=0.22.2
3232
run_constrained:

packaging/docker/khiopspydev/Dockerfile.rocky

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,24 @@ RUN true \
6969
# set up all the supported Python environments under conda (for the unit tests)
7070
# relying on a variable containing all the versions
7171
ARG PYTHON_VERSIONS
72+
73+
# Install Conda packages
74+
# Use `rc` label for alpha or RC khiops-core pre-releases
7275
RUN true \
7376
&& export CONDA="/root/miniforge3/bin/conda" \
77+
&& if [[ $(echo ${KHIOPS_REVISION} | grep -E ".*-(a|rc)\.[0-9]+") ]]; then \
78+
export RC_LABEL="conda-forge/label/rc::"; \
79+
else \
80+
export RC_LABEL=""; \
81+
fi \
7482
&& /bin/bash -c 'for version in ${PYTHON_VERSIONS}; \
7583
do \
7684
CONDA_ENVS="py${version} py${version}_conda"; \
7785
for CONDA_ENV in $CONDA_ENVS; \
7886
do \
7987
$CONDA create -y -n $CONDA_ENV python=${version}; \
8088
done; \
81-
$CONDA install -y -n py${version}_conda -c khiops-dev khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
89+
$CONDA install -y -n py${version}_conda ${RC_LABEL}khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
8290
done' \
8391
&& true
8492

packaging/docker/khiopspydev/Dockerfile.ubuntu

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,16 @@ RUN true \
4242
ARG PYTHON_VERSIONS
4343
ARG KHIOPS_GCS_DRIVER_REVISION
4444
ARG KHIOPS_S3_DRIVER_REVISION
45+
46+
# Install Conda packages
47+
# Use `rc` label for alpha or RC khiops-core pre-releases
4548
RUN true \
4649
&& export CONDA="/root/miniforge3/bin/conda" \
50+
&& if [[ $(echo ${KHIOPS_REVISION} | grep -E ".*-(a|rc)\.[0-9]+") ]]; then \
51+
export RC_LABEL="conda-forge/label/rc::"; \
52+
else \
53+
export RC_LABEL=""; \
54+
fi \
4755
&& /bin/bash -c 'for version in ${PYTHON_VERSIONS}; \
4856
do \
4957
CONDA_ENVS="py${version} py${version}_conda"; \
@@ -52,7 +60,7 @@ RUN true \
5260
$CONDA create -y -n $CONDA_ENV python=${version}; \
5361
done; \
5462
# khiops core \
55-
$CONDA install -y -n py${version}_conda -c khiops-dev khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
63+
$CONDA install -y -n py${version}_conda ${RC_LABEL}khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
5664
# remote files drivers installed in the conda environment \
5765
$CONDA install -y -n py${version}_conda -c khiops \
5866
khiops-driver-s3=${KHIOPS_S3_DRIVER_REVISION} \

0 commit comments

Comments
 (0)