Skip to content

Commit f1817ea

Browse files
authored
Add support to python 3.13 (#1486)
1 parent f6a5163 commit f1817ea

7 files changed

Lines changed: 29 additions & 12 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
fail-fast: false
4141
matrix:
4242
os: [ubuntu-latest, windows-latest]
43-
python-version: ["3.10", "3.11", "3.12"]
43+
python-version: ["3.10", "3.11", "3.12", "3.13"]
4444
steps:
4545
- uses: actions/checkout@v4
4646
- name: Set up Python ${{ matrix.python-version }}
@@ -74,6 +74,11 @@ jobs:
7474
run: |
7575
pip install pyspark==4.0.1
7676
pip list | grep "pyspark"
77+
- name: On Ubuntu python 3.13, install pyspark 4.1.0
78+
if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest'
79+
run: |
80+
pip install pyspark==4.1.0
81+
pip list | grep "pyspark"
7782
# # TODO: support ray
7883
# - name: If linux and python<3.11, install ray 2
7984
# if: matrix.os == 'ubuntu-latest' && matrix.python-version < '3.11'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ FLAML has a .NET implementation in [ML.NET](http://dot.net/ml), an open-source,
3434

3535
## Installation
3636

37-
The latest version of FLAML requires **Python >= 3.10 and < 3.13**. While other Python versions may work for core components, full model support is not guaranteed. FLAML can be installed via `pip`:
37+
The latest version of FLAML requires **Python >= 3.10 and < 3.14**. While other Python versions may work for core components, full model support is not guaranteed. FLAML can be installed via `pip`:
3838

3939
```bash
4040
pip install flaml

flaml/version.py

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

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
],
5353
"test": [
5454
"numpy>=1.17,<2.0.0; python_version<'3.13'",
55-
"numpy>2.0.0; python_version>='3.13'",
56-
"jupyter; python_version<'3.13'",
55+
"numpy>=1.17; python_version>='3.13'",
56+
"jupyter",
5757
"lightgbm>=2.3.1",
5858
"xgboost>=0.90,<2.0.0; python_version<'3.11'",
5959
"xgboost>=2.0.0; python_version>='3.11'",
@@ -68,10 +68,10 @@
6868
"pre-commit",
6969
"torch",
7070
"torchvision",
71-
"catboost>=0.26; python_version<'3.13'",
71+
"catboost>=0.26",
7272
"rgf-python",
7373
"optuna>=2.8.0,<=3.6.1",
74-
"openml; python_version<'3.13'",
74+
"openml",
7575
"statsmodels>=0.12.2",
7676
"psutil",
7777
"dataclasses",
@@ -82,7 +82,7 @@
8282
"rouge_score",
8383
"hcrystalball",
8484
"seqeval",
85-
"pytorch-forecasting; python_version<'3.13'",
85+
"pytorch-forecasting",
8686
"mlflow-skinny<=2.22.1", # Refer to https://mvnrepository.com/artifact/org.mlflow/mlflow-spark
8787
"joblibspark>=0.5.0",
8888
"joblib<=1.3.2",
@@ -140,7 +140,7 @@
140140
"prophet>=1.1.5",
141141
"statsmodels>=0.12.2",
142142
"hcrystalball>=0.1.10",
143-
"pytorch-forecasting>=0.10.4; python_version<'3.13'",
143+
"pytorch-forecasting>=0.10.4",
144144
"pytorch-lightning>=1.9.0",
145145
"tensorboardX>=2.6",
146146
],

test/automl/test_extra_models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ def _test_sparse_matrix_classification(estimator):
188188
"n_jobs": 1,
189189
"model_history": True,
190190
}
191-
X_train = scipy.sparse.random(1554, 21, dtype=int)
191+
# NOTE: Avoid `dtype=int` here. On some NumPy/SciPy combinations (notably
192+
# Windows + Python 3.13), `scipy.sparse.random(..., dtype=int)` may trigger
193+
# integer sampling paths which raise "low is out of bounds for int32".
194+
# A float sparse matrix is sufficient to validate sparse-input support.
195+
X_train = scipy.sparse.random(1554, 21, dtype=np.float32)
192196
y_train = np.random.randint(3, size=1554)
193197
automl_experiment.fit(X_train=X_train, y_train=y_train, **automl_settings)
194198

test/automl/test_multiclass.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,11 @@ def test_sparse_matrix_classification(self):
368368
"n_jobs": 1,
369369
"model_history": True,
370370
}
371-
X_train = scipy.sparse.random(1554, 21, dtype=int)
371+
# NOTE: Avoid `dtype=int` here. On some NumPy/SciPy combinations (notably
372+
# Windows + Python 3.13), `scipy.sparse.random(..., dtype=int)` may trigger
373+
# integer sampling paths which raise "low is out of bounds for int32".
374+
# A float sparse matrix is sufficient to validate sparse-input support.
375+
X_train = scipy.sparse.random(1554, 21, dtype=np.float32)
372376
y_train = np.random.randint(3, size=1554)
373377
automl_experiment.fit(X_train=X_train, y_train=y_train, **automl_settings)
374378
print(automl_experiment.classes_)

test/spark/test_multiclass.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ def test_sparse_matrix_classification(self):
262262
"n_concurrent_trials": 2,
263263
"use_spark": True,
264264
}
265-
X_train = scipy.sparse.random(1554, 21, dtype=int)
265+
# NOTE: Avoid `dtype=int` here. On some NumPy/SciPy combinations (notably
266+
# Windows + Python 3.13), `scipy.sparse.random(..., dtype=int)` may trigger
267+
# integer sampling paths which raise "low is out of bounds for int32".
268+
# A float sparse matrix is sufficient to validate sparse-input support.
269+
X_train = scipy.sparse.random(1554, 21, dtype=np.float32)
266270
y_train = np.random.randint(3, size=1554)
267271
automl_experiment.fit(X_train=X_train, y_train=y_train, **automl_settings)
268272
print(automl_experiment.classes_)

0 commit comments

Comments
 (0)