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
Bootstraps type annotations #1069
Conversation
Nice, really happy that we are slowly adding type annotations. Let me know if I can help you somehow with annotating. I agreed with @psss that I will try taking a look at the paralelization of execute step for multihost so this is basically the first step. I was planning on annotating some of the modules, possibly refactoring some things on the way |
Great, thanks for starting work on this! |
Sure, I plan to ask a lot of questions while working on this, that would be extremely helpful :) My general plan is to bootstrap the annotations by adding the necessary infrastructure plus annotating a module, to test things do work as expected, then I would look into annotating a core module plus one of the steps plugins, to learn more about the internals, and after that, I'd consider things to be stable enough that anyone should be able to work on the rest of modules in pretty much any given order. Right now, in the beginning, I'd say the gradual approach is the safest bet, but once things settle and we'd learn how steps interact with core on this level, multiple people can work on different modules without running into conflicts. |
Rebased & updated. The last remaining piece of code not annotated is |
Rebased & updated, and I get zero errors locally. Open for review. What's missing? Actually running the test: I have a piece in And there are few unit tests failing, I suppose those are related to my changes, breaking rpm builds. |
interesting, some unit tests fail during koji build |
@happz pre-commit makes sense, it already runs via github actions anyway |
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.
The typing overall looks good to me, thanks for this work! Just some questions/requests for clarifications from me, otherwise not much else to add. I will try to help with typing more stuff once we merge this PR
/packit test |
I've spotted a couple of tests I probably cannot fix on my own:
Might be related to the fact |
Looks as too old python3-typing-extensions. Can be reproduced if one installs And |
This seems to be caused by a podman bug, the fix should be in production soon. |
@lukaszachy shall I add this somewhere into my patch? |
@happz IMO you could add dependency on typing-extensions>=3.7.4.3 I've created epel-8 bug to have it updated https://bugzilla.redhat.com/show_bug.cgi?id=2069579 |
I'm afraid I'll need more help. Should I add it? If so, where? Is |
IMO at two places:
We don't have requirements for pip packages (yet) |
Done both, didn't seem to have any effect. I tried to reproduce locally, with the help of tmt reproducer provided in TF logs, and error happens a bit sooner:
Why is Another point I don't understand is why is this happening when I got anywhere close to messing with nitrate or its tests? I'm not aware of changes affecting this area of code, is this really the only patch having troubles with tests on CentOS? And if so, what changes are causing those troubles? |
/packit test |
Two tests were failing because |
/packit build |
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.
Thanks a lot for kicking off the type annotations! It must have been a real patience exercise. At least it was for me ;-) And sorry for taking so long with the review. Overall looks good to me. Added just a couple of comments and committed a few minor adjustments in 68d9841.
Squashed and rebased. A couple of adjustments are needed for
Tried to fix the errors in e1ad5c6. @happz, please have a look. |
All look good to me with the exception of the I've found a couple of articles discussing how to annotate context managers correctly, e.g. https://peps.python.org/pep-0585/#implementation, my impression is the answer depends heavily on which Python version one needs to address. If |
Seems to be working fine with recent Pythons on Fedora but fails on
Ok, will add this. |
Tests passed, for
There is already a bug asking to add the package to @happz, what do you think? Shall we wait for |
Trying a conditional import and |
Works nicely! Only the spec file condition requires |
The patch contains basic infrastructure and annotates one hand-picked file, `tmt/utils.py`. Co-authored-by: Petr Šplíchal <psplicha@redhat.com>
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.
Everything looks good now! @happz, thanks a lot for kicking this off!
Cool, thanks for the review & final merging. And here we go... #1170 :) |
The patch contains basic infrastructure and annotates one hand-picked
file, tmt/utils.py.
Feel free to ignoreI just wanted to share the work, and save it in the repo for later. Adding annotations revealed a couple of patch-worthy issues, and my plan is to fix them in separate patches before dropping this patch with annotation on top of it. Therefore draft at this moment, and it will get more changes and rebases.