Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fe411a7
ImputerRpcaPcp and ImputerRpcaNoisy patched
Jul 8, 2024
d2d985d
Merge pull request #154 from scikit-learn-contrib/rpca_patch
JulienRoussel77 Aug 1, 2024
ab79496
:construction: Creation of the pyproject.toml file. Remove the setup.…
adriencrtrcap Aug 2, 2024
cf35fde
check ruff
Sep 5, 2024
fb3d785
Merge branch 'dev' into from-conda-to-poetry
Sep 5, 2024
99c93a8
enable_iterative_imputer
Sep 5, 2024
e54d1a9
move torch from extra to dependencies
Sep 5, 2024
1dbdfd9
delete test_quick from workflow and rename job check
Sep 5, 2024
3a320f7
remove unused file and modify .rst for poetry installation
Sep 6, 2024
4b3de91
Merge pull request #158 from scikit-learn-contrib/from-conda-to-poetry
hlbotterman Sep 6, 2024
f2307da
:rocket: PKLM implementation with ruff
adriencrtrcap Sep 26, 2024
290939e
:pencil2: Fix typo
adriencrtrcap Sep 26, 2024
662aa64
Correct doc and Readme.rst and Fix typing errors
adriencrtrcap Sep 26, 2024
c44f7b4
Remove the exact p-value compute
adriencrtrcap Sep 26, 2024
47d0454
Try to fix error
adriencrtrcap Sep 26, 2024
df10acb
Try to fix the "matrix" error
adriencrtrcap Sep 26, 2024
5634451
review docstring
Sep 27, 2024
14e1490
ruff ignore D203 and D213 to avoid of conflicts.
Sep 30, 2024
a065ea7
Merge pull request #161 from scikit-learn-contrib/pklm
hlbotterman Oct 2, 2024
3b84514
update README; conftest for rst; workflow build docs; logging
Oct 7, 2024
d2b157a
UTF-8 encoding
Oct 7, 2024
b830874
execute code in rst files and improve unique workflow for unit tests …
Oct 8, 2024
f2b350a
fix syntax GitHub Actions
Oct 8, 2024
7c16a80
fix syntax GitHub Actions
Oct 8, 2024
509aa86
python-version in matrix
Oct 8, 2024
ead88c2
fix ambiguous argument 'origin/':
Oct 8, 2024
dce6883
fix reference for get diff
Oct 8, 2024
c145710
multiple OS and remove redundant conditions
Oct 9, 2024
bc9b4c8
set mypy and pytest in .toml
hlbotterman Oct 14, 2024
bb30c0a
poetry option name patched
May 5, 2025
3cde1b4
poetry lock removed
May 5, 2025
ef683c8
comparator holes are now identical for all imputers
May 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

9 changes: 0 additions & 9 deletions .flake8

This file was deleted.

23 changes: 13 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Publish Package on PYPI
name: Publish Package on PyPI

on:
release:
types: [published]


jobs:
deploy:

runs-on: ubuntu-latest

steps:
Expand All @@ -16,14 +14,19 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
poetry install
- name: Build package
run: python setup.py sdist bdist_wheel
run: |
poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish
101 changes: 79 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,102 @@
name: Unit tests
name: Unit tests and docs generation

on:
push:
branches:
-dev
-main
- "**"
pull_request:
branches:
- "**"
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:

jobs:
build-linux:
check:
if: github.event.pull_request.draft == false
runs-on: ${{matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
shell: bash -l {0}

steps:
- name: Git clone
- name: Set OS and Python version
id: set-vars
run: |
if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/dev" ]]; then
echo "os-matrix=ubuntu-latest,windows-latest" >> $GITHUB_ENV
echo "python-matrix=3.8,3.9,3.10,3.11" >> $GITHUB_ENV
else
echo "os-matrix=ubuntu-latest" >> $GITHUB_ENV
echo "python-matrix=3.11" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v3
- name: Set up venv for ci
uses: conda-incubator/setup-miniconda@v2
- name: Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
environment-file: environment.ci.yml
- name: Lint with flake8
run: |
flake8
- name: Test with pytest
run: |
make coverage
- name: typing with mypy
run: |
mypy qolmat
echo you should uncomment mypy qolmat and delete this line
- name: Upload coverage reports to Codecov
python-version: ${{ matrix.python-version }}
- name: Cache Poetry
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry
~/.cache/pip
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python-version }}-
- name: Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
- name: Lock
run: poetry lock --no-update
- name: Install
run: poetry install
- name: Checkers
run: make checkers
- name: Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

