From 3830c2563ca2f76de8620f2fe5f9d6ea365cd769 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 10:53:52 +0100 Subject: [PATCH 01/34] chore(CI): Coverage report as a PR comment --- .github/workflows/ci.yml | 1 + .github/workflows/skore.yml | 8 +++++++- .gitignore | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a53f96c..e3db1d26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,7 @@ jobs: uses: ./.github/workflows/skore.yml permissions: contents: read + pull-requests: write lint-and-test-skore-ui: needs: [lint-all-files, changes] diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 1b5ad897..485b31ce 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -65,9 +65,15 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - python -m pytest src/ tests/ + python -m pytest --cov-report=xml src/ tests/ | tee pytest-coverage.txt env: PYTHONUTF8: 1 + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-xml-coverage-path: ./skore/coverage.xml + report-only-changed-files: true + title: pytest coverage report cleanup: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 5dd9dbce..569abcfb 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ coverage.xml .hypothesis/ .pytest_cache/ cover/ +pytest-coverage.txt # Translations *.mo From 3bacba093b44ae1a91c5dbd51a1c9a4ce510eb4b Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 12:17:09 +0100 Subject: [PATCH 02/34] wip --- skore/src/skore/ui/project_routes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skore/src/skore/ui/project_routes.py b/skore/src/skore/ui/project_routes.py index 39f2f800..ddd43c20 100644 --- a/skore/src/skore/ui/project_routes.py +++ b/skore/src/skore/ui/project_routes.py @@ -4,6 +4,7 @@ from collections import defaultdict from dataclasses import dataclass from typing import Any +from venv import logger from fastapi import APIRouter, HTTPException, Request, status @@ -122,4 +123,7 @@ async def delete_view(request: Request, key: str): status_code=status.HTTP_404_NOT_FOUND, detail="View not found" ) from None + if True: + logger.info(msg="yo") + return __serialize_project(project) From af3369b55d1d4f8dd6e74fd6bafe72b43dac5487 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 12:27:56 +0100 Subject: [PATCH 03/34] wip --- .github/workflows/skore.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 8e6ae83e..10364982 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -65,7 +65,8 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - python -m pytest --cov-report=xml src/ tests/ | tee pytest-coverage.txt + pytest --junitxml=coverage.xml --cov-report=term-missing:skip-covered --cov=src/ tests/ | tee pytest-coverage.txt + - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: From 47df56225ce9a8f6231757ff3b2783f1ad156077 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 12:33:34 +0100 Subject: [PATCH 04/34] wip --- .github/workflows/skore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 10364982..5b50b33b 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -70,7 +70,7 @@ jobs: - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: - pytest-xml-coverage-path: ./skore/coverage.xml + junitxml-path: ./skore/coverage.xml report-only-changed-files: true title: pytest coverage report From 73115575f3abee857ec7f98d856a4aa99e4c4db7 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 12:45:45 +0100 Subject: [PATCH 05/34] wip --- .github/workflows/skore.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 5b50b33b..21e7026a 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -71,6 +71,7 @@ jobs: uses: MishaKav/pytest-coverage-comment@main with: junitxml-path: ./skore/coverage.xml + pytest-coverage-path: ./skore/pytest-coverage.txt report-only-changed-files: true title: pytest coverage report From 518f90b7f7b3d17e6e6d7920100ab62d66ac6601 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 14:03:26 +0100 Subject: [PATCH 06/34] wip --- .github/workflows/skore.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 21e7026a..8dfc43b3 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -72,7 +72,6 @@ jobs: with: junitxml-path: ./skore/coverage.xml pytest-coverage-path: ./skore/pytest-coverage.txt - report-only-changed-files: true title: pytest coverage report cleanup: From 4acdb548dea4bf30330d16d3cc27ef9da9ed5670 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 14:17:40 +0100 Subject: [PATCH 07/34] wip --- .github/workflows/skore.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 8dfc43b3..649bd613 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -34,8 +34,8 @@ jobs: strategy: fail-fast: true matrix: - os: ['ubuntu-latest', 'windows-latest'] - python-version: ['3.9', '3.10', '3.11', '3.12'] + os: ['ubuntu-latest'] + python-version: ['3.9'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -65,13 +65,13 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - pytest --junitxml=coverage.xml --cov-report=term-missing:skip-covered --cov=src/ tests/ | tee pytest-coverage.txt + pytest --junitxml=coverage.xml --cov-report=term-missing:skip-covered src/ tests/ | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: - junitxml-path: ./skore/coverage.xml pytest-coverage-path: ./skore/pytest-coverage.txt + junitxml-path: ./skore/coverage.xml title: pytest coverage report cleanup: From 281ec97a79609dc6de045a5c4b3df8fd1a8a6267 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 14:56:01 +0100 Subject: [PATCH 08/34] wip --- .github/workflows/skore.yml | 2 +- skore/pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 649bd613..434b7846 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -65,7 +65,7 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - pytest --junitxml=coverage.xml --cov-report=term-missing:skip-covered src/ tests/ | tee pytest-coverage.txt + pytest --junitxml=coverage.xml --cov-report=term-missing:skip-covered | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main diff --git a/skore/pyproject.toml b/skore/pyproject.toml index 00c957b6..6a693fd1 100644 --- a/skore/pyproject.toml +++ b/skore/pyproject.toml @@ -110,6 +110,7 @@ addopts = [ "--ignore=doc", "--ignore=examples", "--ignore=notebooks", + "--ignore=hatch", ] [tool.ruff] From 34af7b9d67c4be8784ec3df8de75f6a4b2207456 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 15:11:34 +0100 Subject: [PATCH 09/34] wip --- .github/workflows/skore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 434b7846..cf6b490b 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -65,7 +65,7 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - pytest --junitxml=coverage.xml --cov-report=term-missing:skip-covered | tee pytest-coverage.txt + pytest --junitxml=coverage.xml | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main From 7302e5e30c436da79e09e3a828ca44a9396966e4 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 15:49:47 +0100 Subject: [PATCH 10/34] yet another attempt --- .github/workflows/skore.yml | 2 +- skore/pyproject.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index cf6b490b..7e8e3381 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -65,7 +65,7 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - pytest --junitxml=coverage.xml | tee pytest-coverage.txt + pytest --junitxml=coverage.xml -cov=skore src/ tests/ | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main diff --git a/skore/pyproject.toml b/skore/pyproject.toml index 6a693fd1..9cadd9a2 100644 --- a/skore/pyproject.toml +++ b/skore/pyproject.toml @@ -98,9 +98,9 @@ sphinx = [ [tool.pytest.ini_options] addopts = [ "--doctest-modules", - "--cov=src/", - "--cov=tests/", - "--cov-branch", + # "--cov=src/", + # "--cov=tests/", + # "--cov-branch", "--import-mode=importlib", "--no-header", "--verbosity=2", From 3a3648ac22423b82cc7913f2dbb26f1b38fc68d5 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 15:54:11 +0100 Subject: [PATCH 11/34] again --- .github/workflows/skore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 7e8e3381..bd3d5eca 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -65,7 +65,7 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - pytest --junitxml=coverage.xml -cov=skore src/ tests/ | tee pytest-coverage.txt + pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main From c72108717d77a22e3d7daf325ec53f1adeb7d2b0 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 16:00:51 +0100 Subject: [PATCH 12/34] reenable matrix --- .github/workflows/skore.yml | 4 ++-- skore/pyproject.toml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index bd3d5eca..3f51af17 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -34,8 +34,8 @@ jobs: strategy: fail-fast: true matrix: - os: ['ubuntu-latest'] - python-version: ['3.9'] + os: ['ubuntu-latest', 'windows-latest'] + python-version: ['3.9', '3.10', '3.11', '3.12'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/skore/pyproject.toml b/skore/pyproject.toml index 9cadd9a2..6a693fd1 100644 --- a/skore/pyproject.toml +++ b/skore/pyproject.toml @@ -98,9 +98,9 @@ sphinx = [ [tool.pytest.ini_options] addopts = [ "--doctest-modules", - # "--cov=src/", - # "--cov=tests/", - # "--cov-branch", + "--cov=src/", + "--cov=tests/", + "--cov-branch", "--import-mode=importlib", "--no-header", "--verbosity=2", From f3532b3e688d891a4f482a4b271b0ceae336b1dc Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 16:15:40 +0100 Subject: [PATCH 13/34] split --- .github/workflows/skore.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 3f51af17..409a1c31 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -65,8 +65,18 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt + pytest --no-cov src/ tests/ + skore-coverage: + runs-on: ubuntu-latest + defaults: + run: + shell: 'bash' + working-directory: './skore-ui' + steps: + - name: pytest coverage + run: | + pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: From 6b647f42917616b9746f14a6aaa3f5e0f6e76f98 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 16:20:36 +0100 Subject: [PATCH 14/34] wip --- .github/workflows/skore.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 409a1c31..16d565a5 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -7,14 +7,14 @@ jobs: runs-on: ubuntu-latest defaults: run: - shell: 'bash' - working-directory: './skore-ui' + shell: "bash" + working-directory: "./skore-ui" steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: '20' - cache: 'npm' + node-version: "20" + cache: "npm" cache-dependency-path: skore-ui/package-lock.json - shell: bash run: | @@ -29,20 +29,20 @@ jobs: needs: build-skore-ui defaults: run: - shell: 'bash' - working-directory: './skore' + shell: "bash" + working-directory: "./skore" strategy: fail-fast: true matrix: - os: ['ubuntu-latest', 'windows-latest'] - python-version: ['3.9', '3.10', '3.11', '3.12'] + os: ["ubuntu-latest", "windows-latest"] + python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: 'pip' + cache: "pip" - name: Download package distributions uses: actions/download-artifact@v4 with: @@ -68,11 +68,12 @@ jobs: pytest --no-cov src/ tests/ skore-coverage: + needs: test-skore runs-on: ubuntu-latest defaults: run: - shell: 'bash' - working-directory: './skore-ui' + shell: "bash" + working-directory: "./skore" steps: - name: pytest coverage run: | From 50719f34e4196248f68a161c45b607dfae450e10 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 16:57:15 +0100 Subject: [PATCH 15/34] wip --- .github/workflows/skore.yml | 137 ++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 67 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 16d565a5..b53a0a96 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -3,78 +3,81 @@ name: Reusable skore workflow on: [workflow_call] jobs: - build-skore-ui: - runs-on: ubuntu-latest - defaults: - run: - shell: "bash" - working-directory: "./skore-ui" - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "npm" - cache-dependency-path: skore-ui/package-lock.json - - shell: bash - run: | - npm install - npm run build - - uses: actions/upload-artifact@v4 - with: - name: skore-ui-package-distributions - path: skore-ui/dist + # build-skore-ui: + # runs-on: ubuntu-latest + # defaults: + # run: + # shell: "bash" + # working-directory: "./skore-ui" + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-node@v4 + # with: + # node-version: "20" + # cache: "npm" + # cache-dependency-path: skore-ui/package-lock.json + # - shell: bash + # run: | + # npm install + # npm run build + # - uses: actions/upload-artifact@v4 + # with: + # name: skore-ui-package-distributions + # path: skore-ui/dist - test-skore: - needs: build-skore-ui - defaults: - run: - shell: "bash" - working-directory: "./skore" - strategy: - fail-fast: true - matrix: - os: ["ubuntu-latest", "windows-latest"] - python-version: ["3.9", "3.10", "3.11", "3.12"] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" - - name: Download package distributions - uses: actions/download-artifact@v4 - with: - name: skore-ui-package-distributions - path: skore/src/skore/ui/static - - name: - timeout-minutes: 10 - run: | - python -m pip install --upgrade pip - python -m pip install --upgrade pre-commit - python -m pip install --upgrade build + # test-skore: + # needs: build-skore-ui + # defaults: + # run: + # shell: "bash" + # working-directory: "./skore" + # strategy: + # fail-fast: true + # matrix: + # os: ["ubuntu-latest", "windows-latest"] + # python-version: ["3.9", "3.10", "3.11", "3.12"] + # runs-on: ${{ matrix.os }} + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} + # cache: "pip" + # - name: Download package distributions + # uses: actions/download-artifact@v4 + # with: + # name: skore-ui-package-distributions + # path: skore/src/skore/ui/static + # - name: + # timeout-minutes: 10 + # run: | + # python -m pip install --upgrade pip + # python -m pip install --upgrade pre-commit + # python -m pip install --upgrade build - # Lint - pre-commit run --all-files ruff + # # Lint + # pre-commit run --all-files ruff - # Build - python -m build + # # Build + # python -m build - # Install - wheel=(dist/*.whl); python -m pip install "${wheel}[test]" + # # Install + # wheel=(dist/*.whl); python -m pip install "${wheel}[test]" - # Test - pytest --no-cov src/ tests/ + # # Test + # pytest --no-cov src/ tests/ skore-coverage: - needs: test-skore + # needs: test-skore runs-on: ubuntu-latest defaults: run: shell: "bash" working-directory: "./skore" steps: + - name: pwd + run: | + pwd - name: pytest coverage run: | pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt @@ -85,11 +88,11 @@ jobs: junitxml-path: ./skore/coverage.xml title: pytest coverage report - cleanup: - runs-on: ubuntu-latest - if: always() - needs: test-skore - steps: - - uses: geekyeggo/delete-artifact@v5 - with: - name: skore-ui-package-distributions + # cleanup: + # runs-on: ubuntu-latest + # if: always() + # needs: test-skore + # steps: + # - uses: geekyeggo/delete-artifact@v5 + # with: + # name: skore-ui-package-distributions From 24eeb1bfa19c1a6d5c9aaf11ab57679ca8f5c41d Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 17:11:14 +0100 Subject: [PATCH 16/34] wip --- .github/workflows/skore.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index b53a0a96..798a70d8 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -70,10 +70,6 @@ jobs: skore-coverage: # needs: test-skore runs-on: ubuntu-latest - defaults: - run: - shell: "bash" - working-directory: "./skore" steps: - name: pwd run: | From b13ad715b46ca202f26fa1e71051aece90f25bbb Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 17:17:30 +0100 Subject: [PATCH 17/34] wip --- .github/workflows/skore.yml | 5 +++++ .github/workflows/sphinx.yml | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 798a70d8..0991613a 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -2,6 +2,11 @@ name: Reusable skore workflow on: [workflow_call] +defaults: + run: + shell: "bash" + working-directory: "./skore" + jobs: # build-skore-ui: # runs-on: ubuntu-latest diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index b602fc87..7632169e 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -29,10 +29,10 @@ jobs: - uses: actions/checkout@v4 with: ssh-key: ${{ secrets.DEPLOY_KEY }} - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - cache: 'pip' - - uses: ./.github/actions/sphinx/build - - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - uses: ./.github/actions/sphinx/deploy + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.12' + # cache: 'pip' + # - uses: ./.github/actions/sphinx/build + # - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + # uses: ./.github/actions/sphinx/deploy From d94d494a210648115170b3cece6ea84183d9a2c1 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Thu, 21 Nov 2024 17:35:11 +0100 Subject: [PATCH 18/34] ?? --- .github/workflows/skore.yml | 141 ++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 71 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 0991613a..bb9a324e 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -2,79 +2,78 @@ name: Reusable skore workflow on: [workflow_call] -defaults: - run: - shell: "bash" - working-directory: "./skore" - jobs: - # build-skore-ui: - # runs-on: ubuntu-latest - # defaults: - # run: - # shell: "bash" - # working-directory: "./skore-ui" - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: "20" - # cache: "npm" - # cache-dependency-path: skore-ui/package-lock.json - # - shell: bash - # run: | - # npm install - # npm run build - # - uses: actions/upload-artifact@v4 - # with: - # name: skore-ui-package-distributions - # path: skore-ui/dist + build-skore-ui: + runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + working-directory: "./skore-ui" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + cache-dependency-path: skore-ui/package-lock.json + - shell: bash + run: | + npm install + npm run build + - uses: actions/upload-artifact@v4 + with: + name: skore-ui-package-distributions + path: skore-ui/dist - # test-skore: - # needs: build-skore-ui - # defaults: - # run: - # shell: "bash" - # working-directory: "./skore" - # strategy: - # fail-fast: true - # matrix: - # os: ["ubuntu-latest", "windows-latest"] - # python-version: ["3.9", "3.10", "3.11", "3.12"] - # runs-on: ${{ matrix.os }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python-version }} - # cache: "pip" - # - name: Download package distributions - # uses: actions/download-artifact@v4 - # with: - # name: skore-ui-package-distributions - # path: skore/src/skore/ui/static - # - name: - # timeout-minutes: 10 - # run: | - # python -m pip install --upgrade pip - # python -m pip install --upgrade pre-commit - # python -m pip install --upgrade build + test-skore: + needs: build-skore-ui + defaults: + run: + shell: "bash" + working-directory: "./skore" + strategy: + fail-fast: true + matrix: + os: ["ubuntu-latest", "windows-latest"] + python-version: ["3.9", "3.10", "3.11", "3.12"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + - name: Download package distributions + uses: actions/download-artifact@v4 + with: + name: skore-ui-package-distributions + path: skore/src/skore/ui/static + - name: + timeout-minutes: 10 + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade pre-commit + python -m pip install --upgrade build - # # Lint - # pre-commit run --all-files ruff + # Lint + pre-commit run --all-files ruff - # # Build - # python -m build + # Build + python -m build - # # Install - # wheel=(dist/*.whl); python -m pip install "${wheel}[test]" + # Install + wheel=(dist/*.whl); python -m pip install "${wheel}[test]" - # # Test - # pytest --no-cov src/ tests/ + # Test + pytest --no-cov src/ tests/ skore-coverage: # needs: test-skore runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + working-directory: "./skore" steps: - name: pwd run: | @@ -89,11 +88,11 @@ jobs: junitxml-path: ./skore/coverage.xml title: pytest coverage report - # cleanup: - # runs-on: ubuntu-latest - # if: always() - # needs: test-skore - # steps: - # - uses: geekyeggo/delete-artifact@v5 - # with: - # name: skore-ui-package-distributions + cleanup: + runs-on: ubuntu-latest + if: always() + needs: test-skore + steps: + - uses: geekyeggo/delete-artifact@v5 + with: + name: skore-ui-package-distributions From 9a93e4acd883fed0c34a64afa9f648331ef2b2a9 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 09:45:28 +0100 Subject: [PATCH 19/34] wip --- .github/workflows/skore.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index bb9a324e..0c918cb3 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -34,8 +34,8 @@ jobs: strategy: fail-fast: true matrix: - os: ["ubuntu-latest", "windows-latest"] - python-version: ["3.9", "3.10", "3.11", "3.12"] + os: ["ubuntu-latest"] #["ubuntu-latest", "windows-latest"] + python-version: ["3.9"] #["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -68,12 +68,8 @@ jobs: pytest --no-cov src/ tests/ skore-coverage: - # needs: test-skore + needs: test-skore runs-on: ubuntu-latest - defaults: - run: - shell: "bash" - working-directory: "./skore" steps: - name: pwd run: | From 9c41222e83fa710f56fa811ccf9b3effc56e6870 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 10:12:03 +0100 Subject: [PATCH 20/34] wip --- .github/workflows/skore.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 0c918cb3..120a8ba4 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -71,9 +71,11 @@ jobs: needs: test-skore runs-on: ubuntu-latest steps: - - name: pwd - run: | - pwd + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + cache: "pip" - name: pytest coverage run: | pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt From 24c6d791843c579b9e6c1e4f5aa39176b324b711 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 10:25:10 +0100 Subject: [PATCH 21/34] wip --- .github/workflows/skore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 120a8ba4..15977426 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -82,8 +82,8 @@ jobs: - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: - pytest-coverage-path: ./skore/pytest-coverage.txt - junitxml-path: ./skore/coverage.xml + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./coverage.xml title: pytest coverage report cleanup: From 605b758740523f1d6ffa56134a24f2149711ac6f Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 10:44:03 +0100 Subject: [PATCH 22/34] wip --- .github/workflows/skore.yml | 49 ++++++++------------------- skore/tests/integration/ui/test_ui.py | 1 - 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 15977426..bff88835 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -3,30 +3,7 @@ name: Reusable skore workflow on: [workflow_call] jobs: - build-skore-ui: - runs-on: ubuntu-latest - defaults: - run: - shell: "bash" - working-directory: "./skore-ui" - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "npm" - cache-dependency-path: skore-ui/package-lock.json - - shell: bash - run: | - npm install - npm run build - - uses: actions/upload-artifact@v4 - with: - name: skore-ui-package-distributions - path: skore-ui/dist - test-skore: - needs: build-skore-ui defaults: run: shell: "bash" @@ -51,10 +28,15 @@ jobs: - name: timeout-minutes: 10 run: | + # Install dependencies python -m pip install --upgrade pip python -m pip install --upgrade pre-commit python -m pip install --upgrade build + # fake frontend + mkdir -p src/skore/ui/static + touch src/skore/ui/static/index.html + # Lint pre-commit run --all-files ruff @@ -65,7 +47,7 @@ jobs: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" # Test - pytest --no-cov src/ tests/ + python -m pytest --no-cov src/ tests/ skore-coverage: needs: test-skore @@ -78,19 +60,18 @@ jobs: cache: "pip" - name: pytest coverage run: | - pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt + # Install dependencies + python -m pip install -e '.[test]' + + # fake frontend + mkdir -p src/skore/ui/static + touch src/skore/ui/static/index.html + + # run coverage + python -m pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: pytest-coverage-path: ./pytest-coverage.txt junitxml-path: ./coverage.xml title: pytest coverage report - - cleanup: - runs-on: ubuntu-latest - if: always() - needs: test-skore - steps: - - uses: geekyeggo/delete-artifact@v5 - with: - name: skore-ui-package-distributions diff --git a/skore/tests/integration/ui/test_ui.py b/skore/tests/integration/ui/test_ui.py index cf94339c..ec57f150 100644 --- a/skore/tests/integration/ui/test_ui.py +++ b/skore/tests/integration/ui/test_ui.py @@ -17,7 +17,6 @@ def test_skore_ui_index(client): response = client.get("/") assert response.status_code == 200 - assert b"" in response.content def test_get_items(client, in_memory_project): From edff7aee5ee13b7eff4371ec3db89d044876d149 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 10:45:35 +0100 Subject: [PATCH 23/34] wip --- .github/workflows/skore.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index bff88835..d9a31a99 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -20,11 +20,6 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: "pip" - - name: Download package distributions - uses: actions/download-artifact@v4 - with: - name: skore-ui-package-distributions - path: skore/src/skore/ui/static - name: timeout-minutes: 10 run: | From e6ce6428c37485c9556919d0c7576ef006248fd1 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 10:58:33 +0100 Subject: [PATCH 24/34] wip --- .github/workflows/skore.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index d9a31a99..0d0210b9 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -56,12 +56,20 @@ jobs: - name: pytest coverage run: | # Install dependencies - python -m pip install -e '.[test]' + python -m pip install --upgrade pip + python -m pip install --upgrade pre-commit + python -m pip install --upgrade build # fake frontend mkdir -p src/skore/ui/static touch src/skore/ui/static/index.html + # Build + python -m build + + # Install + wheel=(dist/*.whl); python -m pip install "${wheel}[test]" + # run coverage python -m pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt - name: Pytest coverage comment From e376f92dd8b7e43f23206ab59d2af9dc681da492 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 10:59:00 +0100 Subject: [PATCH 25/34] wip --- .github/workflows/skore.yml | 71 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 0d0210b9..c764d348 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -3,49 +3,48 @@ name: Reusable skore workflow on: [workflow_call] jobs: - test-skore: - defaults: - run: - shell: "bash" - working-directory: "./skore" - strategy: - fail-fast: true - matrix: - os: ["ubuntu-latest"] #["ubuntu-latest", "windows-latest"] - python-version: ["3.9"] #["3.9", "3.10", "3.11", "3.12"] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" - - name: - timeout-minutes: 10 - run: | - # Install dependencies - python -m pip install --upgrade pip - python -m pip install --upgrade pre-commit - python -m pip install --upgrade build + # test-skore: + # defaults: + # run: + # shell: "bash" + # working-directory: "./skore" + # strategy: + # fail-fast: true + # matrix: + # os: ["ubuntu-latest"] #["ubuntu-latest", "windows-latest"] + # python-version: ["3.9"] #["3.9", "3.10", "3.11", "3.12"] + # runs-on: ${{ matrix.os }} + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} + # cache: "pip" + # - name: + # timeout-minutes: 10 + # run: | + # # Install dependencies + # python -m pip install --upgrade pip + # python -m pip install --upgrade pre-commit + # python -m pip install --upgrade build - # fake frontend - mkdir -p src/skore/ui/static - touch src/skore/ui/static/index.html + # # fake frontend + # mkdir -p src/skore/ui/static + # touch src/skore/ui/static/index.html - # Lint - pre-commit run --all-files ruff + # # Lint + # pre-commit run --all-files ruff - # Build - python -m build + # # Build + # python -m build - # Install - wheel=(dist/*.whl); python -m pip install "${wheel}[test]" + # # Install + # wheel=(dist/*.whl); python -m pip install "${wheel}[test]" - # Test - python -m pytest --no-cov src/ tests/ + # # Test + # python -m pytest --no-cov src/ tests/ skore-coverage: - needs: test-skore runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 10692052bd2bee6d5669f86f442ac3fafba917f9 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 11:02:49 +0100 Subject: [PATCH 26/34] wip --- .github/workflows/skore.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index c764d348..e38511fd 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -54,6 +54,8 @@ jobs: cache: "pip" - name: pytest coverage run: | + cd skore + # Install dependencies python -m pip install --upgrade pip python -m pip install --upgrade pre-commit From db46b3b4076e4dc233dd0dce7d79d3e991d4ee12 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 11:06:38 +0100 Subject: [PATCH 27/34] wip --- .github/workflows/skore.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index e38511fd..e55c86ad 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -76,6 +76,6 @@ jobs: - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: - pytest-coverage-path: ./pytest-coverage.txt - junitxml-path: ./coverage.xml + pytest-coverage-path: ./skore/pytest-coverage.txt + junitxml-path: ./skore/coverage.xml title: pytest coverage report From 2c9e68c77a997027466b81e326a0ab7a37ce3fac Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 11:12:59 +0100 Subject: [PATCH 28/34] wip --- .github/workflows/skore.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index e55c86ad..5de3a058 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -60,17 +60,12 @@ jobs: python -m pip install --upgrade pip python -m pip install --upgrade pre-commit python -m pip install --upgrade build + python -m pip install -e .[test] # fake frontend mkdir -p src/skore/ui/static touch src/skore/ui/static/index.html - # Build - python -m build - - # Install - wheel=(dist/*.whl); python -m pip install "${wheel}[test]" - # run coverage python -m pytest --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt - name: Pytest coverage comment From 574cf92559e2815d7ea2de055e7af312ddbd2769 Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 11:18:15 +0100 Subject: [PATCH 29/34] cleanup --- .github/workflows/skore.yml | 68 ++++++++++++++-------------- .github/workflows/sphinx.yml | 14 +++--- skore/pyproject.toml | 1 - skore/src/skore/ui/project_routes.py | 4 -- 4 files changed, 40 insertions(+), 47 deletions(-) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 5de3a058..3502e2e5 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -3,46 +3,44 @@ name: Reusable skore workflow on: [workflow_call] jobs: - # test-skore: - # defaults: - # run: - # shell: "bash" - # working-directory: "./skore" - # strategy: - # fail-fast: true - # matrix: - # os: ["ubuntu-latest"] #["ubuntu-latest", "windows-latest"] - # python-version: ["3.9"] #["3.9", "3.10", "3.11", "3.12"] - # runs-on: ${{ matrix.os }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python-version }} - # cache: "pip" - # - name: - # timeout-minutes: 10 - # run: | - # # Install dependencies - # python -m pip install --upgrade pip - # python -m pip install --upgrade pre-commit - # python -m pip install --upgrade build + test-skore: + strategy: + fail-fast: true + matrix: + os: ["ubuntu-latest", "windows-latest"] + python-version: ["3.9", "3.10", "3.11", "3.12"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + - name: + timeout-minutes: 10 + run: | + cd skore - # # fake frontend - # mkdir -p src/skore/ui/static - # touch src/skore/ui/static/index.html + # Install dependencies + python -m pip install --upgrade pip + python -m pip install --upgrade pre-commit + python -m pip install --upgrade build + + # fake frontend + mkdir -p src/skore/ui/static + touch src/skore/ui/static/index.html - # # Lint - # pre-commit run --all-files ruff + # Lint + pre-commit run --all-files ruff - # # Build - # python -m build + # Build + python -m build - # # Install - # wheel=(dist/*.whl); python -m pip install "${wheel}[test]" + # Install + wheel=(dist/*.whl); python -m pip install "${wheel}[test]" - # # Test - # python -m pytest --no-cov src/ tests/ + # Test + python -m pytest --no-cov src/ tests/ skore-coverage: runs-on: ubuntu-latest diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index 7632169e..b602fc87 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -29,10 +29,10 @@ jobs: - uses: actions/checkout@v4 with: ssh-key: ${{ secrets.DEPLOY_KEY }} - # - uses: actions/setup-python@v5 - # with: - # python-version: '3.12' - # cache: 'pip' - # - uses: ./.github/actions/sphinx/build - # - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - # uses: ./.github/actions/sphinx/deploy + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + - uses: ./.github/actions/sphinx/build + - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + uses: ./.github/actions/sphinx/deploy diff --git a/skore/pyproject.toml b/skore/pyproject.toml index 6a693fd1..00c957b6 100644 --- a/skore/pyproject.toml +++ b/skore/pyproject.toml @@ -110,7 +110,6 @@ addopts = [ "--ignore=doc", "--ignore=examples", "--ignore=notebooks", - "--ignore=hatch", ] [tool.ruff] diff --git a/skore/src/skore/ui/project_routes.py b/skore/src/skore/ui/project_routes.py index ddd43c20..39f2f800 100644 --- a/skore/src/skore/ui/project_routes.py +++ b/skore/src/skore/ui/project_routes.py @@ -4,7 +4,6 @@ from collections import defaultdict from dataclasses import dataclass from typing import Any -from venv import logger from fastapi import APIRouter, HTTPException, Request, status @@ -123,7 +122,4 @@ async def delete_view(request: Request, key: str): status_code=status.HTTP_404_NOT_FOUND, detail="View not found" ) from None - if True: - logger.info(msg="yo") - return __serialize_project(project) From b0e8aad830740934abb4165a12a7b598063632ad Mon Sep 17 00:00:00 2001 From: Matthieu Jouis Date: Fri, 22 Nov 2024 11:41:39 +0100 Subject: [PATCH 30/34] wip --- .github/workflows/skore.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/skore.yml b/.github/workflows/skore.yml index 3502e2e5..7b9cba05 100644 --- a/.github/workflows/skore.yml +++ b/.github/workflows/skore.yml @@ -4,6 +4,9 @@ on: [workflow_call] jobs: test-skore: + defaults: + run: + shell: "bash" strategy: fail-fast: true matrix: From 79c429e7feae315479b2a2c90adbdf8ecb4bf95b Mon Sep 17 00:00:00 2001 From: Matt J Date: Mon, 25 Nov 2024 16:21:26 +0100 Subject: [PATCH 31/34] omit tests folder from coverage report --- skore/pyproject.toml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/skore/pyproject.toml b/skore/pyproject.toml index 00c957b6..fbe2411a 100644 --- a/skore/pyproject.toml +++ b/skore/pyproject.toml @@ -1,13 +1,9 @@ [project] name = "skore" description = "Tooling and assistance for data scientists to \"Own Your Data Science\"" -dynamic = [ - "license", - "readme", - "version" -] +dynamic = ["license", "readme", "version"] requires-python = ">=3.9, <3.13" -maintainers = [{name = "skore developers", email="skore@signal.probabl.ai"}] +maintainers = [{ name = "skore developers", email = "skore@signal.probabl.ai" }] dependencies = [ "diskcache", "fastapi", @@ -16,7 +12,7 @@ dependencies = [ "skops", "uvicorn", ] -classifiers=[ +classifiers = [ "Intended Audience :: Science/Research", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", @@ -112,11 +108,14 @@ addopts = [ "--ignore=notebooks", ] +[tool.coverage.run] +omit = [ + "tests/*", +] + [tool.ruff] src = ["skore"] -exclude = [ - "doc" -] +exclude = ["doc"] [tool.ruff.lint] select = [ @@ -154,9 +153,7 @@ extend-ignore-re = [ ] [tool.typos.files] -extend-exclude = [ - "*.min.js", -] +extend-exclude = ["*.min.js"] [tool.typos.default.extend-words] # acronym for "False Positive Rate" From 3e50a8e7754b0c4ca13e8e100352b3382131e566 Mon Sep 17 00:00:00 2001 From: "Matt J." Date: Wed, 27 Nov 2024 15:56:28 +0100 Subject: [PATCH 32/34] feat: Add support for skrub's TableReport (#810) Co-authored-by: Thomas S. --- skore-ui/src/components/HtmlSnippetWidget.vue | 1 + skore-ui/src/stores/project.ts | 1 + skore/pyproject.toml | 1 + skore/src/skore/item/__init__.py | 3 ++ .../src/skore/item/skrub_table_report_item.py | 31 +++++++++++++++++++ .../unit/item/test_skrub_table_report_item.py | 22 +++++++++++++ 6 files changed, 59 insertions(+) create mode 100644 skore/src/skore/item/skrub_table_report_item.py create mode 100644 skore/tests/unit/item/test_skrub_table_report_item.py diff --git a/skore-ui/src/components/HtmlSnippetWidget.vue b/skore-ui/src/components/HtmlSnippetWidget.vue index b341acc0..1990823b 100644 --- a/skore-ui/src/components/HtmlSnippetWidget.vue +++ b/skore-ui/src/components/HtmlSnippetWidget.vue @@ -29,6 +29,7 @@ const document = computed(() => { } body { -webkit-font-smoothing: antialiased; + font-family: Geist, sans-serif; } diff --git a/skore-ui/src/stores/project.ts b/skore-ui/src/stores/project.ts index 3d9ff242..b2c7fe74 100644 --- a/skore-ui/src/stores/project.ts +++ b/skore-ui/src/stores/project.ts @@ -349,6 +349,7 @@ export const useProjectStore = defineStore("project", () => { if ( [ "text/markdown", + "text/html", "application/vnd.dataframe+json", "application/vnd.sklearn.estimator+html", "image/png", diff --git a/skore/pyproject.toml b/skore/pyproject.toml index 91e2bd20..36b0dca0 100644 --- a/skore/pyproject.toml +++ b/skore/pyproject.toml @@ -76,6 +76,7 @@ test = [ "pytest-randomly", "ruff", "scikit-learn", + "skrub", ] sphinx = [ diff --git a/skore/src/skore/item/__init__.py b/skore/src/skore/item/__init__.py index 5b2d693e..1e253bfd 100644 --- a/skore/src/skore/item/__init__.py +++ b/skore/src/skore/item/__init__.py @@ -5,6 +5,7 @@ from contextlib import suppress from typing import Any +from skore.item import skrub_table_report_item as SkrubTableReportItem from skore.item.cross_validation_item import CrossValidationItem from skore.item.item import Item, ItemTypeError from skore.item.item_repository import ItemRepository @@ -29,6 +30,7 @@ def object_to_item(object: Any) -> Item: NumpyArrayItem, SklearnBaseEstimatorItem, MediaItem, + SkrubTableReportItem, ): with suppress(ImportError, ItemTypeError): # ImportError: @@ -55,5 +57,6 @@ def object_to_item(object: Any) -> Item: "PolarsSeriesItem", "PrimitiveItem", "SklearnBaseEstimatorItem", + "SkrubTableReportItem", "object_to_item", ] diff --git a/skore/src/skore/item/skrub_table_report_item.py b/skore/src/skore/item/skrub_table_report_item.py new file mode 100644 index 00000000..b411256f --- /dev/null +++ b/skore/src/skore/item/skrub_table_report_item.py @@ -0,0 +1,31 @@ +"""SkrubTableReportItem.""" + +from __future__ import annotations + +from typing import TYPE_CHECKING + +from skore.item.item import ItemTypeError +from skore.item.media_item import MediaItem + +if TYPE_CHECKING: + from skrub import TableReport + + +def factory(table_report: TableReport) -> MediaItem: + """ + Create a new MediaItem instance from a skrub TableReport. + + Parameters + ---------- + table_report : TableReport + The report to store. + + Returns + ------- + MediaItem + A new MediaItem instance. + """ + if not hasattr(table_report, "html_snippet"): + raise ItemTypeError(f"Type '{table_report.__class__}' is not supported.") + + return MediaItem.factory_str(table_report.html_snippet(), media_type="text/html") diff --git a/skore/tests/unit/item/test_skrub_table_report_item.py b/skore/tests/unit/item/test_skrub_table_report_item.py new file mode 100644 index 00000000..eef31709 --- /dev/null +++ b/skore/tests/unit/item/test_skrub_table_report_item.py @@ -0,0 +1,22 @@ +import pytest +from pandas import DataFrame +from skore.item import ItemTypeError, SkrubTableReportItem +from skrub import TableReport + + +class TestSkrubTableReportItem: + def test_factory(self, monkeypatch, mock_nowstr, MockDatetime): + monkeypatch.setattr("skore.item.item.datetime", MockDatetime) + monkeypatch.setattr("secrets.token_hex", lambda: "azertyuiop") + + df = DataFrame(dict(a=[1, 2], b=["one", "two"], c=[11.1, 11.1])) + report = TableReport(df) + item = SkrubTableReportItem.factory(report) + + assert item.media_bytes == report.html_snippet().encode() + assert item.created_at == mock_nowstr + assert item.updated_at == mock_nowstr + + def test_factory_exception(self): + with pytest.raises(ItemTypeError): + SkrubTableReportItem.factory(None) From 82c0e78dc9bdef6817e2aa65dacf409eef5f84be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 27 Nov 2024 14:57:47 +0000 Subject: [PATCH 33/34] docs: Build documentation triggered by 9a31ff37f8329c95b68f634e8e7507878ae2aeeb skip-checks:true --- .../auto_examples_python.zip | Bin 32861 -> 32861 bytes .../plot_02_overview_skore_project.zip | Bin 24268 -> 24268 bytes .../auto_examples_jupyter.zip | Bin 58283 -> 58283 bytes .../plot_01_getting_started.zip | Bin 19340 -> 19340 bytes .../plot_04_tracking_items.zip | Bin 13946 -> 13946 bytes .../plot_05_train_test_split.zip | Bin 18245 -> 18245 bytes .../plot_03_cross_validate.zip | Bin 15411 -> 15411 bytes .../plot_01_getting_started.rst.txt | 10 +-- .../plot_02_overview_skore_project.rst.txt | 74 +++++++++--------- .../plot_03_cross_validate.rst.txt | 12 +-- .../plot_04_tracking_items.rst.txt | 26 +++--- .../plot_05_train_test_split.rst.txt | 8 +- .../plot_01_getting_started.html | 10 +-- .../plot_02_overview_skore_project.html | 74 +++++++++--------- .../auto_examples/plot_03_cross_validate.html | 12 +-- .../auto_examples/plot_04_tracking_items.html | 26 +++--- .../plot_05_train_test_split.html | 8 +- docs/latest/searchindex.js | 2 +- 18 files changed, 131 insertions(+), 131 deletions(-) diff --git a/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip b/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip index 4d88ab686de7a122f16e3b372092ab7f233fa40b..296ce43c2a57958b782621b05a429f9e101ab3ae 100644 GIT binary patch delta 90 zcmccHz;w5Pi6_9DnMH&F1dPfz@=TXyGArM_RCb>vh)y*>CIq5&y>i8wOv^XVN%WLu gGAf_^yv_|MJXycq9Yj^syMn0wK+3dyGFwA90NaBd4gdfE delta 90 zcmccHz;w5Pi6_9DnMH&F1U}_#1)pBP}wsMKzg!roG*wfii-jOQEv~? diff --git a/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip b/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip index f3fb8cbe01b14724a2671190e646a10d188af838..cf259d971c622dd91c07a8e4a6e4d1ddf72346ac 100644 GIT binary patch delta 90 zcmZ2|oO$(eW}X0VW)=|!5HKy@$m5~QWLCa8O!tNkh&G7gR0h%3wbCjeI%44&2PV_< c$!d>0f!xW3kGw$C-bWrFiv2N|3Va*|0MU>hDgXcg delta 90 zcmZ2|oO$(eW}X0VW)=|!5crz2k;g-q>08d`Fx?wEAle{`Q<>>&&SvXcX%!G1vG9xo eke;me$P*|%x$uz}h}!$e10=})7)%8|jsgJWrzJQ5 diff --git a/docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip b/docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip index 6da8baf31c31c1bebf1fe035fe1494a0f2daa2a5..7e0df06b3b508e4076e570b48df34df6b05d8d41 100644 GIT binary patch delta 45 xcmeB~&e$`Zkte{LnMH&F1dPfz@=TXyGA-Y{RMtzE$*6qtM=v)Zce15-FaQXF43+=@ delta 45 xcmeB~&e$`Zkte{LnMH&F1U}_#H6Jjze-+V=gTNy}CerW0nqBP8c02_%6)&Kwi delta 43 vcmeyB^DBoZz?+#xgaHJ;=4|9SCdBkDXY&;yZe^ygIg=lnx&pbAHOztlOP~*^ diff --git a/docs/latest/_downloads/cdd7bc0df44925960cbfd8a4588515de/plot_05_train_test_split.zip b/docs/latest/_downloads/cdd7bc0df44925960cbfd8a4588515de/plot_05_train_test_split.zip index 5b254c932a8780dba61df59845ba99fd33c35cb9..ef4eee967b627de749dbb74c4e63c77e2ac40822 100644 GIT binary patch delta 45 vcmX@w$9S}lkte{LnMH&F1kB1e^6ZmjGArMFM)H;pke|=XRRPkIXIZ;~sE5`;0Q(3GNB{r; delta 43 tcmdm7vAKdLz?+#xgaHJ;=4|B26=(XIv$ Project create.py:148 + [11/27/24 14:57:38] Project create.py:148 file '/tmp/sk ore_exam - ple_msew - px8c/my_ + ple_zyvn + 5e6j/my_ project. skore' was @@ -836,7 +836,7 @@ a ``cross_validation`` item with a plotly chart in our project.
-
+


