Skip to content

Migrate to pyproject toml #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 5, 2025
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
5 changes: 3 additions & 2 deletions .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ jobs:
- name: Install doc build requirements
run: |
# Install package itself to install the samples datasets
pip3 install .
python -m pip install --upgrade pip
python -m pip install --user .
kh-download-datasets --force-overwrite --version ${{ inputs.khiops-samples-revision || env.DEFAULT_KHIOPS_SAMPLES_REVISION }}
kh-status

# Install the doc python requirements
cd doc
pip3 install -U -r requirements.txt
python -m pip install -U -r requirements.txt
# Clone the Khiops Python tutorial repository while building the documentation
- name: Build Sphinx Documentation
run: |
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ jobs:
fi
conda install ${RC_LABEL}khiops-core=$KHIOPS_CORE_VERSION
conda install --channel ./khiops-conda/ khiops
- name: Install JQ test dependency (Linux / MacOS)
if: runner.os != 'Windows'
run: conda install jq
- name: Test Conda / Python Package Version Coherence
run: |
PACKAGE_VERSION=$(python -c "import khiops; print(khiops.__version__)")
CONDA_VERSION=$(conda list ^khiops$ --json | jq ".[].version")

# Fail if CONDA_VERSION is not identical to $PACKAGE_VERSION
echo $CONDA_VERSION | grep -wq $PACKAGE_VERSION
if [[ $? -ne 0 ]]
then
echo "::error::Conda package version $CONDA_VERSION does not match Python package version $PYTHON_VERSION"
false
fi
- name: Test Khiops Installation Status
run: kh-status
- name: Test Khiops Installation Status (Conda-Based Environments)
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ jobs:
# This is needed so that the Git tag is parsed and the version is retrieved
git config --global --add safe.directory $(realpath .)

# Upgrade Pip
pip install --upgrade pip

# Install required Python build dependency
pip install build

# Build the package
python3 setup.py sdist
python3 -m build --sdist
- name: Upload package as artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -82,7 +88,9 @@ jobs:
with:
name: pip-package
- name: Install package
run: pip install $(ls khiops*.tar.gz)
run: |
pip install --upgrade pip
pip install $(ls khiops*.tar.gz)
- name: Run tests
env:
KHIOPS_SAMPLES_DIR: ${{ github.workspace }}/khiops-samples
Expand Down
29 changes: 16 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ jobs:
do
# Since Python 3.13, setuptools is not installed automatically anymore
$CONDA install -y -n "$CONDA_ENV" setuptools
$CONDA run --no-capture-output -n "$CONDA_ENV" python setup.py egg_info
$CONDA install -y -n "$CONDA_ENV" `grep -v "^\[" khiops.egg-info/requires.txt`
rm -rf khiops.egg-info

# Add homogeneous TOML support (Python >= 3.12 has standard tomllib)
$CONDA install -y -n "$CONDA_ENV" tomli
$CONDA run --no-capture-output -n "$CONDA_ENV" python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" > requires.txt
$CONDA install -y -n "$CONDA_ENV" `cat requires.txt`
rm -f requires.txt
done
- name: Configure Expensive Tests Setting
# Skip expensive tests by default, unless on the `dev`, `dev-v10` or `main` branches
Expand Down Expand Up @@ -252,23 +255,21 @@ jobs:
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Install khiops-python dev dependencies
shell: pwsh
run: |
# The following git command is required,
# as the Git repository is in a directory the current user does not own,
# Python versioneer fails to compute the current version correctly otherwise
git config --global --add safe.directory $(Resolve-Path '.' | % {$_.toString()})
python setup.py egg_info
python -m pip install setuptools
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" -s "\n" > requires.txt

# Install the Python requirements
Get-Content .\khiops.egg-info\requires.txt `
| Select-String -Pattern '^\[' -NotMatch `
| Select-String -Pattern '^$' -NotMatch `
| % {$_.Line} `
Get-Content .\requires.txt `
| ForEach-Object {python -m pip install $_.toString()}
Remove-Item -r -force khiops.egg-info
Remove-Item -force requires.txt
- name: Setup and Install Test Requirements
run: python -m pip install -r test-requirements.txt
- name: Test Khiops Integration
Expand Down Expand Up @@ -344,9 +345,11 @@ jobs:
# as the Git repository is in a directory the current user does not own,
# Python versioneer fails to compute the current version correctly otherwise
git config --global --add safe.directory $(realpath .)
python setup.py egg_info
pip install `grep -v "^\[" khiops.egg-info/requires.txt`
rm -rf khiops.egg-info
# Install tomli for Python < 3.11
pip install tomli
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" > requires.txt
pip install `cat requires.txt`
rm -f requires.txt
- name: Setup and Install Test Requirements
run: |
pip install -r test-requirements.txt
Expand Down
5 changes: 0 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
recursive-exclude cicd *
recursive-exclude tests *
recursive-exclude doc *
exclude .git*
exclude CONTRIBUTING.md
exclude MANIFEST.in
exclude pyproject.toml
exclude sonar-project.properties
exclude test-requirements.txt
include khiops/samples/*.ipynb
include khiops/_version.py
include khiops/core/scenarios/**/*._kh*
include versioneer.py
12 changes: 1 addition & 11 deletions khiops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,9 @@
(extension ".khcj")
- sklearn: Scikit-Learn estimator classes to learn and use Khiops models
"""
import importlib
import importlib.util
import os
import sys
import warnings
from copy import copy
from pathlib import Path

from khiops._version import get_versions
from khiops.core.internals.version import KhiopsVersion

__version__ = get_versions()["version"]
del get_versions
__version__ = "11.0.0.0b.0"


def get_compatible_khiops_version():
Expand Down
Loading