Skip to content

Commit e84b4e8

Browse files
Merge pull request #164 from scikit-learn-contrib/fix/quickstart
update README; conftest for rst; workflow build docs; logging
2 parents a065ea7 + 0f8bf0a commit e84b4e8

38 files changed

+1386
-5423
lines changed

.coveragerc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,53 @@
1-
name: Unit tests
1+
name: Unit tests and docs generation
22

33
on:
44
push:
55
branches:
66
- "**"
77
pull_request:
8+
branches:
9+
- "**"
810
types: [opened, synchronize, reopened, ready_for_review]
911
workflow_dispatch:
1012

1113
jobs:
1214
check:
1315
if: github.event.pull_request.draft == false
14-
runs-on: ${{matrix.os}}
16+
runs-on: ${{ matrix.os }}
1517
strategy:
1618
matrix:
1719
os: [ubuntu-latest, windows-latest]
18-
python-version: ['3.8', '3.9', '3.10', '3.11']
20+
python-version: ["3.9", "3.11", "3.12"]
1921
defaults:
2022
run:
2123
shell: bash -l {0}
2224

2325
steps:
26+
- name: Set OS and Python version
27+
id: set-vars
28+
run: |
29+
if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/dev" ]]; then
30+
echo "os-matrix=ubuntu-latest,windows-latest" >> $GITHUB_ENV
31+
echo "python-matrix=3.9,3.11,3.12" >> $GITHUB_ENV
32+
else
33+
echo "os-matrix=ubuntu-latest" >> $GITHUB_ENV
34+
echo "python-matrix=3.12" >> $GITHUB_ENV
35+
fi
2436
- name: Checkout
2537
uses: actions/checkout@v3
2638
- name: Python
2739
uses: actions/setup-python@v4
2840
with:
2941
python-version: ${{ matrix.python-version }}
42+
- name: Cache Poetry
43+
uses: actions/cache@v3
44+
with:
45+
path: |
46+
~/.cache/pypoetry
47+
~/.cache/pip
48+
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
49+
restore-keys: |
50+
${{ runner.os }}-poetry-${{ matrix.python-version }}-
3051
- name: Poetry
3152
uses: snok/install-poetry@v1
3253
with:
@@ -41,3 +62,12 @@ jobs:
4162
uses: codecov/codecov-action@v3
4263
env:
4364
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
65+
- name: Check Changed Files
66+
id: changed-files
67+
run: |
68+
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} --depth=1
69+
git diff --name-only ${{ github.base_ref }} > changed_files.txt
70+
- name: Build Docs
71+
if: contains(fromJSON('["docs/", ".rst"]').join(','), fromJSON('["${{ steps.changed-files.outputs.files }}"]').join(','))
72+
run: |
73+
poetry run sphinx-build -b html docs/ _build/html

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var/
2828
*.egg-info/
2929
.installed.cfg
3030
*.egg
31+
poetry.lock
3132

3233
# PyInstaller
3334
# Usually these files are written by a python script from a template

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
env_qolmat_3.9

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,13 @@ With just these few lines of code, you can see how easy it is to
7070
from qolmat.utils import data
7171
7272
# load and prepare csv data
73-
7473
df_data = data.get_data("Beijing")
7574
columns = ["TEMP", "PRES", "WSPM"]
7675
df_data = df_data[columns]
7776
df_with_nan = data.add_holes(df_data, ratio_masked=0.2, mean_size=120)
7877
7978
# impute and compare
80-
imputer_mean = imputers.ImputerMean(groups=("station",))
79+
imputer_mean = imputers.ImputerSimple(strategy="mean", groups=("station",))
8180
imputer_interpol = imputers.ImputerInterpolation(method="linear", groups=("station",))
8281
imputer_var1 = imputers.ImputerEM(model="VAR", groups=("station",), method="mle", max_iter_em=50, n_iter_ou=15, dt=1e-3, p=1)
8382
dict_imputers = {
@@ -90,7 +89,7 @@ With just these few lines of code, you can see how easy it is to
9089
dict_imputers,
9190
columns,
9291
generator_holes = generator_holes,
93-
metrics = ["mae", "wmape", "KL_columnwise", "ks_test", "energy"],
92+
metrics = ["mae", "wmape", "kl_columnwise", "ks_test", "energy"],
9493
)
9594
results = comparison.compare(df_with_nan)
9695
results.style.highlight_min(color="lightsteelblue", axis=1)

docs/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ clean:
3737
-rm -rf examples/tutorials/*
3838
-rm -rf generated/*
3939

40+
doctest:
41+
$(SPHINXBUILD) -b doctest . _build/doctest
42+
4043
html:
4144
# These two lines make the build a bit more lengthy, and the
4245
# the embedding of images more robust

docs/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@
159159
"reference_url": {"qolmat": None},
160160
}
161161

162+
suppress_warnings = ["autosectionlabel.*"]
163+
164+
# doctest configuration
165+
doctest_test_doctest_blocks = "default"
166+
162167
html_css_files = [
163168
"custom.css",
164169
]

docs/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
.. toctree::
2323
:maxdepth: 2
2424
:hidden:
25-
:caption: API
25+
:caption: ANALYSIS
2626

27-
api
27+
analysis
28+
examples/tutorials/plot_tuto_mcar
2829

2930
.. toctree::
3031
:maxdepth: 2
3132
:hidden:
32-
:caption: ANALYSIS
33+
:caption: API
3334

34-
analysis
35-
examples/tutorials/plot_tuto_mcar
35+
api

0 commit comments

Comments
 (0)