@@ -933,7 +933,7 @@ Removing the temporary directory: .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 5.587 seconds) + **Total running time of the script:** (0 minutes 5.282 seconds) .. _sphx_glr_download_auto_examples_plot_01_getting_started.py: diff --git a/docs/latest/_sources/auto_examples/plot_02_overview_skore_project.rst.txt b/docs/latest/_sources/auto_examples/plot_02_overview_skore_project.rst.txt index c51a91f3..81be262d 100644 --- a/docs/latest/_sources/auto_examples/plot_02_overview_skore_project.rst.txt +++ b/docs/latest/_sources/auto_examples/plot_02_overview_skore_project.rst.txt @@ -74,12 +74,12 @@ We create and load the skore project from this temporary directory: .. code-block:: none - [11/27/24 13:39:42] Project create.py:148 + [11/27/24 14:57:43] Project create.py:148 file '/tmp/sk ore_exam - ple_cnh9 - nm62/my_ + ple_ywcf + mhvx/my_ project. skore' was @@ -463,9 +463,9 @@ Numpy array: .. code-block:: none - array([[-0.28516673, -0.41679943, 0.35609019], - [-0.48764957, -1.07516288, -0.45868306], - [ 0.30252796, -0.94149613, -0.13905811]]) + array([[-0.6501336 , -0.60117653, -1.09845047], + [ 1.35328374, 0.35407001, 0.14933954], + [-1.2202973 , -0.87447769, -0.72164611]]) @@ -519,43 +519,43 @@ Pandas data frame: 0 - -0.733237 - 1.709223 - 0.028449 - -1.025268 - -0.548394 + -0.274461 + -0.247434 + -0.135080 + -1.038325 + -0.338708 1 - -0.091134 - 0.935411 - 0.853804 - 2.294586 - -1.195526 + -0.269943 + 0.285846 + -0.300639 + -0.339632 + -0.554256 2 - -0.394744 - 0.892604 - 0.222852 - -0.360955 - -0.061156 + -0.648397 + 0.695285 + -0.843875 + 1.845974 + -0.031786 3 - 0.320909 - 1.047759 - 0.504656 - 1.140532 - -0.515275 + -1.857205 + -0.328491 + -0.119161 + -0.121291 + -0.405470 4 - 1.298054 - -0.415593 - -0.619562 - -0.182556 - 1.079776 + -0.526285 + 1.948811 + 0.397942 + -1.181865 + -1.026399 @@ -593,7 +593,7 @@ Polars data frame: white-space: pre-wrap; } - shape: (5, 5)
column_0column_1column_2column_3column_4
f64f64f64f64f64
2.6174961.942976-0.620386-1.7177182.25964
-0.076289-1.3705281.5300791.4466731.528941
-0.9455970.5999870.590573-1.143401-1.187629
1.2597540.8378590.2353540.8388690.374223
-0.3328450.4245180.909206-0.309035-1.641099
+ shape: (5, 5)
column_0column_1column_2column_3column_4
f64f64f64f64f64
1.5280481.948417-1.016384-1.1893930.761023
-0.537125-0.738531-0.387001-0.024675-1.369647
0.447709-0.6815951.0283121.0553150.507013
-1.087708-1.201985-0.5772960.274565-0.685252
-0.5242160.3470391.0023640.4265160.767098