docs:
runs-on: ubuntu-latest
needs: check

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache Poetry
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry
~/.cache/pip
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python-version }}-
- name: Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
- name: Lock
run: poetry lock --no-update
- name: Install
run: poetry install
- name: Check Changed Files
id: changed-files
run: |
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} --depth=1
git diff --name-only ${{ github.base_ref }} > changed_files.txt
- name: Build Docs
if: contains(fromJSON('["docs/", ".rst"]').join(','), fromJSON('["${{ steps.changed-files.outputs.files }}"]').join(','))
run: |
poetry run sphinx-build -b html docs/ _build/html
68 changes: 0 additions & 68 deletions .github/workflows/test_quick.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
poetry.lock

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
20 changes: 4 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,8 @@ repos:
exclude: (docs/)
- id: trailing-whitespace
exclude: (docs/)
- repo: https://github.com/psf/black
rev: 22.8.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: black
args:
- "-l 99"
# Flake8
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
args: [--ignore-missing-imports]
additional_dependencies: [types-requests]
- id: ruff
- id: ruff-format
17 changes: 7 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ You can create a virtual environment via `conda`:

.. code:: sh

$ conda env create -f environment.dev.yml
$ conda activate env_qolmat_dev

If you need to use pytorch, enter the command:

.. code:: sh

$ pip install -e .[pytorch]
$ pip install poetry
$ poetry config virtualenvs.in-project true
$ poetry lock
$ poetry install
$ poetry shell

Once the environment is installed, pre-commit is installed, but need to be activated using the following command:

Expand Down Expand Up @@ -78,7 +75,7 @@ These tests absolutely have to pass.

.. code:: sh

$ mypy qolmat
$ make check-types

Unit test
^^^^^^^^^
Expand All @@ -88,4 +85,4 @@ The coverage should on new features must be above 95%.

.. code:: sh

$ pytest -vs --cov-branch --cov=qolmat --pyargs tests --cov-report term-missing
$ make check-coverage
33 changes: 27 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
coverage:
pytest --cov-branch --cov=qolmat --cov-report=xml tests

doctest:
pytest --doctest-modules --pyargs qolmat
check-coverage:
poetry run pytest --cov-branch --cov=qolmat/ --cov-report=xml tests/

doc:
make html -C docs
check-poetry:
poetry check --lock

check-quality:
poetry run ruff check qolmat/ tests/

check-security:
poetry run bandit --recursive --configfile=pyproject.toml qolmat/

check-tests:
poetry run pytest tests/

check-types:
poetry run mypy qolmat/ tests/

checkers: check-coverage check-types

clean:
rm -rf .mypy_cache .pytest_cache .coverage*
rm -rf **__pycache__
make clean -C docs

coverage:
poetry run pytest --cov-branch --cov=qolmat --cov-report=xml tests

doc:
make html -C docs

doctest:
poetry run pytest --doctest-modules --pyargs qolmat
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ With just these few lines of code, you can see how easy it is to
from qolmat.utils import data

# load and prepare csv data

df_data = data.get_data("Beijing")
columns = ["TEMP", "PRES", "WSPM"]
df_data = df_data[columns]
df_with_nan = data.add_holes(df_data, ratio_masked=0.2, mean_size=120)

# impute and compare
imputer_mean = imputers.ImputerMean(groups=("station",))
imputer_mean = imputers.ImputerSimple(strategy="mean", groups=("station",))
imputer_interpol = imputers.ImputerInterpolation(method="linear", groups=("station",))
imputer_var1 = imputers.ImputerEM(model="VAR", groups=("station",), method="mle", max_iter_em=50, n_iter_ou=15, dt=1e-3, p=1)
dict_imputers = {
Expand All @@ -90,7 +89,7 @@ With just these few lines of code, you can see how easy it is to
dict_imputers,
columns,
generator_holes = generator_holes,
metrics = ["mae", "wmape", "KL_columnwise", "ks_test", "energy"],
metrics = ["mae", "wmape", "kl_columnwise", "ks_test", "energy"],
)
results = comparison.compare(df_with_nan)
results.style.highlight_min(color="lightsteelblue", axis=1)
Expand Down
3 changes: 3 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ clean:
-rm -rf examples/tutorials/*
-rm -rf generated/*

doctest:
$(SPHINXBUILD) -b doctest . _build/doctest

html:
# These two lines make the build a bit more lengthy, and the
# the embedding of images more robust
Expand Down
Loading
Loading