Skip to content

Commit 4633bf9

Browse files
rmontananaclaude
andcommitted
CI: Drop requirements.txt usage and modernize workflows
Install dev/runtime deps via `pip install .[dev]`, bump CodeQL action to v3, extend Python matrix to 3.13/3.14, enable pip cache, and align Strees + pyproject with scikit-learn 1.8 API (validate_data, __sklearn_tags__). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e92fe04 commit 4633bf9

6 files changed

Lines changed: 44 additions & 31 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424

2525
steps:
2626
- name: Checkout repository
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
2828

2929
# Initializes the CodeQL tools for scanning.
3030
- name: Initialize CodeQL
31-
uses: github/codeql-action/init@v2
31+
uses: github/codeql-action/init@v3
3232
with:
3333
languages: ${{ matrix.language }}
3434
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -39,7 +39,7 @@ jobs:
3939
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4040
# If this step fails, then you should remove it and run the build manually (see below)
4141
- name: Autobuild
42-
uses: github/codeql-action/autobuild@v2
42+
uses: github/codeql-action/autobuild@v3
4343

4444
# ℹ️ Command-line programs to run using the OS shell.
4545
# 📚 https://git.io/JvXDl
@@ -53,4 +53,4 @@ jobs:
5353
# make release
5454

5555
- name: Perform CodeQL Analysis
56-
uses: github/codeql-action/analyze@v2
56+
uses: github/codeql-action/analyze@v3

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [macos-latest, ubuntu-latest, windows-latest]
16-
python: [3.11, 3.12]
16+
python: [3.11, 3.12, 3.13, 3.14]
1717

1818
steps:
1919
- uses: actions/checkout@v4
2020
- name: Set up Python ${{ matrix.python }}
2121
uses: actions/setup-python@v5
2222
with:
2323
python-version: ${{ matrix.python }}
24+
cache: 'pip'
25+
cache-dependency-path: pyproject.toml
2426
- name: Install dependencies
2527
run: |
2628
pip install -q --upgrade pip
27-
pip install -q -r requirements.txt
28-
pip install -q --upgrade codecov coverage black flake8 codacy-coverage
29+
pip install -q .[dev]
2930
- name: Lint
3031
run: |
3132
# black --check --diff stree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![CI](https://github.com/Doctorado-ML/STree/workflows/CI/badge.svg)
44
[![CodeQL](https://github.com/Doctorado-ML/STree/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Doctorado-ML/STree/actions/workflows/codeql-analysis.yml)
55
[![codecov](https://codecov.io/gh/doctorado-ml/stree/branch/master/graph/badge.svg)](https://codecov.io/gh/doctorado-ml/stree)
6-
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/35fa3dfd53a24a339344b33d9f9f2f3d)](https://www.codacy.com/gh/Doctorado-ML/STree?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/STree&utm_campaign=Badge_Grade)
6+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/35fa3dfd53a24a339344b33d9f9f2f3d)](https://app.codacy.com/gh/Doctorado-ML/STree/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
77
[![PyPI version](https://badge.fury.io/py/STree.svg)](https://badge.fury.io/py/STree)
88
![https://img.shields.io/badge/python-3.11%2B-blue](https://img.shields.io/badge/python-3.11%2B-brightgreen)
99
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Doctorado-ML/STree)
@@ -13,7 +13,6 @@
1313

1414
Oblique Tree classifier based on SVM nodes. The nodes are built and splitted with sklearn SVC models. Stree is a sklearn estimator and can be integrated in pipelines, grid searches, etc.
1515

16-
1716
## Installation
1817

1918
```bash

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "STree"
7-
dependencies = ["scikit-learn==1.5.2", "numpy==1.26.4", "mufs"]
8-
license = { file = "LICENSE" }
7+
dependencies = ["scikit-learn>=1.8.0", "mufs"]
8+
license = "MIT"
9+
license-files = ["LICENSE"]
910
description = "Oblique decision tree with svm nodes."
1011
readme = "README.md"
1112
authors = [

stree/Strees.py

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
from sklearn.preprocessing import StandardScaler
1212
from sklearn.utils.multiclass import check_classification_targets
1313
from sklearn.utils.validation import (
14-
check_X_y,
15-
check_array,
1614
check_is_fitted,
1715
_check_sample_weight,
16+
validate_data,
1817
)
18+
from sklearn.utils._tags import (Tags, ClassifierTags, TargetTags, InputTags)
1919
from .Splitter import Splitter, Snode, Siterator
2020
from ._version import __version__
2121

2222

23-
class Stree(BaseEstimator, ClassifierMixin):
23+
class Stree(ClassifierMixin, BaseEstimator):
2424
"""
2525
Estimator that is based on binary trees of svm nodes
2626
can deal with sample_weights in predict, used in boosting sklearn methods
@@ -179,15 +179,32 @@ def __call__(self) -> None:
179179
ensembles"""
180180
pass
181181

182-
def _more_tags(self) -> dict:
183-
"""Required by sklearn to supply features of the classifier
184-
make mandatory the labels array
185-
186-
:return: the tag required
187-
:rtype: dict
188-
"""
189-
return {"requires_y": True}
190-
182+
def __sklearn_tags__(self):
183+
return Tags(
184+
estimator_type="classifier",
185+
target_tags=TargetTags(
186+
required=True,
187+
multi_output=False,
188+
),
189+
classifier_tags=ClassifierTags(
190+
multi_class=True,
191+
multi_label=False,
192+
poor_score=False,
193+
),
194+
input_tags=InputTags(
195+
sparse=False,
196+
one_d_array=False,
197+
two_d_array=True,
198+
three_d_array=False,
199+
categorical=True,
200+
string=True,
201+
pairwise=False,
202+
),
203+
requires_fit=True,
204+
array_api_support=False,
205+
non_deterministic=False,
206+
_skip_test=False,
207+
)
191208
def fit(
192209
self,
193210
X: np.ndarray,
@@ -245,7 +262,7 @@ def fit(
245262
if self.kernel not in kernels:
246263
raise ValueError(f"Kernel {self.kernel} not in {kernels}")
247264
check_classification_targets(y)
248-
X, y = check_X_y(X, y)
265+
X, y = validate_data(self, X, y)
249266
sample_weight = _check_sample_weight(
250267
sample_weight, X, dtype=np.float64
251268
)
@@ -435,12 +452,7 @@ def check_predict(self, X) -> np.array:
435452
"""
436453
check_is_fitted(self, ["tree_"])
437454
# Input validation
438-
X = check_array(X)
439-
if X.shape[1] != self.n_features_:
440-
raise ValueError(
441-
f"Expected {self.n_features_} features but got "
442-
f"({X.shape[1]})"
443-
)
455+
X = validate_data(self, X, reset=False)
444456
return X
445457

446458
def predict_proba(self, X: np.array) -> np.array:

stree/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.4.1"
1+
__version__ = "1.4.2"

0 commit comments

Comments
 (0)