@@ -718,7 +718,7 @@ Plotly figure:
-
+


@@ -760,10 +760,10 @@ Animated Plotly figure:
-

@@ -2126,7 +2126,7 @@ Removing the temporary directory: .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.825 seconds) + **Total running time of the script:** (0 minutes 0.797 seconds) .. _sphx_glr_download_auto_examples_plot_02_overview_skore_project.py: diff --git a/docs/latest/_sources/auto_examples/plot_03_cross_validate.rst.txt b/docs/latest/_sources/auto_examples/plot_03_cross_validate.rst.txt index 0446af75..389491ef 100644 --- a/docs/latest/_sources/auto_examples/plot_03_cross_validate.rst.txt +++ b/docs/latest/_sources/auto_examples/plot_03_cross_validate.rst.txt @@ -74,12 +74,12 @@ We create and load the skore project from this temporary directory: .. code-block:: none - [11/27/24 13:39:43] Project create.py:148 + [11/27/24 14:57:44] Project create.py:148 file '/tmp/sk ore_exam - ple_peyf - ncyz/my_ + ple_cz10 + 09h3/my_ project. skore' was @@ -291,7 +291,7 @@ Let us continue with the same use case.
-
+


@@ -374,7 +374,7 @@ running another unrelated cross-validation:
-
+


