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.ymlindex 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@v2with: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.10wget https://raw.githubusercontent.com/Homebrew/homebrew-core/679923b4eb48a8dc7ecc1f05d06063cd79b3fc00/Formula/libomp.rb -O $(find $(brew --repository) -name libomp.rb)+ brew unlink libompbrew install libompexport CC=/usr/bin/clangexport 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 wideflake8 . --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 coveragecoverage run -a -m pytest testcoverage 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@v1with:file: ./coverage.xmldiff --git a/README.md b/README.mdindex ad2294aa6..f8397286f 100644--- a/README.md+++ b/README.md@@ -1,7 +1,7 @@[](https://badge.fury.io/py/FLAML)[](https://github.com/microsoft/FLAML/actions/workflows/python-package.yml)-+[](https://pepy.tech/project/flaml)[](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.pyindex 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(