Skip to content

Commit 3af6f28

Browse files
committed
Fix CI workflow separation and compatibility test issues
- Separate main CI from compatibility tests to prevent failures - Main CI now skips compatibility tests with -m 'not compatibility' - Update compatibility workflow to use scikit-learn 1.5.2 for Python 3.12 - Fix linting issues (whitespace in blank lines) - Update version to 0.1.2.post11 This resolves the ComplexWarning import errors that were causing CI failures by ensuring compatibility tests run separately with proper dependency versions.
1 parent 4c9bfaa commit 3af6f28

File tree

5 files changed

+44
-20
lines changed

5 files changed

+44
-20
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
4242
- name: Run tests
4343
run: |
44-
uv run python -m pytest tests/ -v --tb=short
44+
uv run python -m pytest tests/ -v --tb=short -m "not compatibility"
4545
4646
# Coverage reporting disabled until pytest-cov is added to dependencies
4747
# - name: Upload coverage to Codecov

.github/workflows/compatibility.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
sklearn-version: '1.5.2'
2727
- python-version: '3.12'
2828
python-version-short: 'py312'
29-
sklearn-version: 'latest'
29+
sklearn-version: '1.5.2'
3030
- python-version: '3.13'
3131
python-version-short: 'py313'
3232
sklearn-version: 'latest'
@@ -66,10 +66,7 @@ jobs:
6666
run: |
6767
echo "Testing Python ${{ matrix.python-version }} compatibility"
6868
uv run python -c "import fastwoe; print(f'fastwoe version: {fastwoe.__version__}')"
69-
70-
- name: Run full test suite
71-
run: |
72-
uv run python -m pytest tests/ -v --tb=short
69+
uv run python -m pytest tests/test_compatibility.py -v --tb=short
7370
7471
- name: Upload test results
7572
uses: actions/upload-artifact@v4

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
# Changelog
22

3-
## Version 0.1.2.post9 (Current)
3+
## Version 0.1.2.post11 (Current)
4+
5+
- **Fixed**:
6+
- **CI Workflow Separation**: Separated main CI tests from compatibility tests to prevent failures
7+
- **Main CI**: Now skips compatibility tests with `-m "not compatibility"` to avoid scikit-learn/NumPy conflicts
8+
- **Compatibility Workflow**: Updated to use scikit-learn 1.5.2 for Python 3.12 + NumPy 2.0 support
9+
- **Test Organization**: Main CI runs 107 core tests, compatibility workflow runs 4 compatibility tests separately
10+
11+
## Version 0.1.2.post10
12+
13+
- **Fixed**:
14+
- **CI Compatibility Test**: Fixed dependency installation order and added version debugging
15+
- **scikit-learn Version**: Ensured scikit-learn 1.4.2 is correctly installed for NumPy 2.0 compatibility
16+
- **Installation Process**: Improved dependency resolution by installing all packages at once
17+
18+
## Version 0.1.2.post9
419

520
- **Fixed**:
621
- **CI Compatibility Test**: Fixed Python 3.12 + NumPy 2.0 compatibility test by using scikit-learn 1.4.2 instead of latest

fastwoe/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from .fastwoe import FastWoe, WoePreprocessor
1414
from .interpret_fastwoe import WeightOfEvidence
1515

16-
__version__ = "0.1.2.post9"
16+
__version__ = "0.1.2.post11"
1717
__author__ = "xRiskLab"
1818
__email__ = "[email protected]"
1919

tests/test_compatibility.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Focus on edge cases and critical combinations
1414
COMPATIBILITY_MATRIX = [
1515
("3.9", "1.3.0", "Min supported: Python 3.9 + sklearn 1.3.0"),
16-
("3.12", "latest", "Latest: Python 3.12 + sklearn 1.4.2 + NumPy 2.0"),
16+
("3.12", "1.5.2", "Python 3.12 + sklearn 1.5.2 + NumPy 2.0"),
1717
]
1818

1919

@@ -32,8 +32,8 @@ def get_numpy_constraint(python_ver, sklearn_ver):
3232
"""Get appropriate numpy version constraint."""
3333
if sklearn_ver in ["1.3.0", "1.3.2"] or python_ver == "3.9":
3434
return "numpy<2.0"
35-
elif sklearn_ver == "latest":
36-
# Use scikit-learn 1.4.2 which supports NumPy 2.0
35+
elif sklearn_ver == "1.5.2":
36+
# scikit-learn 1.5.2 should support NumPy 2.0
3737
return "numpy>=1.21,<2.1"
3838
else:
3939
return "numpy>=1.21,<2.1"
@@ -125,22 +125,34 @@ def test_python_sklearn_compatibility(python_ver, sklearn_ver, description):
125125

126126
python_exe = f"{env_name}/bin/python"
127127

128-
# Install dependencies
128+
# Install dependencies in specific order to avoid conflicts
129129
deps = [numpy_constraint, "pandas>=1.3.0", "scipy>=1.7.0"]
130-
if sklearn_ver == "latest":
131-
# Use scikit-learn 1.4.2 which supports NumPy 2.0
132-
deps.append("scikit-learn==1.4.2")
133-
else:
134-
deps.append(f"scikit-learn=={sklearn_ver}")
130+
deps.append(f"scikit-learn=={sklearn_ver}")
135131

136-
# sourcery skip: no-loop-in-tests
132+
# Install dependencies step by step to ensure correct versions
137133
for dep in deps:
138-
success, _, stderr = run_cmd(
139-
f"uv pip install --python {python_exe} '{dep}'"
134+
success, stdout, stderr = run_cmd(
135+
f"uv pip install --python {python_exe} --no-deps '{dep}'"
140136
)
141137
if not success:
142138
pytest.fail(f"Failed to install {dep}: {stderr}")
143139

140+
# Install scikit-learn last to ensure it gets the right dependencies
141+
success, stdout, stderr = run_cmd(
142+
f"uv pip install --python {python_exe} 'scikit-learn=={sklearn_ver}'"
143+
)
144+
if not success:
145+
pytest.fail(f"Failed to install scikit-learn {sklearn_ver}: {stderr}")
146+
147+
# Debug: Check what versions were actually installed
148+
success, stdout, stderr = run_cmd(
149+
f"{python_exe} -c \"import numpy; import sklearn; print(f'NumPy: {{numpy.__version__}}, sklearn: {{sklearn.__version__}}')\""
150+
)
151+
if success:
152+
print(f"Installed versions: {stdout.strip()}")
153+
else:
154+
print(f"Could not check versions: {stderr}")
155+
144156
# Install FastWoe
145157
success, _, stderr = run_cmd(f"uv pip install --python {python_exe} -e .")
146158
if not success:

0 commit comments

Comments
 (0)