Skip to content

Commit aea8c29

Browse files
committed
feat: Add XGBoost 3.0.5 compatibility support
- Update version to 0.2.6.post1 - Extend XGBoost dependency range to >=2.0.0,<4.0.0 - Fix test precision for XGBoost 3.0.5 compatibility - Add comprehensive XGBoost compatibility test suite - Enhance CI/CD workflows with XGBoost version matrix - Improve Pylint configuration for virtual environment - Add CHANGELOG.md with release notes - Add pre-commit configuration and GitHub workflows Closes: XGBoost 3.0 compatibility
1 parent f329678 commit aea8c29

15 files changed

Lines changed: 931 additions & 103 deletions

.github/workflows/ci.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
include:
15+
- python-version: '3.11'
16+
xgboost-version: '2.1.4'
17+
test-name: 'xgboost-2.x'
18+
- python-version: '3.11'
19+
xgboost-version: '3.0.5'
20+
test-name: 'xgboost-3.x'
21+
- python-version: '3.10'
22+
xgboost-version: 'latest'
23+
test-name: 'xgboost-latest'
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v1
35+
with:
36+
version: "latest"
37+
38+
- name: Cache uv
39+
uses: actions/cache@v3
40+
with:
41+
path: ~/.cache/uv
42+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ matrix.xgboost-version }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-uv-${{ matrix.python-version }}-
45+
${{ runner.os }}-uv-
46+
47+
- name: Install dependencies
48+
run: |
49+
uv sync --dev
50+
uv add "xgboost==${{ matrix.xgboost-version }}"
51+
52+
- name: Run tests
53+
run: |
54+
echo "Testing with XGBoost ${{ matrix.xgboost-version }}"
55+
uv run python -c "import xgboost as xgb; print(f'XGBoost version: {xgb.__version__}')"
56+
uv run python -m pytest tests/ -v --tb=short
57+
58+
# Coverage reporting disabled until pytest-cov is added to dependencies
59+
# - name: Upload coverage to Codecov
60+
# if: matrix.python-version == '3.11'
61+
# uses: codecov/codecov-action@v3
62+
# with:
63+
# file: ./coverage.xml
64+
# flags: unittests
65+
# name: codecov-umbrella
66+
67+
lint:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- name: Set up Python
73+
uses: actions/setup-python@v4
74+
with:
75+
python-version: '3.11'
76+
77+
- name: Install uv
78+
uses: astral-sh/setup-uv@v1
79+
with:
80+
version: "latest"
81+
82+
- name: Install dependencies
83+
run: |
84+
uv sync --dev
85+
86+
- name: Run ruff
87+
run: |
88+
uv run ruff check xbooster/ tests/
89+
90+
- name: Run ruff format check
91+
run: |
92+
uv run ruff format --check xbooster/ tests/
93+
94+
type-check:
95+
runs-on: ubuntu-latest
96+
steps:
97+
- uses: actions/checkout@v4
98+
99+
- name: Set up Python
100+
uses: actions/setup-python@v4
101+
with:
102+
python-version: '3.11'
103+
104+
- name: Install uv
105+
uses: astral-sh/setup-uv@v1
106+
with:
107+
version: "latest"
108+
109+
- name: Install dependencies
110+
run: |
111+
uv sync --dev
112+
113+
- name: Run mypy (if configured)
114+
run: |
115+
# Add mypy configuration and uncomment when ready
116+
# uv run mypy xbooster/
117+
echo "Type checking skipped - configure mypy when ready"
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Python Version Compatibility
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
# schedule:
9+
# # Run weekly on Sundays (disabled to save GitHub Actions minutes)
10+
# - cron: '0 0 * * 0'
11+
12+
jobs:
13+
compatibility-test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- python-version: '3.11'
19+
python-version-short: 'py311'
20+
xgboost-version: '2.1.4'
21+
sklearn-version: '1.3.2'
22+
test-name: 'xgboost-2.x'
23+
- python-version: '3.11'
24+
python-version-short: 'py311'
25+
xgboost-version: '3.0.5'
26+
sklearn-version: '1.6.1'
27+
test-name: 'xgboost-3.x'
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Cache uv dependencies
38+
uses: actions/cache@v3
39+
with:
40+
path: ~/.cache/uv
41+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ matrix.xgboost-version }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-uv-${{ matrix.python-version }}-
44+
${{ runner.os }}-uv-
45+
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v1
48+
with:
49+
version: "latest"
50+
51+
- name: Install dependencies
52+
run: |
53+
uv sync --dev
54+
uv add "xgboost==${{ matrix.xgboost-version }}"
55+
if [ "${{ matrix.sklearn-version }}" != "latest" ]; then
56+
uv add "scikit-learn==${{ matrix.sklearn-version }}"
57+
else
58+
uv add "scikit-learn"
59+
fi
60+
61+
- name: Run compatibility tests
62+
run: |
63+
echo "Testing Python ${{ matrix.python-version }} with XGBoost ${{ matrix.xgboost-version }}"
64+
uv run python -c "import xgboost as xgb; print(f'XGBoost version: {xgb.__version__}')"
65+
uv run python -c "import xbooster; print(f'xbooster version: {xbooster.__version__}')"
66+
uv run python -m pytest tests/test_xgboost_compatibility.py -v --tb=short
67+
68+
- name: Upload test results
69+
uses: actions/upload-artifact@v4
70+
if: always()
71+
with:
72+
name: test-results-${{ matrix.test-name }}
73+
path: |
74+
.pytest_cache/
75+
test-results/
76+
if-no-files-found: ignore
77+
retention-days: 7
78+
79+
compatibility-summary:
80+
runs-on: ubuntu-latest
81+
needs: compatibility-test
82+
if: always()
83+
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: Download all test results
88+
uses: actions/download-artifact@v4
89+
continue-on-error: true
90+
with:
91+
path: test-results/
92+
93+
- name: Generate compatibility report
94+
run: |
95+
echo "# Python Version Compatibility Report" > compatibility-report.md
96+
echo "" >> compatibility-report.md
97+
echo "Generated on: $(date)" >> compatibility-report.md
98+
echo "" >> compatibility-report.md
99+
100+
for result in test-results/*; do
101+
if [ -d "$result" ]; then
102+
test_name=$(basename "$result" | sed 's/test-results-//')
103+
echo "## $test_name" >> compatibility-report.md
104+
echo "" >> compatibility-report.md
105+
106+
if [ -d "$result/.pytest_cache" ]; then
107+
echo "✅ Tests completed successfully" >> compatibility-report.md
108+
else
109+
echo "❌ Tests failed or incomplete" >> compatibility-report.md
110+
fi
111+
echo "" >> compatibility-report.md
112+
fi
113+
done
114+
115+
cat compatibility-report.md
116+
117+
- name: Comment on PR
118+
if: github.event_name == 'pull_request'
119+
uses: actions/github-script@v6
120+
with:
121+
script: |
122+
const fs = require('fs');
123+
const report = fs.readFileSync('compatibility-report.md', 'utf8');
124+
125+
github.rest.issues.createComment({
126+
issue_number: context.issue.number,
127+
owner: context.repo.owner,
128+
repo: context.repo.repo,
129+
body: report
130+
});

.github/workflows/release.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 0.1.0)'
11+
required: true
12+
type: string
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.11'
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v1
27+
with:
28+
version: "latest"
29+
30+
- name: Install dependencies
31+
run: |
32+
uv sync --dev
33+
34+
- name: Run tests
35+
run: |
36+
uv run python -m pytest tests/ -v
37+
38+
build:
39+
needs: test
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: '3.11'
48+
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v1
51+
with:
52+
version: "latest"
53+
54+
- name: Install build dependencies
55+
run: |
56+
uv tool install build
57+
58+
- name: Build package
59+
run: |
60+
uv tool run --from build pyproject-build
61+
62+
- name: Upload build artifacts
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: dist
66+
path: dist/
67+
68+
# publish:
69+
# needs: build
70+
# runs-on: ubuntu-latest
71+
# permissions:
72+
# id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
73+
# steps:
74+
# - name: Download build artifacts
75+
# uses: actions/download-artifact@v4
76+
# with:
77+
# name: dist
78+
# path: dist/
79+
#
80+
# - name: Publish to PyPI
81+
# uses: pypa/gh-action-pypi-publish@release/v1
82+
# # Uncomment when ready to publish to PyPI
83+
# # with:
84+
# # password: ${{ secrets.PYPI_API_TOKEN }}
85+
# # Or use trusted publishing (recommended):
86+
# # with:
87+
# # repository-url: https://upload.pypi.org/legacy/
88+
89+
# create-release:
90+
# needs: build
91+
# runs-on: ubuntu-latest
92+
# permissions:
93+
# contents: write
94+
# steps:
95+
# - uses: actions/checkout@v4
96+
# with:
97+
# fetch-depth: 0
98+
99+
# - name: Create GitHub Release
100+
# uses: ncipollo/release-action@v1
101+
# with:
102+
# tag: ${{ github.ref_name }}
103+
# name: Release ${{ github.ref_name }}
104+
# body: |
105+
# ## Changes
106+
107+
# - See [CHANGELOG.md](CHANGELOG.md) for detailed changes
108+
109+
# ## Installation
110+
111+
# ```bash
112+
# pip install fastwoe==${{ github.ref_name }}
113+
# ```
114+
# draft: false
115+
# prerelease: false
116+
# token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# .gitignore
22
.env
3+
.dev_notes.md
34
.ruff_cache
45
.ruff_cache/*
56
__pycache__
@@ -16,6 +17,9 @@ catboost_info
1617
.catboost_info
1718
.vscode
1819
dist
20+
models
21+
build
22+
lib
1923
xbooster.egg-info
2024
tmp
2125
python-workspace.code-workspace

0 commit comments

Comments
 (0)