Skip to content

Commit 273c881

Browse files
authored
Feature/featurestore backmerge (#341)
2 parents 856b5f3 + 476b9e0 commit 273c881

File tree

84 files changed

+1323
-971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1323
-971
lines changed

.github/workflows/add-3plicense-warning.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: "Add 3P License Warning to PR"
33
on:
44
pull_request:
55
paths:
6-
- setup.py
6+
- pyproject.toml
77

88
# Cancel in progress workflows on pull_requests.
99
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -23,9 +23,9 @@ jobs:
2323
steps:
2424
- run: |
2525
BODY_MSG=$(cat << EOF
26-
⚠️ This PR changed **setup.py** file. ⚠️
27-
- PR Creator must update 📃 THIRD_PARTY_LICENSES.txt, if any 📚 library added/removed in **setup.py**.
28-
- PR Approver must confirm 📃 THIRD_PARTY_LICENSES.txt updated, if any 📚 library added/removed in **setup.py**.
26+
⚠️ This PR changed **pyproject.toml** file. ⚠️
27+
- PR Creator must update 📃 THIRD_PARTY_LICENSES.txt, if any 📚 library added/removed in **pyproject.toml**.
28+
- PR Approver must confirm 📃 THIRD_PARTY_LICENSES.txt updated, if any 📚 library added/removed in **pyproject.toml**.
2929
EOF
3030
)
3131
echo "BODY_MSG<<EOF" >> $GITHUB_ENV

.github/workflows/publish-to-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
python-version: "3.x"
1717
- name: Build distribution 📦
1818
run: |
19-
pip install wheel
19+
pip install build
2020
make dist
2121
- name: Validate
2222
run: |
2323
pip install dist/*.whl
2424
python -c "import ads;"
25-
## To run publish to test PyPI secret with token needs to be added,
25+
## To run publish to test PyPI a secret with token needs to be added,
2626
## this one GH_ADS_TESTPYPI_TOKEN - removed after initial test.
27-
## Project name also needed to be updated in setup.py - setup(name="test_oracle_ads", ...),
27+
## Project name also needed to be updated in pyproject.toml - name = "test_oracle_ads" in [project] section
2828
## regular name is occupied by former developer and can't be used for testing
2929
# - name: Publish distribution 📦 to Test PyPI
3030
# env:

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ on:
99
- develop
1010
paths:
1111
- "ads/**"
12-
- "!ads/ads_version.json"
13-
- setup.py
12+
- pyproject.toml
1413
- "**requirements.txt"
1514
- .github/workflows/run-unittests.yml
1615
- .github/workflows/run-unittests-default_setup.yml

.github/workflows/run-unittests.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ on:
99
- develop
1010
paths:
1111
- "ads/**"
12-
- "!ads/ads_version.json"
13-
- setup.py
12+
- pyproject.toml
1413
- "**requirements.txt"
1514
- .github/workflows/run-unittests.yml
1615
- .github/workflows/run-unittests-default_setup.yml
@@ -39,9 +38,9 @@ jobs:
3938
fail-fast: false
4039
matrix:
4140
python-version: ["3.8", "3.9", "3.10"]
42-
test-path: ["tests/unitary", "tests/unitary/with_extras/model"]
41+
test-path: ["tests/unitary/with_extras tests/unitary/default_setup", "tests/unitary/with_extras/model"]
4342
include:
44-
- test-path: "tests/unitary"
43+
- test-path: "tests/unitary/with_extras tests/unitary/default_setup"
4544
ignore-path: "--ignore tests/unitary/with_extras/model --ignore tests/unitary/with_extras/feature_store"
4645
name: "unitary"
4746
- test-path: "tests/unitary/with_extras/model"
@@ -148,15 +147,15 @@ jobs:
148147
run: |
149148
set -x # print commands that are executed
150149
151-
# Prepare default cov body text
150+
# Prepare default cov body text
152151
COV_BODY_INTRO="📌 Overall coverage:\n\n"
153152
echo COV_BODY="$COV_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
154153
155154
# Prepare file paths to .coverage files
156155
# Filenames taken from job.test last step with name - "Save coverage files"
157-
FILE_UNITARY="cov-reports-unitary/.coverage"; [[ ! -f $FILE_UNITARY ]] && FILE_UNITARY=""
156+
FILE_UNITARY="cov-reports-unitary/.coverage"; [[ ! -f $FILE_UNITARY ]] && FILE_UNITARY=""
158157
FILE_MODEL="cov-reports-model/.coverage"; [[ ! -f $FILE_MODEL ]] && FILE_MODEL=""
159-
158+
160159
# Combine coverage files
161160
pip install coverage
162161
coverage combine $FILE_UNITARY $FILE_MODEL
@@ -166,7 +165,7 @@ jobs:
166165
167166
# Calculate overall coverage and update body message
168167
COV=$(grep -E 'pc_cov' htmlcov/index.html | cut -d'>' -f 2 | cut -d'%' -f 1)
169-
if [[ ! -z $COV ]]; then
168+
if [[ ! -z $COV ]]; then
170169
if [[ $COV -lt 50 ]]; then COLOR=red; elif [[ $COV -lt 80 ]]; then COLOR=yellow; else COLOR=green; fi
171170
echo COV_BODY="$COV_BODY_INTRO ![Coverage-$COV%](https://img.shields.io/badge/coverage-$COV%25-$COLOR)" >> $GITHUB_ENV
172171
fi
@@ -176,23 +175,23 @@ jobs:
176175
run: |
177176
set -x # print commands that are executed
178177
179-
# Prepare default diff body text
178+
# Prepare default diff body text
180179
DIFF_BODY_INTRO="📌 Cov diff with **${{ env.COMPARE_BRANCH }}**:\n\n"
181180
echo DIFF_BODY="$DIFF_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
182181
183182
# Prepare file paths to coverage xml files
184183
# Filenames taken from job.test last step with name - "Save coverage files"
185-
FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
184+
FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
186185
FILE2="cov-reports-model/coverage.xml"; [[ ! -f $FILE2 ]] && FILE2=""
187186
echo "FILE1=$FILE1" >> $GITHUB_ENV
188187
echo "FILE2=$FILE2" >> $GITHUB_ENV
189188
190189
# Calculate coverage diff and update body message
191190
pip install diff_cover
192-
diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
191+
diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
193192
DIFF=$(diff-cover $FILE1 $FILE2 \
194193
--compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep Coverage: | cut -d' ' -f 2 | cut -d'%' -f 1)
195-
if [[ -z $DIFF ]]; then
194+
if [[ -z $DIFF ]]; then
196195
DIFF_INFO=$(diff-cover $FILE1 $FILE2 \
197196
--compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep "No lines");
198197
echo DIFF_BODY="$DIFF_BODY_INTRO $DIFF_INFO">> $GITHUB_ENV

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
include LICENSE.txt
22
include THIRD_PARTY_LICENSES.txt
3-
include ads/ads_version.json
43
include ads/common/*.json
54
include ads/feature_engineering/*.json
65
include ads/templates/*.jinja2
@@ -15,6 +14,7 @@ include ads/opctl/conda/manifest_template.yaml
1514
include ads/opctl/conda/config.yaml
1615
include ads/opctl/config/diagnostics/**/*.yaml
1716
include ads/opctl/templates/*.jinja2
17+
include pyproject.toml
1818
global-exclude tests/**
1919
global-exclude notebooks/**
2020
exclude tests/**
@@ -23,4 +23,4 @@ exclude build/lib/tests/**
2323
exclude build/lib/notebooks/**
2424
exclude benchmark/**
2525
include ads/ads
26-
include ads/model/common/*.*
26+
include ads/model/common/*.*

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ RELEASE_BRANCH := release/ads
22
DOCS_RELEASE_BRANCH := release
33
CLONE_DIR := /tmp/advanced-ds
44
DOCS_CLONE_DIR := /tmp/ads-docs
5-
COPY_INVENTORY := setup.py CONTRIBUTING.md LICENSE.txt MANIFEST.in README-development.md README.md SECURITY.md THIRD_PARTY_LICENSES.txt
5+
COPY_INVENTORY := CONTRIBUTING.md LICENSE.txt MANIFEST.in README-development.md README.md SECURITY.md THIRD_PARTY_LICENSES.txt
66

77
prepare-release-branch: clean
88
@git checkout master
@@ -13,31 +13,32 @@ prepare-release-branch: clean
1313
prepare-ads:
1414
@echo "Started advanced-ds clone at $$(date)"
1515
@git clone ssh://git@bitbucket.oci.oraclecorp.com:7999/odsc/advanced-ds.git --branch $(RELEASE_BRANCH) --depth 1 $(CLONE_DIR)
16-
@echo "Finished cloning at $$(date)"
16+
@echo "Finished cloning at $$(date)"
1717
cp -r $(CLONE_DIR)/ads .
1818
$(foreach var,$(COPY_INVENTORY),cp $(CLONE_DIR)/$(var) .;)
1919

20-
prepare-docs:
20+
prepare-docs:
2121
@echo "Started ads_docs clone at $$(date)"
2222
@git clone ssh://git@bitbucket.oci.oraclecorp.com:7999/odsc/ads_docs.git --branch $(DOCS_RELEASE_BRANCH) --depth 1 $(DOCS_CLONE_DIR)
23-
@echo "Finished cloning at $$(date)"
23+
@echo "Finished cloning at $$(date)"
2424
cp -r $(DOCS_CLONE_DIR)/source docs/ && cp $(DOCS_CLONE_DIR)/requirements.txt docs
2525

2626
prepare: prepare-release-branch prepare-ads prepare-docs
2727

2828
push: clean
29-
@bash -c 'if [[ $$(git branch | grep \*) == "* release/$(RELEASE_VERSION)" ]];then echo "Version matching current branch"; else echo "Set proper value to RELEASE_VERSION";exit 1 ; fi'
29+
@bash -c 'if [[ $$(git branch | grep \*) == "* release/$(RELEASE_VERSION)" ]];then echo "Version matching current branch"; else echo "Set proper value to RELEASE_VERSION";exit 1 ; fi'
3030
@git add .
3131
@git commit -m "Release version: $(RELEASE_VERSION)"
3232
@git push --set-upstream origin release/$(RELEASE_VERSION)
3333

3434
dist: clean
35-
@python3 setup.py sdist bdist_wheel
35+
@python3 -m build
3636

3737
publish: dist
3838
@twine upload dist/*
3939

4040
clean:
41+
@echo "Cleaning - removing dist, *.pyc, Thumbs.db and other files"
4142
@rm -rf dist build oracle_ads.egg-info
4243
@find ./ -name '*.pyc' -exec rm -f {} \;
4344
@find ./ -name 'Thumbs.db' -exec rm -f {} \;

README-development.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Open the destination folder where you want to clone ADS library, and install dep
5858
python3 -m pip install -e .
5959
```
6060

61-
To which packages were installed and their version numbers, run:
61+
To view which packages were installed and their version numbers, run:
6262

6363
```bash
6464
python3 -m pip freeze
@@ -71,10 +71,11 @@ You should also set up configuration files, see the [SDK and CLI Configuration F
7171

7272
### Step 5: Versioning and generation the wheel
7373

74-
Use `ads_version.json` for versioning. The ADS SDK is packaged as a wheel. To generate the wheel, you can run:
74+
Bump the versions in `pyproject.toml`. The ADS SDK using [build](https://pypa-build.readthedocs.io/en/stable/index.html) as build frontend. To generate sdist and wheel, you can run:
7575

7676
```bash
77-
python3 setup.py sdist bdist_wheel
77+
pip install build
78+
python3 -m build
7879
```
7980

8081
This wheel can then be installed using `pip`.
@@ -85,7 +86,7 @@ The SDK uses pytest as its test framework.
8586

8687
### Running default setup tests
8788

88-
Default setup tests for testing ADS SDK without extra dependencies, specified in setup.py.
89+
Default setup tests for testing ADS SDK without extra dependencies, specified in `pyproject.toml` in `[project.optional-dependencies]`.
8990

9091
```bash
9192
# Update your environment with tests dependencies

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ You have various options when installing ADS.
2929

3030
### Installing extras libraries
3131

32-
The `all-optional` module will install all optional dependencies. Note the single quotes around installation of extra libraries.
33-
34-
```bash
35-
python3 -m pip install 'oracle-ads[all-optional]'
36-
```
37-
3832
To work with gradient boosting models, install the `boosted` module. This module includes XGBoost and LightGBM model classes.
3933

4034
```bash
@@ -107,6 +101,8 @@ Install the `viz` module to include libraries for visualization tasks. Some of t
107101
python3 -m pip install 'oracle-ads[viz]'
108102
```
109103

104+
See `pyproject.toml` file `[project.optional-dependencies]` section for full list of modules and its list of extra libraries.
105+
110106
**Note**
111107

112108
Multiple extra dependencies can be installed together. For example:

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ security features are welcome on GitHub Issues.
2121

2222
Security updates will be released on a regular cadence. Many of our projects
2323
will typically release security fixes in conjunction with the
24-
[Oracle Critical Patch Update][3] program. Additional
24+
Oracle Critical Patch Update program. Additional
2525
information, including past advisories, is available on our [security alerts][4]
2626
page.
2727

ads/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66

77
from __future__ import print_function, division, absolute_import
88
import os
9+
import sys
910
import logging
1011
import json
1112
from typing import Callable, Dict, Optional, Union
1213

13-
__version__ = ""
14-
with open(
15-
os.path.join(os.path.dirname(os.path.abspath(__file__)), "ads_version.json")
16-
) as version_file:
17-
__version__ = json.load(version_file)["version"]
14+
# https://packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-package-version
15+
if sys.version_info >= (3, 8):
16+
from importlib import metadata
17+
else:
18+
import importlib_metadata as metadata
19+
20+
__version__ = metadata.version("oracle_ads")
1821
import oci
1922

2023
import matplotlib.font_manager # causes matplotlib to regenerate its fonts
@@ -138,7 +141,8 @@ def hello():
138141
oci v{oci.__version__}
139142
ocifs v{ocifs.__version__}
140143
141-
""")
144+
"""
145+
)
142146

143147

144148
configure_plotting()

0 commit comments

Comments
 (0)