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

Improve typing experience with CI #1516

Closed
victorlin opened this issue Jul 2, 2024 · 4 comments · Fixed by #1517
Closed

Improve typing experience with CI #1516

victorlin opened this issue Jul 2, 2024 · 4 comments · Fixed by #1517
Assignees

Comments

@victorlin
Copy link
Member

Discussion on Slack.

@genehack
Copy link
Contributor

genehack commented Jul 2, 2024

Not to balloon the scope here, but if we're gonna change how we're handling typing in the CI, maybe it's time to re-assess why we're running both mypy and pyright in the test suite?

@victorlin
Copy link
Member Author

victorlin commented Jul 2, 2024

Well right now we haven't configured Pyright to check types at all:

"reportGeneralTypeIssues": false,

Even if/when we enable that option, is one strictly a subset of the other? Based on Pyright's comparison, it looks like each has its pros and cons.

@genehack
Copy link
Contributor

genehack commented Jul 2, 2024

i guess i don't see what this is improving. if the mypy test fails during CI for a particular python version, doesn't that indicate potential runtime issues with that particular python version? isn't surfacing that during CI beneficial?

@victorlin
Copy link
Member Author

Apologies, the reasoning should have been in the issue description. This is what I think happened with @jameshadfield yesterday in #1506:

  1. He pushed a3615ee and saw ❌ on a Python 3.10 job. Clicking that shows:

    tests/test_mypy.py::test_mypy augur/curate/rename.py:84: error: Invalid type: try using Literal[False] instead?  [valid-type]
    Found 1 error in 1 file (checked 74 source files)
    FAILED
    
  2. He fixed that in force-push to 1671cdb and saw ❌ on a Python 3.8 job. Clicking that shows:

    tests/test_mypy.py::test_mypy augur/curate/rename.py:30: error: "list" is not subscriptable, use "typing.List" instead  [misc]
    augur/curate/rename.py:30: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
    augur/curate/rename.py:52: error: "list" is not subscriptable, use "typing.List" instead  [misc]
    augur/curate/rename.py:52: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
    augur/curate/rename.py:52: error: "tuple" is not subscriptable, use "typing.Tuple" instead  [misc]
    augur/curate/rename.py:84: error: X | Y syntax for unions requires Python 3.10  [syntax]
    augur/curate/rename.py:84: error: "list" is not subscriptable, use "typing.List" instead  [misc]
    augur/curate/rename.py:84: error: "tuple" is not subscriptable, use "typing.Tuple" instead  [misc]
    Found 8 errors in 1 file (checked 74 source files)
    FAILED
    

Had he clicked a Python 3.8 job the first time around, he would have seen all the errors to fix:

tests/test_mypy.py::test_mypy augur/curate/rename.py:30: error: "list" is not subscriptable, use "typing.List" instead  [misc]
augur/curate/rename.py:30: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
augur/curate/rename.py:52: error: "list" is not subscriptable, use "typing.List" instead  [misc]
augur/curate/rename.py:52: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
augur/curate/rename.py:52: error: "tuple" is not subscriptable, use "typing.Tuple" instead  [misc]
augur/curate/rename.py:84: error: Invalid type: try using Literal[False] instead?  [valid-type]
augur/curate/rename.py:84: error: X | Y syntax for unions requires Python 3.10  [syntax]
augur/curate/rename.py:84: error: "list" is not subscriptable, use "typing.List" instead  [misc]
augur/curate/rename.py:84: error: "tuple" is not subscriptable, use "typing.Tuple" instead  [misc]
Found 9 errors in 1 file (checked 74 source files)
FAILED

but that's not very obvious from the GitHub UI since all Python 3.8 jobs were marked "canceled".

We really only care about mypy errors from the Python 3.8 job, so those should the only ones reported.

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 a pull request may close this issue.

2 participants