Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python format CI failures due to black && pyright package updates #14521

Merged
merged 5 commits into from
Feb 1, 2023

Conversation

pengwa
Copy link
Contributor

@pengwa pengwa commented Feb 1, 2023

Fix failures due to black && pyright package updates

Problem

In the passing 3 hours, all PRs have their Python lint CI failed. Many files are reported not well formatted. I believe this is due to updated black package did some changes. Also there is a pyright checking failure, after investigation it is due to pyright package upgrade.

Failure 1: "Lint Python" failure related to pyright:
Run jordemort/action-pyright@v1
Run $GITHUB_ACTION_PATH/script.sh
🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog
🔎 Running pyright with reviewdog 🐶 ...
  + npm exec --yes -- pyright@latest --outputjson --lib
  No configuration file found.
  pyproject.toml file found at /home/runner/work/onnxruntime/onnxruntime.
  Loading pyproject.toml file at /home/runner/work/onnxruntime/onnxruntime/pyproject.toml
  Assuming Python version 3.10
  Assuming Python platform Linux
  No include entries specified; assuming /home/runner/work/onnxruntime/onnxruntime
  stubPath /home/runner/work/onnxruntime/onnxruntime/typings is not a valid directory.
  Searching for source files
  Found 628 source files
  An internal error occurred while type checking file "/home/runner/work/onnxruntime/onnxruntime/tools/android_custom_build/build_custom_android_package.py": TypeError: Cannot read properties of undefined (reading 'paramType')
      at map (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7982:91)
      at Array.map (<anonymous>)
      at filterOverloadMatchesForAnyArgs (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7982:44)
      at validateOverloadsWithExpandedTypes (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7879:40)
      at validateOverloadedFunctionArguments (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:8138:32)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:8904:48)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:3699:39)
      at doForEachSubtype (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeUtils.ts:673:9)
      at expandSubtype (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:3692:13)
      at mapSubtypesExpandTypeVars (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:3723:13)
      at validateCallArguments (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:8768:28)
      at getTypeOfCall (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7374:36)
      at getTypeOfExpression (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:1022:30)
      at evaluateTypesForExpressionInContext (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:18807:21)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:866:13)
      at evaluateTypeForSubnode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:19042:9)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:865:16)
      at s.getTypeResult (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/timing.ts:40:20)
      at O.visitReturn (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:900:48)
      at O.visit (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:526:29)
      at O.visitNode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:933:21)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:915:37)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at forEach (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:924:22)
      at Array.forEach (<anonymous>)
      at O.walkMultiple (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:922:15)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:917:18)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at O._walkStatementsAndReportUnreachable (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:2450:18)
      at O.visitSuite (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:312:14)
      at O.visit (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:544:29)
      at O.visitNode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:933:21)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:915:37)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at O.visitFunction (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:638:18)
      at O.visit (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:442:29)
      at O.visitNode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:933:21)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:915:37)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at O._walkStatementsAndReportUnreachable (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:2450:18)
      at O.check (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:282:14)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:1353:29)
      at s.timeOperation (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/timing.ts:44:28)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:1350:45)
      at t.LogTracker.log (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/logTracker.ts:36:20)
      at t.SourceFile.check (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:1348:33)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:[11](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:12)[33](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:35):40)
      at t.LogTracker.log (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/logTracker.ts:36:20)
      at L._checkTypes (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:1103:33)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:577:30)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:646:20)
      at s.runWithCancellationToken [as timeOperation] (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/timing.ts:44:28)
      at L._runEvaluatorWithCancellationToken (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:2467:41)
      at L.analyze (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:541:21)
      at analyzeProgram (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/analysis.ts:52:33)
      at t.BackgroundAnalysisProgram.startAnalysis (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts:151:16)
      at Timeout._onTimeout (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/service.ts:1771:67)
      at listOnTimeout (node:internal/timers:559:17)
      at processTimers (node:internal/timers:502:7)
  Error performing analysis: TypeError: Cannot read properties of undefined (reading 'paramType')
      at map (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7982:91)
      at Array.map (<anonymous>)
      at filterOverloadMatchesForAnyArgs (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7982:44)
      at validateOverloadsWithExpandedTypes (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7879:40)
      at validateOverloadedFunctionArguments (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:8138:32)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:8904:48)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:3699:39)
      at doForEachSubtype (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeUtils.ts:673:9)
      at expandSubtype (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:3692:13)
      at mapSubtypesExpandTypeVars (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:[37](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:40)23:13)
      at validateCallArguments (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:8768:28)
      at getTypeOfCall (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:7374:36)
      at getTypeOfExpression (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:1022:30)
      at evaluateTypesForExpressionInContext (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:18807:21)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:866:13)
      at evaluateTypeForSubnode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:19042:9)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:865:16)
      at s.getTypeResult (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/timing.ts:40:20)
      at O.visitReturn (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:900:48)
      at O.visit (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:526:29)
      at O.visitNode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:933:21)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:915:37)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at forEach (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:924:22)
      at Array.forEach (<anonymous>)
      at O.walkMultiple (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:922:15)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:917:18)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at O._walkStatementsAndReportUnreachable (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:2450:18)
      at O.visitSuite (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:312:14)
      at O.visit (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:544:29)
      at O.visitNode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:933:21)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:915:37)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at O.visitFunction (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:6[38](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:41):18)
      at O.visit (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:442:29)
      at O.visitNode (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:933:21)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/parseTreeWalker.ts:915:37)
      at O.walk (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:303:19)
      at O._walkStatementsAndReportUnreachable (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:2450:18)
      at O.check (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/checker.ts:282:14)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:1353:29)
      at s.timeOperation (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/timing.ts:44:28)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:1350:45)
      at t.LogTracker.log (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/logTracker.ts:36:20)
      at t.SourceFile.check (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:1348:33)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:1133:[40](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:43))
      at t.LogTracker.log (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/logTracker.ts:36:20)
      at L._checkTypes (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:1103:33)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:577:30)
      at callback (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/typeEvaluator.ts:646:20)
      at s.runWithCancellationToken [as timeOperation] (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/common/timing.ts:44:28)
      at L._runEvaluatorWithCancellationToken (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:2467:[41](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:44))
      at L.analyze (/home/runner/.npm/_npx/fbb[43](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:46)b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/program.ts:541:21)
      at analyzeProgram (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/analysis.ts:52:33)
      at t.BackgroundAnalysisProgram.startAnalysis (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts:151:16)
      at Timeout._onTimeout (/home/runner/.npm/_npx/fbb43b1786f81b3f/node_modules/pyright/dist/pyright-internal/src/analyzer/service.ts:1771:67)
      at listOnTimeout (node:internal/timers:559:17)
      at processTimers (node:internal/timers:502:7)
  + true
  + python3 /home/runner/work/_actions/jordemort/action-pyright/v1/pyright_to_rdjson/pyright_to_rdjson.py
  Traceback (most recent call last):
    File "/home/runner/work/_actions/jordemort/action-pyright/v1/pyright_to_rdjson/pyright_to_rdjson.py", line 53, in <module>
      print(pyright_to_rdjson(sys.stdin))
    File "/home/runner/work/_actions/jordemort/action-pyright/v1/pyright_to_rdjson/pyright_to_rdjson.py", line 8, in pyright_to_rdjson
      pyright: Dict = json.load(jsonin)
    File "/usr/lib/python3.10/json/__init__.py", line 293, in load
      return loads(fp.read(),
    File "/usr/lib/python3.10/json/__init__.py", line 3[46](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:49), in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python3.10/json/decoder.py", line 3[55](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928568#step:9:58), in raw_decode
      raise JSONDecodeError("Expecting value", s, err.value) from None
  json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  + cleanup
  + '[' -n /tmp/tmp.o6rGAdR1LC ']'
  + '[' -d /tmp/tmp.o6rGAdR1LC ']'
  + rm -rf /tmp/tmp.o6rGAdR1LC
  Error: Process completed with exit code 1.
Failure 2: "Python format" failure related to "psf/black@stable":

Many files are reported not well formatted, an example:

--- /home/runner/work/onnxruntime/onnxruntime/onnxruntime/python/onnxruntime_inference_collection.py	2023-02-01 03:25:08.361480 +0000
+++ /home/runner/work/onnxruntime/onnxruntime/onnxruntime/python/onnxruntime_inference_collection.py	2023-02-01 03:25:23.6[28](https://github.com/microsoft/onnxruntime/actions/runs/4060639890/jobs/6989928837#step:4:30)466 +0000
@@ -103,11 +103,10 @@
     """
     This is the main class used to run a model.
     """
 
     def __init__(self):
-
         # self._sess is managed by the derived class and relies on bindings from C.InferenceSession
         self._sess = None
         self._enable_fallback = True
 
would reformat /home/runner/work/onnxruntime/onnxruntime/onnxruntime/python/onnxruntime_inference_collection.py
     def get_session_options(self):

Root causes

Failure 1. pyright publish new release 1.1.292 about 4 hourse ago.. https://www.npmjs.com/package/pyright?activeTab=versions. If we revert the version back to previous release 1.1.291, then this test pass.

Failure 2. black ublish its release few hours ago. https://pypi.org/project/black/#history
image

Fixes

Failure 1. Fixed the pyright to use previous release 1.1.291.

Failure 2. This PR firstly attempted to update all impacted files based on new version of black package offline. But we hit a throttling issue when calling format services :

{"severity":"ERROR","time":"2023-02-01T08:00:08.090158864Z","logging.googleapis.com/sourceLocation":{"file":"/home/runner/work/reviewdog/reviewdog/doghouse/server/github_checker.go","line":"45","function":"github.com/reviewdog/reviewdog/doghouse/server.(*checkerGitHubClient).UpdateCheckRun"},"message":"UpdateCheckRun failed: {\"message\":\"Invalid request.\\n\\nOnly 65535 characters are allowed; 89431 were supplied.\",\"documentation_url\":\"https://docs.github.com/rest/reference/checks#update-a-check-run\"}"}

So an alternative fix is done here, e.g. fix the version of the black package to previous release 22.12.0.

Would like to get some feedback from @justinchuby, feel free to make some change based on this to unblock other PRs.

Motivation and Context

@pengwa pengwa requested a review from justinchuby February 1, 2023 06:05
@pengwa pengwa changed the title draft - fix python lint due to wheel upgrade Fix failures due to black && pyright package updates Feb 1, 2023
@pengwa pengwa force-pushed the pengwa/update_black_format branch from 9255334 to 6b77b39 Compare February 1, 2023 07:52
@pengwa pengwa changed the title Fix failures due to black && pyright package updates Fix Python format CI failures due to black && pyright package updates Feb 1, 2023
Copy link
Contributor

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@justinchuby
Copy link
Contributor

I am working on #14306 . After which these pipelines will be removed and the linter versions will be pinned. So we should be protected from this in the future. Merging this to unblock other PRs.

@justinchuby justinchuby merged commit a1ed703 into main Feb 1, 2023
@justinchuby justinchuby deleted the pengwa/update_black_format branch February 1, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants