From 5842d1e6dd0b4095c93244907996757b02df2bd5 Mon Sep 17 00:00:00 2001 From: Jithin Bathula Date: Fri, 10 Apr 2026 17:12:42 +0800 Subject: [PATCH 1/3] feat: add pyright script for type checking with configuration --- bin/pyright.sh | 47 ++++++++++++++++++++++++++++++++++++++++++++++ pyrightconfig.json | 13 ++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100755 bin/pyright.sh diff --git a/bin/pyright.sh b/bin/pyright.sh new file mode 100755 index 0000000000..dbd8c3afac --- /dev/null +++ b/bin/pyright.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -e + +# Run from project root +# Non-zero exit code on fail + +# Resolve pyright command, then delegate with repo config. +if command -v uvx >/dev/null 2>&1; then + PYRIGHT_CMD_ARR=(uvx --from pyright pyright) +elif command -v pyright >/dev/null 2>&1; then + PYRIGHT_CMD_ARR=(pyright) +elif command -v npx >/dev/null 2>&1; then + PYRIGHT_CMD_ARR=(npx pyright) +else + echo "pyright not found. Install pyright, npm, or uvx." + exit 1 +fi + +PYRIGHT_EXTRA_ARGS_ARR=() +if [ -n "${PYRIGHT_EXTRA_ARGS:-}" ]; then + read -r -a PYRIGHT_EXTRA_ARGS_ARR <<< "$PYRIGHT_EXTRA_ARGS" +fi + +# Get the script directory and repo root +SCRIPT_DIR="$( cd "$( dirname -- "${BASH_SOURCE[0]}" )" && pwd )" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# Change to repo root +cd "$REPO_ROOT" + +# Check if specific files were passed as arguments +if [ $# -eq 0 ]; then + TARGET_ARGS=("graphistry") +else + TARGET_ARGS=("$@") +fi +CONFIG_ARGS=(-p pyrightconfig.json) + +echo "Running pyright..." +echo "Checking: ${TARGET_ARGS[*]}" + +"${PYRIGHT_CMD_ARR[@]}" --version +CMD=( "${PYRIGHT_CMD_ARR[@]}" "${PYRIGHT_EXTRA_ARGS_ARR[@]}" "${CONFIG_ARGS[@]}" ) +CMD+=( "${TARGET_ARGS[@]}" ) +"${CMD[@]}" + +echo "Pyright check completed!" diff --git a/pyrightconfig.json b/pyrightconfig.json index f22e6a2ea2..962d445a57 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -1,9 +1,20 @@ { + "include": [ + "graphistry" + ], "typeCheckingMode": "basic", "ignore": [], "reportArgumentType": "none", + "reportMissingImports": "none", + "reportMissingModuleSource": "none", "reportMissingTypeArgument": "none", "reportUnknownMemberType": "none", "reportIncompatibleMethodOverride": "error", - "exclude": [] + "reportPossiblyUnboundVariable": "warning", + "exclude": [ + "graphistry/tests", + "graphistry/_version.py", + "versioneer.py", + "**/graph_vector_pb2*" + ] } From 16c3f4e26191890bdcabd9a1b141822185e5ae19 Mon Sep 17 00:00:00 2001 From: Jithin Bathula Date: Sat, 11 Apr 2026 16:44:02 +0800 Subject: [PATCH 2/3] Address Codex Issue: Prefer local pyright before uvx network fetch --- bin/pyright.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/pyright.sh b/bin/pyright.sh index dbd8c3afac..f285a04f83 100755 --- a/bin/pyright.sh +++ b/bin/pyright.sh @@ -5,10 +5,10 @@ set -e # Non-zero exit code on fail # Resolve pyright command, then delegate with repo config. -if command -v uvx >/dev/null 2>&1; then - PYRIGHT_CMD_ARR=(uvx --from pyright pyright) -elif command -v pyright >/dev/null 2>&1; then +if command -v pyright >/dev/null 2>&1; then PYRIGHT_CMD_ARR=(pyright) +elif command -v uvx >/dev/null 2>&1; then + PYRIGHT_CMD_ARR=(uvx --from pyright pyright) elif command -v npx >/dev/null 2>&1; then PYRIGHT_CMD_ARR=(npx pyright) else From 078163e083a573d309a985c6d021572e4519c87b Mon Sep 17 00:00:00 2001 From: Jithin Bathula Date: Mon, 13 Apr 2026 12:02:59 +0800 Subject: [PATCH 3/3] fix: improve command resolution for pyright execution --- bin/pyright.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/pyright.sh b/bin/pyright.sh index f285a04f83..dd55503e60 100755 --- a/bin/pyright.sh +++ b/bin/pyright.sh @@ -5,14 +5,14 @@ set -e # Non-zero exit code on fail # Resolve pyright command, then delegate with repo config. -if command -v pyright >/dev/null 2>&1; then +if pyright --version >/dev/null 2>&1; then PYRIGHT_CMD_ARR=(pyright) -elif command -v uvx >/dev/null 2>&1; then +elif uvx --from pyright pyright --version >/dev/null 2>&1; then PYRIGHT_CMD_ARR=(uvx --from pyright pyright) -elif command -v npx >/dev/null 2>&1; then +elif npx pyright --version >/dev/null 2>&1; then PYRIGHT_CMD_ARR=(npx pyright) else - echo "pyright not found. Install pyright, npm, or uvx." + echo "pyright could not be executed via pyright, uvx, or npx." exit 1 fi