Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.10 #605

Merged
merged 9 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [ '3.7', '3.8', '3.9' ]
include: # Run macos and windows tests on python 3.9 only
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
include: # Run macos and windows tests on only one python version
- os: windows-latest
python-version: '3.9'
python-version: '3.9' # PyTorch doesn't yet have 3.10 support on Windows (https://pytorch.org/get-started/locally/#windows-python)
- os: macos-latest
python-version: '3.9'
python-version: '3.10'

steps:
- name: Checkout code
Expand All @@ -48,7 +48,9 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade --upgrade-strategy eager -r requirements/dev.txt
python -m pip install --upgrade --upgrade-strategy eager -e .
if [ "$RUNNER_OS" != "Windows" ]; then # Skip distributed tests on windows for now (Windows support for ray is experimental https://docs.ray.io/en/latest/installation.html#windows-support)
if [ "$RUNNER_OS" != "Windows" ] && [ ${{ matrix.python }} < '3.10' ]; then
# Windows support for ray is experimental (https://docs.ray.io/en/latest/installation.html#windows-support)
# Python 3.10 is not yet supported (https://github.com/ray-project/ray/blob/master/python/setup.py#L24)
python -m pip install --upgrade --upgrade-strategy eager -e .[ray]
fi
python -m pip install --upgrade --upgrade-strategy eager -e .[shap]
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/test_all_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
fail-fast: false # Continue to run other builds despite a failure
matrix:
os: [ubuntu-latest]
python-version: [ '3.7', '3.8', '3.9' ]
include: # Run macos and windows tests on python 3.9 only
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
include: # Run macos and windows tests on only one python version
- os: windows-latest
python-version: '3.9'
python-version: '3.9' # PyTorch doesn't yet have 3.10 support on Windows (https://pytorch.org/get-started/locally/#windows-python)
- os: macos-latest
python-version: '3.9'
python-version: '3.10'

steps:
- name: Checkout code
Expand All @@ -41,7 +41,9 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade --upgrade-strategy eager -r requirements/dev.txt -r testing/requirements.txt
python -m pip install --upgrade --upgrade-strategy eager -e .
if [ "$RUNNER_OS" != "Windows" ]; then # Skip distributed tests on windows for now (Windows support for ray is experimental https://docs.ray.io/en/latest/installation.html#windows-support)
if [ "$RUNNER_OS" != "Windows" ] && [ ${{ matrix.python }} < '3.10' ]; then
# Windows support for ray is experimental (https://docs.ray.io/en/latest/installation.html#windows-support)
# Python 3.10 is not yet supported (https://github.com/ray-project/ray/blob/master/python/setup.py#L24)
python -m pip install --upgrade --upgrade-strategy eager -e .[ray]
fi
python -m pip install --upgrade --upgrade-strategy eager -e .[shap]
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/test_changed_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [ '3.7', '3.8', '3.9' ]
include: # Run macos and windows tests on python 3.9 only
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
include: # Run macos and windows tests on only one python version
- os: windows-latest
python-version: '3.9'
python-version: '3.9' # PyTorch doesn't yet have 3.10 support on Windows (https://pytorch.org/get-started/locally/#windows-python)
- os: macos-latest
python-version: '3.9'
python-version: '3.10'