@@ -407,7 +407,7 @@ Removing the temporary directory: .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.168 seconds) + **Total running time of the script:** (0 minutes 0.189 seconds) .. _sphx_glr_download_auto_examples_plot_03_cross_validate.py: diff --git a/docs/latest/_sources/auto_examples/plot_04_tracking_items.rst.txt b/docs/latest/_sources/auto_examples/plot_04_tracking_items.rst.txt index e74a0871..70a30956 100644 --- a/docs/latest/_sources/auto_examples/plot_04_tracking_items.rst.txt +++ b/docs/latest/_sources/auto_examples/plot_04_tracking_items.rst.txt @@ -78,8 +78,8 @@ We create and load the skore project from this temporary directory: file '/tmp/sk ore_exam - ple_jd07 - hw3q/my_ + ple_c0g3 + uo7a/my_ project. skore' was @@ -176,8 +176,8 @@ We can print the first history (first iteration) of this item: PrimitiveItem(...) 4 - 2024-11-27T13:39:43.982346+00:00 - 2024-11-27T13:39:43.982346+00:00 + 2024-11-27T14:57:44.814660+00:00 + 2024-11-27T14:57:44.814660+00:00 @@ -244,22 +244,22 @@ Let us construct a dataframe with the values and last updated times: 0 0 4 - 2024-11-27T13:39:43.982346+00:00 - 2024-11-27T13:39:43.982346+00:00 + 2024-11-27T14:57:44.814660+00:00 + 2024-11-27T14:57:44.814660+00:00 1 1 9 - 2024-11-27T13:39:43.982346+00:00 - 2024-11-27T13:39:44.083397+00:00 + 2024-11-27T14:57:44.814660+00:00 + 2024-11-27T14:57:44.915712+00:00 2 2 16 - 2024-11-27T13:39:43.982346+00:00 - 2024-11-27T13:39:44.184318+00:00 + 2024-11-27T14:57:44.814660+00:00 + 2024-11-27T14:57:45.016398+00:00 @@ -307,7 +307,7 @@ We can now track the value of the item over time:
-
+


