-
Notifications
You must be signed in to change notification settings - Fork 8
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
Drop unsupported Python versions from CI; add new stable versions. #49
Conversation
d07a0e7
to
bb4b803
Compare
This drops Python 3.5, 3.6, and 3.7 from the CI workflows, since they are all EOL. It adds 3.9, 3.10, and 3.11 as new versions we test against. Signed-off-by: Richard Xia <[email protected]>
bb4b803
to
a89a9af
Compare
Looks like this is still failing because we're not pinning our dependency versions in requirements.txt, and so it looks like mypy and/or pyparsing's type annotations are now stricter and causing us to fail type checking. I'm a little bit worried that this is going to a deeper rabbit hole than either @nick-knight's or my PRs cover, so I think at this point I'll defer the untangling of CI to someone else. |
It would appear that CI hasn't been run in a while! All four builds --- including 3.8, which was untouched by this PR --- are failing with the same error:
|
Also, this is fun: pyparsing's type annotations are incorrect. In the latest release, 3.1.0, that |
That's annoying... It seems easy enough to do: if cache_bound:
p.ParserElement.enable_packrat(cache_bound) Which seems to match the intent on our side. I'm trying to understand the other errors and what's changed. I guess once these are fixed, we should probably pin the dependency versions to their latest. |
Not 100% sure, but might need to replace When I add
|
Actually, I don't think that's equivalent. When you explicitly pass I'm not really sure if any of this is actually important for pydevicetree's functionality or performance, but it might be safest to just disable type checking on this file entirely. Presumably when this code and the CI tests were first written four years ago, pydevicetree did not provide type annotations yet, and therefore all of this would have been treated as untyped (the |
Yep, I found some examples in the docs for Forward that mention |
I think the other two errors are due to shadowing variables using values of new types. One rule of mypy is that you cannot reuse a variable if you want to assign something of a different type to it, even if you're done using the old value. E.g., the following is a type error: foo = 123
bar = foo + 1
foo = "hello" # This is a type error, since you are assigning a str to a variable of type int I bet you can fix the other two type errors by just giving the new variables new names. |
I think the first error should be resolved with EDIT: sounds like |
Ok, I'm happy to add I'm not sure what is going on with the
I'm not sure what happens (I know nothing about pyparsing until today). Versus:
Besides these typecheck errors, there are a boatload of lint and unit test failures ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this PR. I don't think it introduces any new bugs, and I'm not convinced that the type mismatches (now) being flagged by mypy
are actually problematic. (Obviously something needs to be done to (by)pass CI.)
I gave an approval of this PR just to see if I could merge, but it looks like master is restricted. I'm not sure who has access here; I don't have the Settings menu in the GitHub UI, so it might be by user? |
I don't have a Settings menu either. We'll need to either find someone who has Admin-level access to this repo, or Owner-level access to the organization. Even if we fixed all the type and lint issues, we still can't merge without finding an admin because the Python 3.5, 3.6, and 3.7 checks are still labeled as "required", so that admin would at least need to change the set of required checks. |
Here are the changes for mypy to pass, which I think is inline with what we've circled in on: #50. This can be merged into this branch, or whatever else, as necessary. I wanted to get them off my local machine. |
I also went ahead and opened an issue and filed a PR on pyparsing about the enable_packrat type annotation, since it seems straightforward. |
FYI- I tried this, but it seems the old (transitive) dependency on typed_ast doesn't compile on at least python 3.10. |
Ah, right. I think as @nick-knight pointed out in an internal Slack thread, |
As discussed offline, since we know have admin access to this repo, we're going to merge this and #48 by bypassing the CI checks, and we'll deal with getting CI healthy again later. |
This drops Python 3.5, 3.6, and 3.7 from the CI workflows, since they are all EOL. It adds 3.9, 3.10, and 3.11 as new versions we test against.