From f2e5bb6d033ed6f907f9799c58fddff721b5e3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Thu, 12 Sep 2024 23:01:25 +0200 Subject: [PATCH] Add pyright --- .github/workflows/CI.yaml | 43 +++++++++++++++++++++++++++++----- .github/workflows/coverage.yml | 2 +- pyproject.toml | 2 +- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 1237796..aee51a1 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -41,14 +41,16 @@ jobs: poetry config virtualenvs.create true --local poetry config virtualenvs.in-project true --local - uses: actions/cache@v3 - name: Define a cache for the virtual environment based on the dependencies lock file + name: Define a cache for the virtual environment based on the dependencies file with: - path: ./.venv - key: venv-${{ hashFiles('pyproject.toml') }} + path: + - ./.venv + - poetry.lock + key: venv-${{ hashFiles('pyproject.toml') }}-${{ matrix.python-version }}-${{ matrix.os }} - name: Install the project dependencies run: poetry install --with test - name: Run the test - run: COLUMNS=80 poetry run coverage run -m pytest + run: poetry run coverage run -m pytest - name: "Upload coverage data to GH artifacts 📤" if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' uses: actions/upload-artifact@v4 @@ -77,7 +79,9 @@ jobs: - uses: actions/cache@v3 name: Define a cache for the virtual environment based on the dependencies lock file with: - path: ./.venv + path: + - ./.venv + - poetry.lock key: venv-${{ hashFiles('pyproject.toml') }} - name: Install the project dependencies run: poetry install --with test @@ -140,4 +144,31 @@ jobs: with: # leave default names name: python-coverage-comment-action - path: python-coverage-comment-action.txt \ No newline at end of file + path: python-coverage-comment-action.txt + + run-pyright: + strategy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.12" + - name: Install poetry + uses: abatilo/actions-poetry@v3 + - name: Setup poetry + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - uses: actions/cache@v3 + name: Define a cache for the virtual environment based on the dependencies file + with: + path: + - ./.venv + - poetry.lock + key: venv-${{ hashFiles('pyproject.toml') }} + - name: Install the project dependencies + run: poetry install --with test + - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH + - uses: jakebailey/pyright-action@v2 + name: Run pyright diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1f3c322..fb6f099 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,4 +29,4 @@ jobs: uses: py-cov-action/python-coverage-comment-action@v3 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} \ No newline at end of file + GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} diff --git a/pyproject.toml b/pyproject.toml index 7c8a205..a946bdf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ PyYAML = "^6.0.1" imageio = "^2.31.3" imagesize = "^1.4.1" POT = "^0.9.1" -jsonschema-rs = "^0.16.3" +jsonschema-rs = "^0.18.3" scikit-learn = "^1.3.0" typing-extensions = "^4.7.1" watchdog = "^3.0.0"