@@ -394,7 +394,7 @@ We can compare the metrics of each run of the cross-validation (on all splits):
-
+


@@ -425,7 +425,7 @@ Removing the temporary directory: .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.381 seconds) + **Total running time of the script:** (0 minutes 0.450 seconds) .. _sphx_glr_download_auto_examples_plot_04_tracking_items.py: diff --git a/docs/latest/_sources/auto_examples/plot_05_train_test_split.rst.txt b/docs/latest/_sources/auto_examples/plot_05_train_test_split.rst.txt index f7b90084..0ac8a030 100644 --- a/docs/latest/_sources/auto_examples/plot_05_train_test_split.rst.txt +++ b/docs/latest/_sources/auto_examples/plot_05_train_test_split.rst.txt @@ -74,12 +74,12 @@ We create and load the skore project from this temporary directory: .. code-block:: none - [11/27/24 13:39:44] Project create.py:148 + [11/27/24 14:57:45] Project create.py:148 file '/tmp/sk ore_exam - ple_mi0p - xra1/my_ + ple_lgzm + wrk_/my_ project. skore' was @@ -542,7 +542,7 @@ Removing the temporary directory: .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.042 seconds) + **Total running time of the script:** (0 minutes 0.041 seconds) .. _sphx_glr_download_auto_examples_plot_05_train_test_split.py: diff --git a/docs/latest/auto_examples/plot_01_getting_started.html b/docs/latest/auto_examples/plot_01_getting_started.html index 205e327d..87c2be60 100644 --- a/docs/latest/auto_examples/plot_01_getting_started.html +++ b/docs/latest/auto_examples/plot_01_getting_started.html @@ -495,12 +495,12 @@

