diff --git a/CHANGELOG.md b/CHANGELOG.md index 34f79e3e..a56582e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ - Example: 10.2.1.4 is the 5th version that supports khiops 10.2.1. - Internals: Changes in *Internals* sections are unlikely to be of interest for data scientists. +## Unreleased + +## Fixed +- (`core`) Samples dir path construction when HOME is a remote path + ## 11.0.0.1 - 2026-01-14 ### Fixed diff --git a/doc/requirements.txt b/doc/requirements.txt index 656100f0..62accbdd 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -4,6 +4,6 @@ ipykernel>=6.9.1 nbconvert==6.4.4 nbformat==5.3.0 numpydoc>=1.5.0 -pandas>=0.25.3 +pandas>=0.25.3,<=2.3.3 scikit-learn>=0.22.2,<=1.7.2 sphinx-copybutton>=0.5.0 diff --git a/khiops/core/internals/runner.py b/khiops/core/internals/runner.py index 314d0de7..c464e88a 100644 --- a/khiops/core/internals/runner.py +++ b/khiops/core/internals/runner.py @@ -14,7 +14,6 @@ import io import os -import pathlib import platform import shlex import shutil @@ -65,7 +64,11 @@ def get_default_samples_dir(): elif platform.system() == "Windows" and "PUBLIC" in os.environ: samples_dir = os.path.join(os.environ["PUBLIC"], "khiops_data", "samples") else: - samples_dir = str(pathlib.Path.home() / "khiops_data" / "samples") + # The filesystem abstract layer is used here + # as the path can be either local or remote + samples_dir = fs.get_child_path( + fs.get_child_path(os.environ["HOME"], "khiops_data"), "samples" + ) return samples_dir diff --git a/packaging/conda/meta.yaml b/packaging/conda/meta.yaml index e871ea9c..3f832785 100644 --- a/packaging/conda/meta.yaml +++ b/packaging/conda/meta.yaml @@ -24,7 +24,7 @@ requirements: run: - python - khiops-core =11.0.0 - - pandas >=0.25.3 + - pandas >=0.25.3,<=2.3.3 - scikit-learn >=0.22.2 run_constrained: # do not necessary use the latest version diff --git a/pyproject.toml b/pyproject.toml index e7d27170..8b2da47b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -104,8 +104,8 @@ classifiers = [ ] requires-python = ">=3.8" dependencies = [ - "pandas>=0.25.3", - # do not use the latest version, to avoid undesired breaking changes + # do not use the latest versions, to avoid undesired breaking changes + "pandas>=0.25.3,<=2.3.3", "scikit-learn>=0.22.2,<=1.7.2", ] diff --git a/tests/test_remote_access.py b/tests/test_remote_access.py index 610e5130..54dcdc69 100644 --- a/tests/test_remote_access.py +++ b/tests/test_remote_access.py @@ -227,6 +227,33 @@ def test_train_predictor_fail_and_log_with_remote_access(self): self.assertTrue(fs.exists(log_file_path), f"Path: {log_file_path}") fs.remove(log_file_path) + def test_samples_dir_inferred_from_remote_home(self): + """Test samples_dir is correctly inferred using a remote path in HOME""" + + # Save initial state + # This runner has remote paths (for root_temp_dir for example) + initial_runner = kh.get_runner() + initial_home = os.environ.get("HOME") + + # Set a remote path to HOME + os.environ["HOME"] = initial_runner.root_temp_dir + test_runner = KhiopsLocalRunner() + kh.set_runner(test_runner) + + # Test the home path is indeed remote + self.assertFalse(fs.is_local_resource(os.environ["HOME"])) + + # Test that samples_dir is built according to the expectations + expected_samples_dir = fs.get_child_path( + fs.get_child_path(os.environ["HOME"], "khiops_data"), "samples" + ) + self.assertEqual(test_runner.samples_dir, expected_samples_dir) + + # Restore initial state + if initial_home is not None: + os.environ["HOME"] = initial_home + kh.set_runner(initial_runner) + class KhiopsS3RemoteFileTests(KhiopsRemoteAccessTestsContainer.KhiopsRemoteAccessTests): """Integration tests with Amazon S3 filesystems"""