Skip to content

Commit 8f59ae1

Browse files
authored
[to main branch] Pandas uptake for py3.8 and py3.9+ (#682)
1 parent d209cc1 commit 8f59ae1

File tree

8 files changed

+75
-75
lines changed

8 files changed

+75
-75
lines changed

.github/workflows/run-unittests-default_setup.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: "[Py3.8][Py3.9][Py3.10] tests/unitary/default_setup/**"
33
on:
44
workflow_dispatch:
55
pull_request:
6+
branches: [ "main" ]
67

78
# Cancel in progress workflows on pull_requests.
89
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -43,13 +44,15 @@ jobs:
4344
name: "Test config setup"
4445

4546
- name: "Run default_setup tests folder ONLY with minimum ADS dependencies"
46-
timeout-minutes: 15
47+
timeout-minutes: 30
4748
shell: bash
4849
env:
4950
NoDependency: True
5051
run: |
5152
set -x # print commands that are executed
5253
$CONDA/bin/conda init
5354
source /home/runner/.bashrc
55+
conda install python=${{ matrix.python-version }}
5456
pip install -r test-requirements.txt
57+
conda list
5558
python -m pytest -v -p no:warnings --durations=5 tests/unitary/default_setup

.github/workflows/run-unittests-py38-cov-report.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: "[Py3.8][COV REPORT] tests/unitary/**"
33
on:
44
workflow_dispatch:
55
pull_request:
6+
branches: [ "main" ]
67

78
# Cancel in progress workflows on pull_requests.
89
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -33,6 +34,7 @@ jobs:
3334
test-path: "tests/unitary"
3435
# `model` tests running in "slow_tests",
3536
# `feature_store` tests has its own test suite
37+
# 'hpo' tests hangs if run together with all unitary tests. Tests running in separate command before running all unitary
3638
ignore-path: |
3739
--ignore tests/unitary/with_extras/model \
3840
--ignore tests/unitary/with_extras/feature_store \
@@ -59,13 +61,18 @@ jobs:
5961

6062
- uses: ./.github/workflows/test-env-setup
6163
name: "Test env setup"
62-
timeout-minutes: 20
64+
timeout-minutes: 30
6365

6466
# Installing forecast deps for python3.8 test setup only, it will not work with python3.9/3.10, because
6567
# automlx do not support py3.9 and some versions of py3.10. This step omitted in -py39-py30.yml workflow
6668
- name: "Install Forecasting dependencies"
6769
run: |
6870
pip install -e ".[forecast]"
71+
# Installing pii deps for python3.8 test setup only, it will not work with python3.9/3.10, because
72+
# 'datapane' library conflicts with pandas>2.2.0, which used in py3.9/3.10 setup
73+
- name: "Install PII dependencies"
74+
run: |
75+
pip install -e ".[pii]"
6976
- name: "Install featurestore marketplace dependencies"
7077
run: |
7178
pip install -e ".[feature-store-marketplace]"

.github/workflows/run-unittests-py39-py310.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ jobs:
3535
# `model` tests running in "slow_tests",
3636
# `feature_store` tests has its own test suite
3737
# `forecast` tests not supported in python 3.9,3.10 (automlx dependency). Tests are running in python3.8 test env, see run-unittests-py38-cov-report.yml
38+
# 'pii' tests run only with py3.8, 'datapane' library conflicts with pandas>2.2.0, which used in py3.9/3.10 setup
3839
# 'hpo' tests hangs if run together with all unitary tests. Tests running in separate command before running all unitary
3940
ignore-path: |
4041
--ignore tests/unitary/with_extras/model \
4142
--ignore tests/unitary/with_extras/feature_store \
4243
--ignore tests/unitary/with_extras/operator/forecast \
44+
--ignore tests/unitary/with_extras/operator/pii \
4345
--ignore tests/unitary/with_extras/hpo
4446
- name: "slow_tests"
4547
test-path: "tests/unitary/with_extras/model"
@@ -63,7 +65,7 @@ jobs:
6365

6466
- uses: ./.github/workflows/test-env-setup
6567
name: "Test env setup"
66-
timeout-minutes: 20
68+
timeout-minutes: 30
6769

6870
- name: "Run hpo tests"
6971
timeout-minutes: 10

.github/workflows/test-env-setup/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ runs:
1414
sudo apt-get install libkrb5-dev graphviz
1515
$CONDA/bin/conda init
1616
source /home/runner/.bashrc
17-
17+
conda install python=${{ matrix.python-version }}
1818
pip install -r dev-requirements.txt
19+
conda list

README-development.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ To run all unit test install extra dependencies to test all modules of ADS ASD.
101101

102102
```bash
103103
# Update your environment with tests dependencies
104-
pip install -r dev-requirements.txt
104+
pip install -r test-requirements.txt
105+
pip install -e ".[testsuite]"
105106
# Run all unit tests
106107
python3 -m pytest tests/unitary
107108
```
@@ -113,7 +114,8 @@ To run all but opctl integration tests, you can run:
113114

114115
```bash
115116
# Update your environment with tests dependencies
116-
pip install -r dev-requirements.txt
117+
pip install -r test-requirements.txt
118+
pip install -e ".[testsuite]"
117119
# Run integration tests
118120
python3 -m pytest tests/integration --ignore=tests/integration/opctl
119121
```

dev-requirements.txt

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
-r test-requirements.txt
2-
-e ".[bds,data,geo,huggingface,llm,notebook,onnx,opctl,optuna,pii,spark,tensorflow,text,torch,viz]"
3-
arff
4-
category_encoders
5-
cohere
6-
dask
7-
faiss-cpu
8-
fastparquet
9-
imbalanced-learn
10-
lxml
11-
mysql-connector-python
12-
nltk
13-
opensearch-py
14-
pdfplumber
15-
py4j
16-
pyarrow
17-
tables
18-
xlrd>=1.2.0
2+
-e ".[bds,data,geo,huggingface,llm,notebook,onnx,opctl,optuna,spark,tensorflow,text,torch,viz]"
3+
-e ".[testsuite]"

pyproject.toml

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
# PEP 517 – A build-system independent format for source trees - https://peps.python.org/pep-0517/
88
# Till recently flit-core library was suggested by pip, so we used it. In future, cosider to change to
99
# other, if better, build-backend library.
10-
requires = ["flit-core >=3.8,<4"] # should specify <4, so won’t be impacted by changes in the next major version
10+
requires = [
11+
"flit-core >=3.8,<4",
12+
] # should specify <4, so won’t be impacted by changes in the next major version
1113
build-backend = "flit_core.buildapi"
1214

1315

@@ -18,17 +20,15 @@ build-backend = "flit_core.buildapi"
1820
# PEP 518 – Specifying Minimum Build System Requirements for Python Projects https://peps.python.org/pep-0518/
1921

2022
# Required
21-
name = "oracle_ads" # the install (PyPI) name; name for local build in [tool.flit.module] section below
23+
name = "oracle_ads" # the install (PyPI) name; name for local build in [tool.flit.module] section below
2224
version = "2.10.1"
2325

2426
# Optional
2527
description = "Oracle Accelerated Data Science SDK"
26-
readme = {file = "README.md", content-type = "text/markdown"}
28+
readme = { file = "README.md", content-type = "text/markdown" }
2729
requires-python = ">=3.8"
28-
license = {file = "LICENSE.txt"}
29-
authors = [
30-
{name = "Oracle Data Science"}
31-
]
30+
license = { file = "LICENSE.txt" }
31+
authors = [{ name = "Oracle Data Science" }]
3232
keywords = [
3333
"Oracle Cloud Infrastructure",
3434
"OCI",
@@ -54,7 +54,7 @@ classifiers = [
5454
# In dependencies se "<library>; platform_machine == 'aarch64'" to specify ARM underlying platform
5555
# Copied from install_requires list in setup.py, setup.py got removed in favor of this config file
5656
dependencies = [
57-
"PyYAML>=6", # pyyaml 5.4 is broken with cython 3
57+
"PyYAML>=6", # pyyaml 5.4 is broken with cython 3
5858
"asteval>=0.9.25",
5959
"cerberus>=1.3.4",
6060
"cloudpickle>=1.6.0",
@@ -65,7 +65,8 @@ dependencies = [
6565
"numpy>=1.19.2",
6666
"oci>=2.113.0",
6767
"ocifs>=1.1.3",
68-
"pandas>1.2.1,<2.1",
68+
"pandas>1.2.1; python_version<'3.9'", # starting pandas v2.1.0 requires-python = '>=3.9'
69+
"pandas>=2.2.0; python_version>='3.9'",
6970
"psutil>=5.7.2",
7071
"python_jsonschema_objects>=0.3.13",
7172
"requests",
@@ -76,13 +77,9 @@ dependencies = [
7677

7778
[project.optional-dependencies]
7879
# Copied from extras_require list in setup.py, setup.py got removed in favor of this config file
79-
bds = [
80-
"hdfs[kerberos]",
81-
"ibis-framework[impala]",
82-
"sqlalchemy",
83-
]
80+
bds = ["hdfs[kerberos]", "ibis-framework[impala]", "sqlalchemy"]
8481
boosted = [
85-
"lightgbm<4.0.0", # relax when the official releases of skl2onnx (v1.16.0) and onnxmltools (1.11.3), https://github.com/sdpython/mlprodict/issues/488
82+
"lightgbm<4.0.0", # relax when the official releases of skl2onnx (v1.16.0) and onnxmltools (1.11.3), https://github.com/sdpython/mlprodict/issues/488
8683
"xgboost",
8784
]
8885
data = [
@@ -94,22 +91,14 @@ data = [
9491
"pandavro>=1.6.0",
9592
"sqlalchemy>=1.4.1, <=1.4.46",
9693
]
97-
geo = [
98-
"geopandas",
99-
"oracle_ads[viz]",
100-
]
101-
huggingface = [
102-
"transformers",
103-
]
104-
notebook = [
105-
"ipython>=7.23.1, <8.0",
106-
"ipywidgets~=7.6.3",
107-
]
94+
geo = ["geopandas", "oracle_ads[viz]"]
95+
huggingface = ["transformers"]
96+
notebook = ["ipython>=7.23.1, <8.0", "ipywidgets~=7.6.3"]
10897
onnx = [
109-
"lightgbm<4.0.0", # relax when the official releases of skl2onnx (v1.16.0) and onnxmltools (1.11.3), https://github.com/sdpython/mlprodict/issues/488
98+
"lightgbm<4.0.0", # relax when the official releases of skl2onnx (v1.16.0) and onnxmltools (1.11.3), https://github.com/sdpython/mlprodict/issues/488
11099
"onnx>=1.12.0",
111100
"onnxmltools>=1.10.0",
112-
"onnxruntime>=1.10.0,<1.16", # v1.16 introduced issues https://github.com/microsoft/onnxruntime/issues/17631, revealed by unit tests
101+
"onnxruntime>=1.10.0,<1.16", # v1.16 introduced issues https://github.com/microsoft/onnxruntime/issues/17631, revealed by unit tests
113102
"oracle_ads[viz]",
114103
"protobuf<=3.20",
115104
"skl2onnx>=1.10.4",
@@ -126,26 +115,11 @@ opctl = [
126115
"py-cpuinfo",
127116
"rich",
128117
]
129-
optuna = [
130-
"optuna==2.9.0",
131-
"oracle_ads[viz]",
132-
]
133-
spark = [
134-
"pyspark>=3.0.0",
135-
]
136-
tensorflow = [
137-
"oracle_ads[viz]",
138-
"tensorflow",
139-
]
140-
text = [
141-
"spacy",
142-
"wordcloud>=1.8.1",
143-
]
144-
torch = [
145-
"oracle_ads[viz]",
146-
"torch",
147-
"torchvision",
148-
]
118+
optuna = ["optuna==2.9.0", "oracle_ads[viz]"]
119+
spark = ["pyspark>=3.0.0"]
120+
tensorflow = ["oracle_ads[viz]", "tensorflow"]
121+
text = ["spacy", "wordcloud>=1.8.1"]
122+
torch = ["oracle_ads[viz]", "torch", "torchvision"]
149123
viz = [
150124
"bokeh>=3.0.0, <3.2.0", # starting 3.2.0 bokeh not supporting python3.8; relax after ADS will drop py3.8 support
151125
"folium>=0.12.1",
@@ -203,9 +177,34 @@ pii = [
203177
"spacy-transformers==1.2.5",
204178
"spacy==3.6.1",
205179
]
206-
llm = [
207-
"langchain>=0.0.295",
208-
"evaluate>=0.4.0",
180+
llm = ["langchain>=0.1.10", "evaluate>=0.4.0"]
181+
aqua = ["fire", "cachetools"]
182+
183+
# To reduce backtracking (decrese deps install time) during test/dev env setup reducing number of versions pip is
184+
# trying to use. Ref - https://pip.pypa.io/en/stable/topics/dependency-resolution/#possible-ways-to-reduce-backtracking.
185+
# Revisit this section continuously and update to recent version of libraries. focus on pyt3.9/3.10 versions.
186+
testsuite = [
187+
"dask==2023.5.0; python_version=='3.8'",
188+
"dask==2023.10.1; python_version>='3.9'", # oci-cli depends on click==8.0.4, dask>2023.10.1 depends on "click>=8.1"
189+
"arff",
190+
"category_encoders==2.6.3", # set version to avoid backtracking
191+
"cohere==4.53", # set version to avoid backtracking
192+
"dask==2023.10.1; python_version>='3.9'", # oci-cli depends on click==8.0.4, dask>2023.10.1 depends on "click>=8.1"
193+
"dask==2023.5.0; python_version=='3.8'",
194+
"faiss-cpu",
195+
"fastparquet==2024.2.0", # set version to avoid backtracking
196+
"imbalanced-learn",
197+
"lxml",
198+
"mysql-connector-python",
199+
"nltk",
200+
"opensearch-py",
201+
"pdfplumber",
202+
"py4j",
203+
"pyarrow",
204+
"statsmodels; python_version=='3.8'",
205+
"statsmodels>=0.14.1; python_version>='3.9'", # cython3.0 compatibility added in v0.14.1
206+
"tables",
207+
"xlrd>=1.2.0",
209208
]
210209

211210

@@ -217,7 +216,7 @@ llm = [
217216
ads = "ads.cli:cli"
218217

219218
[tool.flit.module]
220-
name = "ads" # name for local build and import, see https://flit.pypa.io/en/latest/pyproject_toml.html#module-section
219+
name = "ads" # name for local build and import, see https://flit.pypa.io/en/latest/pyproject_toml.html#module-section
221220

222221
[tool.flit.sdist]
223222
# By default `ads` folder and `LICENSE.txt` file included in sdist. Folders `docs` and `tests` are excluded, as weel as other project files

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ click
33
coverage
44
faker
55
mock
6+
parameterized
67
pip
78
pytest
89
pytest-cov

0 commit comments

Comments
 (0)