Creating and loading a skore project, and launching the skore UImy_project = skore.create("my_project", working_dir=temp_dir_path) -
[11/27/24 13:39:36] <Logger skore.project.project (INFO)> Project  create.py:148
+
[11/27/24 14:57:38] <Logger skore.project.project (INFO)> Project  create.py:148
                                                           file
                                                           '/tmp/sk
                                                           ore_exam
-                                                          ple_msew
-                                                          px8c/my_
+                                                          ple_zyvn
+                                                          5e6j/my_
                                                           project.
                                                           skore'
                                                           was
@@ -1130,7 +1130,7 @@ 

Cross-validation with skore
-
+



Hence, we can observe some key metrics and get insights on our cross-validation.

@@ -1182,7 +1182,7 @@

Cleanup the project
temp_dir.cleanup()
 

-

Total running time of the script: (0 minutes 5.587 seconds)

+

Total running time of the script: (0 minutes 5.282 seconds)

-


@@ -812,7 +812,7 @@

Storing data visualizations
-
+



Animated Plotly figure:

@@ -839,10 +839,10 @@

Storing data visualizations
-

@@ -2128,7 +2128,7 @@

Cleanup the project
temp_dir.cleanup()
 
-

Total running time of the script: (0 minutes 0.825 seconds)

+

