Skip to content

A programming framework for agentic AI

Add python 3.10 in the CI (#591)

Chi Wang3a7ebe689619
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
index cebff3fbe..32f82d5c0 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/python-package.yml
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
- python-version: [3.6, 3.7, 3.8, 3.9]
+ python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
@@ -24,11 +24,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- - name: If mac, install libomp to facilitate lgbm and xgboost install
- if: matrix.os == 'macOS-latest'
+ - name: On mac + python 3.10, install libomp to facilitate lgbm and xgboost install
+ if: matrix.os == 'macOS-latest' && matrix.python-version == '3.10'
run: |
- # remove libomp version constraint after xgboost works with libomp>11.1.0
+ # remove libomp version constraint after xgboost works with libomp>11.1.0 on python 3.10
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/679923b4eb48a8dc7ecc1f05d06063cd79b3fc00/Formula/libomp.rb -O $(find $(brew --repository) -name libomp.rb)
+ brew unlink libomp
brew install libomp
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
@@ -42,8 +43,8 @@ jobs:
pip install -e .
python -c "import flaml"
pip install -e .[test]
- - name: If linux or mac, install ray
- if: (matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest') && matrix.python-version != '3.9'
+ - name: If linux or mac, install ray and prophet
+ if: (matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest') && matrix.python-version != '3.9' && matrix.python-version != '3.10'
run: |
pip install -e .[ray,forecast]
pip install 'tensorboardX<=2.2'
@@ -54,17 +55,17 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
- if: ${{ matrix.python-version != '3.7' || matrix.os == 'macos-latest' }}
+ if: ${{ (matrix.python-version != '3.7' || matrix.os == 'macos-latest') && matrix.python-version != '3.10' }}
run: |
pytest test
- name: Coverage
- if: ${{ matrix.python-version == '3.7' && matrix.os != 'macos-latest' }}
+ if: ${{ (matrix.python-version == '3.7') && matrix.os != 'macos-latest' || matrix.python-version == '3.10' }}
run: |
pip install coverage
coverage run -a -m pytest test
coverage xml
- name: Upload coverage to Codecov
- if: ${{ matrix.python-version == '3.7' && matrix.os != 'macos-latest' }}
+ if: ${{ (matrix.python-version == '3.7') && matrix.os != 'macos-latest' || matrix.python-version == '3.10'}}
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
diff --git a/README.md b/README.md
index ad2294aa6..f8397286f 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
[![PyPI version](https://badge.fury.io/py/FLAML.svg)](https://badge.fury.io/py/FLAML)
![Conda version](https://img.shields.io/conda/vn/conda-forge/flaml)
[![Build](https://github.com/microsoft/FLAML/actions/workflows/python-package.yml/badge.svg)](https://github.com/microsoft/FLAML/actions/workflows/python-package.yml)
-![Python Version](https://img.shields.io/badge/3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue)
+![Python Version](https://img.shields.io/badge/3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-blue)
[![Downloads](https://pepy.tech/badge/flaml)](https://pepy.tech/project/flaml)
[![Join the chat at https://gitter.im/FLAMLer/community](https://badges.gitter.im/FLAMLer/community.svg)](https://gitter.im/FLAMLer/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
diff --git a/flaml/data.py b/flaml/data.py
index 149cd8983..379147ac0 100644
--- a/flaml/data.py
+++ b/flaml/data.py
@@ -96,9 +96,14 @@ def load_openml_dataset(
with open(filepath, "wb") as f:
pickle.dump(dataset, f, pickle.HIGHEST_PROTOCOL)
print("Dataset name:", dataset.name)
- X, y, *__ = dataset.get_data(
- target=dataset.default_target_attribute, dataset_format=dataset_format
- )
+ try:
+ X, y, *__ = dataset.get_data(
+ target=dataset.default_target_attribute, dataset_format=dataset_format
+ )
+ except ValueError:
+ from sklearn.datasets import fetch_openml
+
+ X, y = fetch_openml(data_id=dataset_id, return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=random_state)
print(
"X_train.shape: {}, y_train.shape: {};\nX_test.shape: {}, y_test.shape: {}".format(