Skip to content

Commit 9045a8b

Browse files
Merge pull request #172 from scikit-learn-contrib/feature/holes_reproduction
Feature/holes reproduction
2 parents f94aafd + be61d64 commit 9045a8b

Some content is hidden

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

76 files changed

+5946
-2590
lines changed

.coveragerc

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

.flake8

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

.github/workflows/publish.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
name: Publish Package on PYPI
1+
name: Publish Package on PyPI
22

33
on:
44
release:
55
types: [published]
66

7-
87
jobs:
98
deploy:
10-
119
runs-on: ubuntu-latest
1210

1311
steps:
@@ -16,14 +14,19 @@ jobs:
1614
uses: actions/setup-python@v4
1715
with:
1816
python-version: '3.10'
17+
- name: Install Poetry
18+
run: |
19+
curl -sSL https://install.python-poetry.org | python3 -
20+
echo "$HOME/.local/bin" >> $GITHUB_PATH
1921
- name: Install dependencies
2022
run: |
21-
python -m pip install --upgrade pip
22-
pip install setuptools wheel twine
23+
poetry install
2324
- name: Build package
24-
run: python setup.py sdist bdist_wheel
25+
run: |
26+
poetry build
2527
- name: Publish package
26-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
27-
with:
28-
user: __token__
29-
password: ${{ secrets.PYPI_API_TOKEN }}
28+
env:
29+
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
30+
run: |
31+
poetry config pypi-token.pypi $PYPI_TOKEN
32+
poetry publish

.github/workflows/test.yml

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,73 @@
1-
name: Unit tests
1+
name: Unit tests and docs generation
22

33
on:
44
push:
55
branches:
6-
-dev
7-
-main
6+
- "**"
87
pull_request:
8+
branches:
9+
- "**"
910
types: [opened, synchronize, reopened, ready_for_review]
1011
workflow_dispatch:
1112

1213
jobs:
13-
build-linux:
14+
check:
1415
if: github.event.pull_request.draft == false
15-
runs-on: ${{matrix.os}}
16+
runs-on: ${{ matrix.os }}
1617
strategy:
1718
matrix:
1819
os: [ubuntu-latest, windows-latest]
19-
python-version: ['3.8', '3.9', '3.10', '3.11']
20+
python-version: ["3.9", "3.11", "3.12"]
2021
defaults:
2122
run:
2223
shell: bash -l {0}
2324

2425
steps:
25-
- name: Git clone
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
36+
- name: Checkout
2637
uses: actions/checkout@v3
27-
- name: Set up venv for ci
28-
uses: conda-incubator/setup-miniconda@v2
38+
- name: Python
39+
uses: actions/setup-python@v4
2940
with:
30-
python-version: ${{matrix.python-version}}
31-
environment-file: environment.ci.yml
32-
- name: Lint with flake8
33-
run: |
34-
flake8
35-
- name: Test with pytest
36-
run: |
37-
make coverage
38-
- name: typing with mypy
39-
run: |
40-
mypy qolmat
41-
echo you should uncomment mypy qolmat and delete this line
42-
- name: Upload coverage reports to Codecov
41+
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 }}-
51+
- name: Poetry
52+
uses: snok/install-poetry@v1
53+
with:
54+
version: 1.8.3
55+
- name: Lock
56+
run: poetry lock --no-update
57+
- name: Install
58+
run: poetry install
59+
- name: Checkers
60+
run: make checkers
61+
- name: Codecov
4362
uses: codecov/codecov-action@v3
4463
env:
4564
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

.github/workflows/test_quick.yml

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

.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

.pre-commit-config.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,8 @@ repos:
88
exclude: (docs/)
99
- id: trailing-whitespace
1010
exclude: (docs/)
11-
- repo: https://github.com/psf/black
12-
rev: 22.8.0
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.3.3
1313
hooks:
14-
- id: black
15-
args:
16-
- "-l 99"
17-
# Flake8
18-
- repo: https://github.com/PyCQA/flake8
19-
rev: 4.0.1
20-
hooks:
21-
- id: flake8
22-
- repo: https://github.com/pre-commit/mirrors-mypy
23-
rev: v1.1.1
24-
hooks:
25-
- id: mypy
26-
args: [--ignore-missing-imports]
27-
additional_dependencies: [types-requests]
14+
- id: ruff
15+
- id: ruff-format

.python-version

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

CONTRIBUTING.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,11 @@ You can create a virtual environment via `conda`:
2929

3030
.. code:: sh
3131
32-
$ conda env create -f environment.dev.yml
33-
$ conda activate env_qolmat_dev
34-
35-
If you need to use pytorch, enter the command:
36-
37-
.. code:: sh
38-
39-
$ pip install -e .[pytorch]
32+
$ pip install poetry
33+
$ poetry config virtualenvs.in-project true
34+
$ poetry lock
35+
$ poetry install
36+
$ poetry shell
4037
4138
Once the environment is installed, pre-commit is installed, but need to be activated using the following command:
4239

@@ -78,7 +75,7 @@ These tests absolutely have to pass.
7875

7976
.. code:: sh
8077
81-
$ mypy qolmat
78+
$ make check-types
8279
8380
Unit test
8481
^^^^^^^^^
@@ -88,4 +85,4 @@ The coverage should on new features must be above 95%.
8885

8986
.. code:: sh
9087
91-
$ pytest -vs --cov-branch --cov=qolmat --pyargs tests --cov-report term-missing
88+
$ make check-coverage

Makefile

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1-
coverage:
2-
pytest --cov-branch --cov=qolmat --cov-report=xml tests
31

4-
doctest:
5-
pytest --doctest-modules --pyargs qolmat
2+
check-coverage:
3+
poetry run pytest --cov-branch --cov=qolmat/ --cov-report=xml tests/
64

7-
doc:
8-
make html -C docs
5+
check-poetry:
6+
poetry check --lock
7+
8+
check-quality:
9+
poetry run ruff check qolmat/ tests/
10+
11+
check-security:
12+
poetry run bandit --recursive --configfile=pyproject.toml qolmat/
13+
14+
check-tests:
15+
poetry run pytest tests/
16+
17+
check-types:
18+
poetry run mypy qolmat/ tests/
19+
20+
checkers: check-coverage check-types
921

1022
clean:
1123
rm -rf .mypy_cache .pytest_cache .coverage*
1224
rm -rf **__pycache__
1325
make clean -C docs
26+
27+
coverage:
28+
poetry run pytest --cov-branch --cov=qolmat --cov-report=xml tests
29+
30+
doc:
31+
make html -C docs
32+
33+
doctest:
34+
poetry run pytest --doctest-modules --pyargs qolmat

0 commit comments

Comments
 (0)