From 916da9b7fc1bd3cf920d3f571983dd072cff14bc Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Tue, 19 Sep 2023 15:10:11 +0200 Subject: [PATCH] Check API with Pyright --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++------------ tox.ini | 6 ++++++ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df24ee74..e98c8104 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,15 +47,14 @@ jobs: with: name: Packages path: dist - - run: tar xf dist/*.tar.gz --strip-components=1 # needed for config files - + - run: tar xf dist/*.tar.gz --strip-components=1 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} allow-prereleases: true cache: pip - - run: python -Im pip install tox + - run: python -Im tox run --installpkg dist/*.whl -f py$(echo ${{ matrix.python-version }} | tr -d .) - name: Upload coverage data @@ -76,9 +75,7 @@ jobs: with: python-version-file: .python-version-default cache: pip - - run: python -Im pip install --upgrade coverage[toml] - - uses: actions/download-artifact@v3 with: name: coverage-data @@ -112,18 +109,36 @@ jobs: with: name: Packages path: dist - - run: tar xf dist/*.tar.gz --strip-components=1 # needed for config files + - run: tar xf dist/*.tar.gz --strip-components=1 + - uses: actions/setup-python@v4 + with: + python-version-file: .python-version-default + allow-prereleases: true + cache: pip + - run: python -Im pip install tox + + - run: python -Im tox run --installpkg dist/*.whl -e mypy-pkg + pyright: + name: Pyright + runs-on: ubuntu-latest + needs: build-package + + steps: + - name: Download pre-built packages + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + - run: tar xf dist/*.tar.gz --strip-components=1 - uses: actions/setup-python@v4 with: python-version-file: .python-version-default allow-prereleases: true cache: pip + - run: python -Im pip install tox - - name: Prepare & run tox - run: | - python -Im pip install tox - python -Im tox run --installpkg dist/*.whl -e mypy-pkg + - run: python -Im tox run --installpkg dist/*.whl -e pyright docs: name: Build docs & run doctests @@ -135,8 +150,7 @@ jobs: with: name: Packages path: dist - - run: tar xf dist/*.tar.gz --strip-components=1 # needed for config files - + - run: tar xf dist/*.tar.gz --strip-components=1 - uses: actions/setup-python@v4 with: # Keep in sync with tox.ini/docs & .readthedocs.yaml @@ -172,6 +186,7 @@ jobs: - docs - install-dev - mypy-pkg + - pyright runs-on: ubuntu-latest diff --git a/tox.ini b/tox.ini index 18d6a5cb..36c773ac 100644 --- a/tox.ini +++ b/tox.ini @@ -84,6 +84,12 @@ extras = typing commands = mypy src +[testenv:pyright] +deps = pyright +extras = typing +commands = pyright tests/typing + + [testenv:color-force] help = A visual check that FORCE_COLOR is working. set_env = FORCE_COLOR=1