Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0a80fa0
ENH: add the theoretical risk control validation notebook in the CI.
hmaissoro Oct 31, 2025
c74e1af
commande "make notebook-tests"
hmaissoro Oct 31, 2025
563708e
ajoute de commande
hmaissoro Oct 31, 2025
598f1db
Add command in CI pipeline
hmaissoro Oct 31, 2025
6425d3f
make pytest to skip notebooks
hmaissoro Oct 31, 2025
cd6fa26
nbformat already installed with nbclient
hmaissoro Oct 31, 2025
66cd8b5
install nbclient in CI
hmaissoro Oct 31, 2025
7126095
need jupyter
hmaissoro Oct 31, 2025
6316c6a
register kernel
hmaissoro Oct 31, 2025
32ae623
handle exit(0)
hmaissoro Oct 31, 2025
b813453
ignore notebooks when checking coverage
hmaissoro Oct 31, 2025
5fa669e
fix coverage
hmaissoro Oct 31, 2025
88cad8a
fix coverage
hmaissoro Oct 31, 2025
47469ed
fix coverage
hmaissoro Oct 31, 2025
bbf47ad
fix make coverage
hmaissoro Oct 31, 2025
55ab3fe
fix
hmaissoro Oct 31, 2025
ec091ca
debug
hmaissoro Nov 3, 2025
4216d1b
debug coverage
hmaissoro Nov 3, 2025
0e19c86
no coverage of _run_notebooks.py
hmaissoro Nov 3, 2025
a675814
format ruff
hmaissoro Nov 3, 2025
70645de
Increase timeout
hmaissoro Nov 3, 2025
85da595
stop at first error
hmaissoro Nov 3, 2025
dbc6528
test CI
hmaissoro Nov 3, 2025
45d5b13
remove check CI
hmaissoro Nov 3, 2025
e560ea1
rreorganise and clean
hmaissoro Nov 3, 2025
ea3696d
test import in envronment.ci.yml
hmaissoro Nov 3, 2025
615f7c3
test no kernel registering
hmaissoro Nov 3, 2025
f6e3629
update tests nb val theorique
hmaissoro Nov 3, 2025
cbcaba6
mise à jour des tests
hmaissoro Nov 4, 2025
cebde88
add test with logisitc classifier
hmaissoro Nov 4, 2025
97a6de3
assert all good
hmaissoro Nov 4, 2025
2221004
increase timeout
hmaissoro Nov 4, 2025
47bfcd9
reduce iteration
hmaissoro Nov 4, 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: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@ jobs:
run: make type-check
- name: Test and coverage with pytest
run: make coverage
- name: Test notebooks
run: make notebook-tests
- name: Code coverage
run: codecov
7 changes: 7 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ The coverage should absolutely be 100%.

$ make coverage

If your modification affects notebook-based experiments in ``mapie/tests/notebooks/``,
you should also ensure that all notebooks run successfully.

.. code-block:: sh

$ make notebook-tests

Documenting your change
-----------------------

Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ coverage:
--no-cov-on-fail \
--doctest-modules


### Checks that are run in ReadTheDocs CI ###
doc:
$(MAKE) html -C doc
Expand All @@ -39,7 +38,7 @@ all-checks:
$(MAKE) coverage

tests:
pytest -vs --doctest-modules mapie
pytest -vs --doctest-modules mapie --ignore=mapie/tests/notebooks

clean-doc:
$(MAKE) clean -C doc
Expand All @@ -55,3 +54,8 @@ clean:
rm -rf **__pycache__
$(MAKE) clean-build
$(MAKE) clean-doc

# Run all notebooks located in mapie/tests/notebooks/
notebook-tests:
@echo "Executing all notebooks in mapie/tests/notebooks/..."
python mapie/tests/notebooks/_run_notebooks.py
2 changes: 2 additions & 0 deletions environment.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ dependencies:
- mypy<1.15
- pandas
- pytest-cov
- jupyter
- nbclient
Empty file.
24 changes: 24 additions & 0 deletions mapie/tests/notebooks/_run_notebooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# pragma: no cover
import sys
from pathlib import Path

from nbclient import NotebookClient
from nbformat import read

NOTEBOOKS_DIR = Path(__file__).parent
notebooks = NOTEBOOKS_DIR.rglob("*.ipynb")

if __name__ == "__main__": # pragma: no cover
for nb_path in notebooks:
print(f"Running {nb_path} ...")
try:
with nb_path.open() as f:
nb = read(f, as_version=4)
client = NotebookClient(nb, timeout=300)
client.execute()
except Exception as e:
print(f"Notebook {nb_path} failed:\n{e}")
sys.exit(1)

print("\nAll notebooks executed successfully. 100% OK.\n")
sys.exit(0)
3 changes: 2 additions & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ pytest
pytest-cov
scikit-learn
twine
wheel
wheel
nbclient
Loading