steps:
- name: Checkout code
Expand All @@ -57,7 +57,9 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade --upgrade-strategy eager -r requirements/dev.txt -r testing/requirements.txt
python -m pip install --upgrade --upgrade-strategy eager -e .
if [ "$RUNNER_OS" != "Windows" ]; then # Skip distributed tests on windows for now (Windows support for ray is experimental https://docs.ray.io/en/latest/installation.html#windows-support)
if [ "$RUNNER_OS" != "Windows" ] && [ ${{ matrix.python }} < '3.10' ]; then
# Windows support for ray is experimental (https://docs.ray.io/en/latest/installation.html#windows-support)
# Python 3.10 is not yet supported (https://github.com/ray-project/ray/blob/master/python/setup.py#L24)
python -m pip install --upgrade --upgrade-strategy eager -e .[ray]
fi
python -m pip install --upgrade --upgrade-strategy eager -e .[shap]
Expand Down
6 changes: 5 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ repos:
- id: nbqa-pyupgrade
args: [--py37-plus]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v0.942
hooks:
- id: mypy
additional_dependencies: [
types-requests>=2.25.0,
types-attrs>=19.1.0,
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!--- BADGES: START --->

<!---
![Python version](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9-blue.svg)
![Python version](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-blue.svg)
Copy link
Member

@jklaise jklaise Apr 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need a rebase which should throw up another merge conflict as this has been automated on master. Not sure why it hasn't been thrown up already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because I screwed up. The above two lines are fenced inside comments, so the above change did nothing.

I actually updated the correct line (line 14) to use the automated versioning yesterday (5efc04b), so there is no need to update this manually at all now...

Will delete the confusing commented lines in master and rebase.

[![PyPI version](https://badge.fury.io/py/alibi-detect.svg)](https://badge.fury.io/py/alibi-detect)
--->
[![Build Status](https://github.com/SeldonIO/alibi-detect/workflows/CI/badge.svg?branch=master)][#build-status]
Expand Down
2 changes: 1 addition & 1 deletion alibi/explainers/anchor_tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ def fit(self, # type: ignore[override]
d_samplers = []
for sampler in samplers:
d_samplers.append(
DistributedAnchorTabular.ray.remote(RemoteSampler).remote(
DistributedAnchorTabular.ray.remote(RemoteSampler).remote( # type: ignore[call-overload]
*(train_data_id, d_train_data_id, sampler)
)
)
Expand Down
4 changes: 2 additions & 2 deletions alibi/explainers/cfproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def __init__(self,
self.map_cat_to_num = tf.ragged.constant([np.zeros(v) for _, v in cat_vars.items()])

# define placeholder for mapping which can be fed after the fit step
max_key = max(cat_vars, key=cat_vars.get) # type: ignore[type-var] # feature with the most categories
max_key = max(cat_vars, key=cat_vars.get) # type: ignore[arg-type] # feature with the most categories
self.max_cat = cat_vars[max_key]
cat_keys = list(cat_vars.keys())
n_cat = len(cat_keys)
Expand Down Expand Up @@ -1059,7 +1059,7 @@ def compare(x: Union[float, int, np.ndarray], y: int) -> bool:
self.class_proto[c] = self.X_by_class[c][idx_c[0][-1]].reshape(1, -1)

if self.enc_or_kdtree:
self.id_proto = min(dist_proto, key=dist_proto.get) # type: ignore[type-var]
self.id_proto = min(dist_proto, key=dist_proto.get) # type: ignore[arg-type]
proto_val = self.class_proto[self.id_proto]
if verbose:
print('Prototype class: {}'.format(self.id_proto))
Expand Down
2 changes: 1 addition & 1 deletion alibi/explainers/tests/test_shap_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ def test_explain_tree(caplog, monkeypatch, mock_tree_shap_explainer, data_type,
explainer._check_explainer_setup.assert_not_called()
explainer._check_interactions.assert_called_with(False, background_data, None)
else:
explainer._check_interactions.asert_not_called()
explainer._check_interactions.assert_not_called()
explainer._check_explainer_setup.assert_called_with(background_data, explainer.model_output, None)

explainer._build_explanation.assert_called_once()
Expand Down
4 changes: 3 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# development dependencies (see docs.txt for documentation building dependencies)
# linting and static type-checking
flake8>=3.7.7, <5.0.0
mypy>=0.670, <0.900
mypy~= 0.900
types-requests>=2.25.0, <3.0.0
types-attrs>=19.1.0, <20.0.0
# testing
pytest>=5.3.5, <7.0.0
pytest-cov>=2.6.1, <4.0.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def readme():
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: Apache Software License",
"Topic :: Scientific/Engineering",
],
Expand Down