Skip to content

Commit

Permalink
Implement initial support for "pyright".
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Mansencal <tmansencal@wetafx.co.nz>
  • Loading branch information
tmansencal committed Oct 13, 2023
1 parent 1abd145 commit cec1bd2
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/continuous-integration-static-type-checking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Continuous Integration - Static Type Checking

on: [push, pull_request]

jobs:
continuous-integration-static-type-checking:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [macOS-latest]
python-version: [3.11]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Environment Variables
run: |
echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV
shell: bash
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies (macOS)
if: matrix.os == 'macOS-latest'
run: |
brew install graphviz
export GRAPHVIZ_DIR="/usr/local/Cellar/graphviz/<VERSION>"
pip install pygraphviz --global-option=build_ext --global-option="-I$GRAPHVIZ_DIR/include" --global-option="-L$GRAPHVIZ_DIR/lib"
- name: Install Package Dependencies
run: |
pip install -r requirements.txt
- name: Static Type Checking
run: |
pyright --skipunannotated
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Development Dependencies
- `invoke <https://pypi.org/project/invoke>`__
- `pre-commit <https://pypi.org/project/pre-commit>`__
- `pydata-sphinx-theme <https://pypi.org/project/pydata-sphinx-theme>`__
- `pyright <https://pypi.org/project/pyright>`__
- `pytest <https://pypi.org/project/pytest>`__
- `pytest-cov <https://pypi.org/project/pytest-cov>`__
- `restructuredtext-lint <https://pypi.org/project/restructuredtext-lint>`__
Expand Down
1 change: 1 addition & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Development Dependencies
- `invoke <https://pypi.org/project/invoke>`__
- `pre-commit <https://pypi.org/project/pre-commit>`__
- `pydata-sphinx-theme <https://pypi.org/project/pydata-sphinx-theme>`__
- `pyright <https://pypi.org/project/pyright>`__
- `pytest <https://pypi.org/project/pytest>`__
- `pytest-cov <https://pypi.org/project/pytest-cov>`__
- `restructuredtext-lint <https://pypi.org/project/restructuredtext-lint>`__
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ flynt = "*"
invoke = "*"
pre-commit = "*"
pydata-sphinx-theme = "*"
pyright = "*"
pytest = "*"
pytest-cov = "*"
restructuredtext-lint = "*"
Expand Down
25 changes: 24 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"ORG",
"CONTAINER",
"clean",
"quality",
"precommit",
"tests",
"preflight",
Expand Down Expand Up @@ -140,6 +141,28 @@ def clean(
ctx.run(f"rm -rf {pattern}")


@task
def quality(
ctx: Context,
pyright: bool = True,
):
"""
Check the codebase with *Pyright* and lints various *restructuredText*
files with *rst-lint*.
Parameters
----------
ctx
Context.
pyright
Whether to check the codebase with *Pyright*.
"""

if pyright:
message_box('Checking codebase with "Pyright"...')
ctx.run("pyright --skipunannotated --level warning")


@task
def precommit(ctx: Context):
"""
Expand Down Expand Up @@ -176,7 +199,7 @@ def tests(ctx: Context):
)


@task(precommit, tests)
@task(quality, precommit, tests)
def preflight(ctx: Context): # noqa: ARG001
"""
Perform the preflight tasks, i.e. *formatting* and *quality*.
Expand Down

0 comments on commit cec1bd2

Please sign in to comment.