Total running time of the script: (0 minutes 0.797 seconds)

-
[11/27/24 13:39:43] <Logger skore.project.project (INFO)> Project  create.py:148
+
[11/27/24 14:57:44] <Logger skore.project.project (INFO)> Project  create.py:148
                                                           file
                                                           '/tmp/sk
                                                           ore_exam
-                                                          ple_peyf
-                                                          ncyz/my_
+                                                          ple_cz10
+                                                          09h3/my_
                                                           project.
                                                           skore'
                                                           was
@@ -632,7 +632,7 @@ 

Classification task
-
+



Skore’s cross_validate() advantages are the following:

@@ -684,7 +684,7 @@

Regression task
-
+



-

Total running time of the script: (0 minutes 0.168 seconds)

+

Total running time of the script: (0 minutes 0.189 seconds)



@@ -676,7 +676,7 @@

Tracking an integer
-
+



Hence, we can observe that the first run, with alpha=0.5, works better.

@@ -686,7 +686,7 @@

Cleanup the project
temp_dir.cleanup()
 
-

Total running time of the script: (0 minutes 0.381 seconds)

+

Total running time of the script: (0 minutes 0.450 seconds)

-
[11/27/24 13:39:44] <Logger skore.project.project (INFO)> Project  create.py:148
+
[11/27/24 14:57:45] <Logger skore.project.project (INFO)> Project  create.py:148
                                                           file
                                                           '/tmp/sk
                                                           ore_exam
-                                                          ple_mi0p
-                                                          xra1/my_
+                                                          ple_lgzm
+                                                          wrk_/my_
                                                           project.
                                                           skore'
                                                           was
@@ -727,7 +727,7 @@ 

Cleanup the project
temp_dir.cleanup()
 

-

Total running time of the script: (0 minutes 0.042 seconds)

+

Total running time of the script: (0 minutes 0.041 seconds)