From b04a5bcfaa7c0aafa4b6b5ff2d049be01ab6ca2d Mon Sep 17 00:00:00 2001 From: Richard Stromer Date: Thu, 1 Dec 2022 21:24:48 -0800 Subject: [PATCH] [dev-ops] Type annotation validation GitHub action (#902) * add pyright as dev dependency * add empty configuration for pyright to pyproject.toml * add github action for pyright * test the other pyright github action (hopefully with inline comments) * add github token for pyright action * Revert "test the other pyright github action (hopefully with inline comments)" This reverts commit 2012f51bdab84d372a5bc66a7594022d2d790184. * install python and requirements for pyright checks * define python version for pyright * also install docs requirements to fix type warnings for docs folder * limit type checks to a single file to get started * add missing dependency path to type check action * shorten upgrade parameter for pip * fix requirements/base.txt file location --- .github/workflows/linters.yml | 16 ++++++++++++++++ pyproject.toml | 3 +++ requirements/dev.txt | 1 + 3 files changed, 20 insertions(+) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index b4153d648..6584f6df2 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -55,3 +55,19 @@ jobs: uses: psf/black@stable with: jupyter: true + + pyright: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: "pip" + cache-dependency-path: "**/requirements/*.txt" + - name: Setup Requirements + run: pip install -U -r requirements/base.txt -r requirements/docs.txt + - name: pyright + uses: jakebailey/pyright-action@v1 diff --git a/pyproject.toml b/pyproject.toml index e1de182b1..faba6d479 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,3 +28,6 @@ exclude = ''' [tool.isort] profile = "black" line_length = 120 + +[tool.pyright] +include = ["neuralprophet/configure.py"] diff --git a/requirements/dev.txt b/requirements/dev.txt index a444e8f41..8d1ceda7a 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -2,6 +2,7 @@ black[jupyter] flake8 isort livelossplot>=0.5.3 +pyright pytest-cov pytest>=6.2.3 twine