Skip to content

Commit 4deb11a

Browse files
authored
fix(RHOAIENG-40535): relax numpy and pandas constraints (#226)
* fix: relax numpy and pandas constraints * fix: Use compatible pandas * chore: Disable "extras" due to pandas incompatibility * fix linting * fix style * align black version with GHA * remove AIX360 deps temporarily
1 parent 83f30b2 commit 4deb11a

File tree

7 files changed

+31
-26
lines changed

7 files changed

+31
-26
lines changed

.github/workflows/workflow.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@ jobs:
2525
uses: ./.github/actions/build-core
2626
- name: Install TrustyAI Python package
2727
run: |
28+
pip install --upgrade pip
2829
pip install .
2930
pip install ".[dev]"
30-
pip install ".[extras]"
3131
pip install ".[api]"
32+
# Extras extra removed; keep AIX360-only deps out of the default install
3233
- name: Lint
3334
run: |
34-
pylint --ignore-imports=yes $(find src/trustyai -type f -name "*.py")
35+
pylint --ignore-imports=yes $(find src/trustyai -type f -name "*.py" | grep -v "/extras/")
3536
- name: Test with pytest
3637
run: |
3738
pytest -v -s tests/general
38-
pytest -v -s tests/extras
39+
# pytest -v -s tests/extras # Extras-only deps not installed in CI
3940
pytest -v -s tests/initialization --forked
4041
- name: Style
4142
run: |

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ All notable changes to this project will be documented in this file.
2222
This is the first version of Python TrustyAI to include support for external explainability algorithms.
2323

2424
In this release we've included AIX360's `TSICE`, `TSLime` and `TSSaliency` time-series explainers.
25-
To use these explainers TrustyAI's extra dependencies must be installed with `pip install trustyai[extras]`.
25+
These explainers rely on the AIX360 dependencies when used.
2626

2727
- Refactor TrustyAI fairness metrics namespaces ([#156](https://github.com/trustyai-explainability/trustyai-explainability-python/pull/156))
2828
- Upgrade pyarrow dependency ([#159](https://github.com/trustyai-explainability/trustyai-explainability-python/pull/159))
@@ -327,4 +327,3 @@ To use these explainers TrustyAI's extra dependencies must be installed with `pi
327327
## [0.0.2] - 2021-08-09
328328

329329
## [0.0.1] - 2021-07-21
330-

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ Install from PyPi with
1414
pip install trustyai
1515
```
1616

17-
To install additional experimental features, also use
18-
19-
```shell
20-
pip install trustyai[extras]
21-
```
22-
2317
### Local
2418

2519
The minimum dependencies can be installed (from the root directory) with
@@ -63,4 +57,4 @@ There are several working examples available in the [examples](https://github.co
6357

6458
## Contributing
6559

66-
Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for instructions on how to contribute to this project.
60+
Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for instructions on how to contribute to this project.

pyproject.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ classifiers = [
2424

2525
dependencies = [
2626
"Jpype1==1.5.0",
27-
"pyarrow==20.0.0",
27+
"pyarrow>=20.0.0",
2828
"matplotlib~=3.10.3",
29-
"pandas~=1.5.3",
30-
"numpy~=1.26.4",
29+
"pandas>=2.1.0",
30+
"numpy>=1.26.4",
3131
"jupyter-bokeh~=4.0.5",
3232
]
3333

3434
[project.optional-dependencies]
3535
dev = [
3636
"JPype1==1.5.0",
37-
"black~=22.12.0",
37+
"black~=25.11",
3838
"click==8.0.4",
3939
"joblib~=1.2.0",
4040
"jupyterlab~=4.4.4",
@@ -56,7 +56,6 @@ detoxify = [
5656
"datasets",
5757
"scipy~=1.12.0",
5858
"torch~=2.2.1",
59-
"iter-tools",
6059
"evaluate",
6160
"trl",
6261
]
@@ -85,4 +84,4 @@ markers = [
8584
[tool.setuptools.packages.find]
8685
where = ["src"]
8786

88-
[tool.setuptools_scm]
87+
[tool.setuptools_scm]

requirements.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
JPype1==1.4.1
2-
matplotlib==3.6.3
3-
pandas==1.2.5
4-
pyarrow==14.0.1
1+
Jpype1==1.5.0
2+
pyarrow>=20.0.0
3+
matplotlib~=3.10.3
4+
pandas>=2.1.0
5+
numpy>=1.26.4
56
jupyter-bokeh~=4.0.5

src/trustyai/initializer.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# pylint: disable = import-error, import-outside-toplevel, dangerous-default-value, invalid-name, R0801
22
# pylint: disable = deprecated-module
33
"""Main TrustyAI Python bindings"""
4-
from distutils.sysconfig import get_python_lib
4+
try:
5+
from distutils.sysconfig import get_python_lib
6+
except ImportError:
7+
# distutils is deprecated and removed in Python 3.12+
8+
# Use sysconfig instead
9+
import sysconfig
10+
11+
def get_python_lib():
12+
"""Fallback implementation of get_python_lib using sysconfig."""
13+
return sysconfig.get_path("purelib")
14+
15+
516
import glob
617
import logging
718
import os

src/trustyai/visualizations/lime.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def _matplotlib_plot(
3030
for feature_importance in (
3131
explanations.saliency_map().get(output_name).getPerFeatureImportance()
3232
):
33-
dictionary[
34-
feature_importance.getFeature().name
35-
] = feature_importance.getScore()
33+
dictionary[feature_importance.getFeature().name] = (
34+
feature_importance.getScore()
35+
)
3636

3737
colours = [
3838
(

0 commit comments

Comments
 (0)