Skip to content

Commit f568e5f

Browse files
authored
Merge pull request #441 from KhiopsML/migrate-to-pyproject-toml-v11
Migrate to pyproject toml
2 parents e4ebcdc + f87b040 commit f568e5f

File tree

13 files changed

+160
-2598
lines changed

13 files changed

+160
-2598
lines changed

.github/workflows/api-docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ jobs:
5959
- name: Install doc build requirements
6060
run: |
6161
# Install package itself to install the samples datasets
62-
pip3 install .
62+
python -m pip install --upgrade pip
63+
python -m pip install --user .
6364
kh-download-datasets --force-overwrite --version ${{ inputs.khiops-samples-revision || env.DEFAULT_KHIOPS_SAMPLES_REVISION }}
6465
kh-status
6566
6667
# Install the doc python requirements
6768
cd doc
68-
pip3 install -U -r requirements.txt
69+
python -m pip install -U -r requirements.txt
6970
# Clone the Khiops Python tutorial repository while building the documentation
7071
- name: Build Sphinx Documentation
7172
run: |

.github/workflows/conda.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@ jobs:
111111
fi
112112
conda install ${RC_LABEL}khiops-core=$KHIOPS_CORE_VERSION
113113
conda install --channel ./khiops-conda/ khiops
114+
- name: Install JQ test dependency (Linux / MacOS)
115+
if: runner.os != 'Windows'
116+
run: conda install jq
117+
- name: Test Conda / Python Package Version Coherence
118+
run: |
119+
PACKAGE_VERSION=$(python -c "import khiops; print(khiops.__version__)")
120+
CONDA_VERSION=$(conda list ^khiops$ --json | jq ".[].version")
121+
122+
# Fail if CONDA_VERSION is not identical to $PACKAGE_VERSION
123+
echo $CONDA_VERSION | grep -wq $PACKAGE_VERSION
124+
if [[ $? -ne 0 ]]
125+
then
126+
echo "::error::Conda package version $CONDA_VERSION does not match Python package version $PYTHON_VERSION"
127+
false
128+
fi
114129
- name: Test Khiops Installation Status
115130
run: kh-status
116131
- name: Test Khiops Installation Status (Conda-Based Environments)

.github/workflows/pip.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,14 @@ jobs:
4545
# This is needed so that the Git tag is parsed and the version is retrieved
4646
git config --global --add safe.directory $(realpath .)
4747
48+
# Upgrade Pip
49+
pip install --upgrade pip
50+
51+
# Install required Python build dependency
52+
pip install build
53+
4854
# Build the package
49-
python3 setup.py sdist
55+
python3 -m build --sdist
5056
- name: Upload package as artifact
5157
uses: actions/upload-artifact@v4
5258
with:
@@ -82,7 +88,9 @@ jobs:
8288
with:
8389
name: pip-package
8490
- name: Install package
85-
run: pip install $(ls khiops*.tar.gz)
91+
run: |
92+
pip install --upgrade pip
93+
pip install $(ls khiops*.tar.gz)
8694
- name: Run tests
8795
env:
8896
KHIOPS_SAMPLES_DIR: ${{ github.workspace }}/khiops-samples

.github/workflows/tests.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ jobs:
105105
do
106106
# Since Python 3.13, setuptools is not installed automatically anymore
107107
$CONDA install -y -n "$CONDA_ENV" setuptools
108-
$CONDA run --no-capture-output -n "$CONDA_ENV" python setup.py egg_info
109-
$CONDA install -y -n "$CONDA_ENV" `grep -v "^\[" khiops.egg-info/requires.txt`
110-
rm -rf khiops.egg-info
108+
109+
# Add homogeneous TOML support (Python >= 3.12 has standard tomllib)
110+
$CONDA install -y -n "$CONDA_ENV" tomli
111+
$CONDA run --no-capture-output -n "$CONDA_ENV" python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" > requires.txt
112+
$CONDA install -y -n "$CONDA_ENV" `cat requires.txt`
113+
rm -f requires.txt
111114
done
112115
- name: Configure Expensive Tests Setting
113116
# Skip expensive tests by default, unless on the `dev`, `dev-v10` or `main` branches
@@ -252,23 +255,21 @@ jobs:
252255
id: setup-python
253256
uses: actions/setup-python@v5
254257
with:
255-
python-version: '3.11'
258+
python-version: '3.12'
256259
- name: Install khiops-python dev dependencies
257260
shell: pwsh
258261
run: |
259262
# The following git command is required,
260263
# as the Git repository is in a directory the current user does not own,
261264
# Python versioneer fails to compute the current version correctly otherwise
262265
git config --global --add safe.directory $(Resolve-Path '.' | % {$_.toString()})
263-
python setup.py egg_info
266+
python -m pip install setuptools
267+
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" -s "\n" > requires.txt
264268
265269
# Install the Python requirements
266-
Get-Content .\khiops.egg-info\requires.txt `
267-
| Select-String -Pattern '^\[' -NotMatch `
268-
| Select-String -Pattern '^$' -NotMatch `
269-
| % {$_.Line} `
270+
Get-Content .\requires.txt `
270271
| ForEach-Object {python -m pip install $_.toString()}
271-
Remove-Item -r -force khiops.egg-info
272+
Remove-Item -force requires.txt
272273
- name: Setup and Install Test Requirements
273274
run: python -m pip install -r test-requirements.txt
274275
- name: Test Khiops Integration
@@ -344,9 +345,11 @@ jobs:
344345
# as the Git repository is in a directory the current user does not own,
345346
# Python versioneer fails to compute the current version correctly otherwise
346347
git config --global --add safe.directory $(realpath .)
347-
python setup.py egg_info
348-
pip install `grep -v "^\[" khiops.egg-info/requires.txt`
349-
rm -rf khiops.egg-info
348+
# Install tomli for Python < 3.11
349+
pip install tomli
350+
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" > requires.txt
351+
pip install `cat requires.txt`
352+
rm -f requires.txt
350353
- name: Setup and Install Test Requirements
351354
run: |
352355
pip install -r test-requirements.txt

MANIFEST.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
recursive-exclude cicd *
21
recursive-exclude tests *
32
recursive-exclude doc *
43
exclude .git*
54
exclude CONTRIBUTING.md
65
exclude MANIFEST.in
7-
exclude pyproject.toml
8-
exclude sonar-project.properties
96
exclude test-requirements.txt
107
include khiops/samples/*.ipynb
11-
include khiops/_version.py
128
include khiops/core/scenarios/**/*._kh*
13-
include versioneer.py

khiops/__init__.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,9 @@
2222
(extension ".khcj")
2323
- sklearn: Scikit-Learn estimator classes to learn and use Khiops models
2424
"""
25-
import importlib
26-
import importlib.util
27-
import os
28-
import sys
29-
import warnings
30-
from copy import copy
31-
from pathlib import Path
32-
33-
from khiops._version import get_versions
3425
from khiops.core.internals.version import KhiopsVersion
3526

36-
__version__ = get_versions()["version"]
37-
del get_versions
27+
__version__ = "11.0.0.0b.0"
3828

3929

4030
def get_compatible_khiops_version():

0 commit comments

Comments
 (0)