From 88993df4fc0612a74a9c9aa1d82bade80c868b23 Mon Sep 17 00:00:00 2001 From: cspotcode Date: Mon, 1 May 2023 23:53:29 -0400 Subject: [PATCH 1/6] Improve pyright config, add to make.py --- make.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/make.py b/make.py index 7e9f777e6e..455787e8c6 100755 --- a/make.py +++ b/make.py @@ -446,6 +446,12 @@ def mypy(): run([MYPY, *MYPYOPTS]) print("MyPy Finished.") +@app.command() +def pyright(): + "Typecheck using pyright" + run([PYRIGHT, *PYRIGHTOPTS]) + print("Pyright Finished.") + @app.command(rich_help_panel="Code Quality") def pyright(): From e5b98e460d056f70d205b63db3980856c0d974c6 Mon Sep 17 00:00:00 2001 From: cspotcode Date: Mon, 1 May 2023 23:57:26 -0400 Subject: [PATCH 2/6] categorize make.py subcommands in --help output --- make.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make.py b/make.py index 455787e8c6..74e9412275 100755 --- a/make.py +++ b/make.py @@ -446,7 +446,8 @@ def mypy(): run([MYPY, *MYPYOPTS]) print("MyPy Finished.") -@app.command() + +@app.command(rich_help_panel="Coding") def pyright(): "Typecheck using pyright" run([PYRIGHT, *PYRIGHTOPTS]) From 6c77cb79f138b1e66a053827f896b3fcb267dbfe Mon Sep 17 00:00:00 2001 From: cspotcode Date: Mon, 1 May 2023 23:56:12 -0400 Subject: [PATCH 3/6] split code-inspections on CI; add pyright --- .github/workflows/test.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 36ac57c3ed..cc583c5da9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,12 +31,21 @@ jobs: run: | python -m pip install -U pip wheel setuptools - name: wheel + id: wheel run: | python -m pip install -e .[dev] - - name: code-inspection + - name: "code-inspection: mypy" + if: ${{ (success() || failure()) && steps.wheel.outcome == 'success' }} run: | - mypy arcade - ruff arcade + python ./make.py mypy + - name: "code-inspection: pyright" + if: ${{ (success() || failure()) && steps.wheel.outcome == 'success' }} + run: | + python ./make.py pyright + - name: "code-inspection: ruff" + if: ${{ (success() || failure()) && steps.wheel.outcome == 'success' }} + run: | + python ./make.py ruff - name: build-docs run: | sphinx-build doc build -W From 51b14ece700a18a492540fdb1234aef4b0b647ec Mon Sep 17 00:00:00 2001 From: cspotcode Date: Sat, 6 May 2023 18:31:25 -0400 Subject: [PATCH 4/6] fix --- make.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/make.py b/make.py index 74e9412275..7e9f777e6e 100755 --- a/make.py +++ b/make.py @@ -447,13 +447,6 @@ def mypy(): print("MyPy Finished.") -@app.command(rich_help_panel="Coding") -def pyright(): - "Typecheck using pyright" - run([PYRIGHT, *PYRIGHTOPTS]) - print("Pyright Finished.") - - @app.command(rich_help_panel="Code Quality") def pyright(): "Typecheck using pyright" From f04b658458dffe886e7c8d36c0a89f0b0909cdb3 Mon Sep 17 00:00:00 2001 From: cspotcode Date: Sat, 6 May 2023 18:34:15 -0400 Subject: [PATCH 5/6] make lint includes pyright, like ci --- make.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make.py b/make.py index 7e9f777e6e..a74ef5cb9d 100755 --- a/make.py +++ b/make.py @@ -427,10 +427,11 @@ def pseudoxml(): @app.command(rich_help_panel="Code Quality") def lint(): """ - Run all linting tasks: ruff and mypy (Run this before making a pull request!) + Run all linting tasks: ruff, mypy, and pyright (Run this before making a pull request!) """ ruff() mypy() + pyright() print("Linting Complete.") From 54d40b176372bbda6fd3d612ed09ed9d8bb543fa Mon Sep 17 00:00:00 2001 From: cspotcode Date: Fri, 26 May 2023 10:39:30 -0400 Subject: [PATCH 6/6] Eliminate remaining pyright errors --- arcade/cache/texture.py | 4 ++-- arcade/gui/widgets/dropdown.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arcade/cache/texture.py b/arcade/cache/texture.py index 3df7e83a26..b45a121998 100644 --- a/arcade/cache/texture.py +++ b/arcade/cache/texture.py @@ -91,13 +91,13 @@ def put( name = texture.cache_name if strong: self._strong_entries.put(name, texture) - if self._strong_file_entries.get(file_path): + if self._strong_file_entries.get(file_path): # type: ignore # pending https://github.com/pythonarcade/arcade/issues/1752 raise ValueError(f"File path {file_path} already in cache") if file_path: self._strong_file_entries.put(str(file_path), texture) else: self._weak_entires.put(name, texture) - if self._weak_file_entries.get(file_path): + if self._weak_file_entries.get(file_path): # type: ignore # pending https://github.com/pythonarcade/arcade/issues/1752 raise ValueError(f"File path {file_path} already in cache") if file_path: self._weak_file_entries.put(str(file_path), texture) diff --git a/arcade/gui/widgets/dropdown.py b/arcade/gui/widgets/dropdown.py index 17d1982fed..480256f200 100644 --- a/arcade/gui/widgets/dropdown.py +++ b/arcade/gui/widgets/dropdown.py @@ -62,7 +62,7 @@ def __init__( # Setup button showing value self._default_button = UIFlatButton( - text=self._value, width=self.width, height=self.height + text=self._value, width=self.width, height=self.height # type: ignore # pending https://github.com/pythonarcade/arcade/issues/1799 ) self._default_button.on_click = self._on_button_click # type: ignore