Skip to content

Commit

Permalink
Added a basic pyright config (#2610)
Browse files Browse the repository at this point in the history
### What

This PR adds a Pyright config file that makes Pyright somewhat useable,
at least for the purpose of checking our SDK's type support. For
example, with this config, the following command returns usable output:

```
$ pyright tests/python/test_api/main.py 
/Users/hhip/src/rerun/tests/python/test_api/main.py
  /Users/hhip/src/rerun/tests/python/test_api/main.py:388:20 - error: "imread" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:388:41 - error: "IMREAD_UNCHANGED" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:390:20 - error: "cvtColor" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:390:43 - error: "COLOR_BGRA2RGBA" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:392:19 - error: "cvtColor" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:392:42 - error: "COLOR_RGBA2RGB" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:394:20 - error: "cvtColor" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:394:42 - error: "COLOR_RGB2GRAY" is not a known member of module "cv2" (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:480:25 - error: "rec" is possibly unbound (reportUnboundVariable)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:487:22 - error: Object of type "Unbound" cannot be used with "with" because it does not implement __enter__ (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:487:22 - error: Object of type "Unbound" cannot be used with "with" because it does not implement __exit__ (reportGeneralTypeIssues)
  /Users/hhip/src/rerun/tests/python/test_api/main.py:487:22 - error: "rec" is possibly unbound (reportUnboundVariable)
12 errors, 0 warnings, 0 informations 
```
(Notably, no `rr`-related error :tada:)

I know, yet another top-level file. I tried very hard to move it to
`scripts/` or `rerun_py/pyproject.toml`, but I couldn't get it to work
properly and would always defaults to spamming hundreds of errors.


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2610) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2610)
- [Docs
preview](https://rerun.io/preview/pr%3Aantoine%2Fpyright-config/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Aantoine%2Fpyright-config/examples)
  • Loading branch information
abey79 authored Jul 6, 2023
1 parent 7647d68 commit fd78bdb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extraPaths": [
"rerun_py/rerun_sdk"
],

"exclude": [
"**/node_modules",
"**/__pycache__"
],

"ignore": [
"rerun_py/rerun",
"rerun_py/rerun_demo"
],

"defineConstant": {
"DEBUG": true
},

"venv": "venv",

"reportPrivateImportUsage": false
}

1 comment on commit fd78bdb

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: fd78bdb Previous: 7647d68 Ratio
mono_points_arrow/generate_message_bundles 36642786 ns/iter (± 970447) 28838573 ns/iter (± 858677) 1.27
mono_points_arrow/decode_message_bundles 74243315 ns/iter (± 891544) 57762100 ns/iter (± 951248) 1.29

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.