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 some type errors found with pyright #448

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

jacobtomlinson
Copy link
Member

@jacobtomlinson jacobtomlinson commented Jul 11, 2024

Exploring adding pyright and fixing up type errors. Perhaps this should replace mypy? Or be used alongside?

This PR started out as an exploration of adding pyright to our standard linting tooling, but ultimately ended up just fixing some type errors found by pyright as a one off. See #448 (comment) for info on why it wasn't added to pre-commit.

xref #428 #381

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 6 lines in your changes missing coverage. Please review.

Project coverage is 95.03%. Comparing base (87063fc) to head (e1adb0b).
Report is 123 commits behind head on main.

Files with missing lines Patch % Lines
kr8s/_objects.py 81.81% 4 Missing ⚠️
kr8s/_api.py 80.00% 1 Missing ⚠️
kr8s/_types.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
+ Coverage   94.61%   95.03%   +0.41%     
==========================================
  Files          29       30       +1     
  Lines        3141     3867     +726     
==========================================
+ Hits         2972     3675     +703     
- Misses        169      192      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jacobtomlinson
Copy link
Member Author

jacobtomlinson commented Jul 11, 2024

It looks like pyright doesn't currently work in pre-commit CI RobertCraigie/pyright-python#164.

There also seem to be some challenges with how pyright is packaged as it depends on a node package which gets installed at runtime, which seems a bit flaky.

Lastly, there seems to be some controversy between pyright and a fork called basedpyright. Seeing discussions like microsoft/pyright#8065 makes me apprehensive to use either project until some of the discussions reach a resolution.

Given all of this I think we should hold off adding full pyright linting here and just stick with mypy. But I'm still keen to merge the typing improvements that were made in this PR.

@jacobtomlinson jacobtomlinson changed the title Add pyright and fix errors Some some type errors found with pyright Jul 11, 2024
@jacobtomlinson jacobtomlinson merged commit 333d833 into kr8s-org:main Jul 11, 2024
11 checks passed
@jacobtomlinson jacobtomlinson deleted the pyright branch July 11, 2024 12:14
@jacobtomlinson jacobtomlinson changed the title Some some type errors found with pyright Fix some type errors found with pyright Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant