-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Visit the transforms before handling delayed assattr nodes #2453
base: main
Are you sure you want to change the base?
Conversation
My change made one test fail now:
I don't fully understand why, yet, but I think one option to make my change less invasive is to add "early transforms" and leave the original transforms in the old place. And then make brain_gi use the early transforms for the gi.require_version thing. Is that okay? |
Thank you for the MR. I agree with the proposed early transform, it feels like a big API decision but applying the transform twice so it's possible to apply transform after delayed attr creation is a lot worse. Let's hear another maintainer opinion before committing to it, it's not like I'm a brain expert myself. |
Have you also tried running the |
When running pylint test suite on plain main branch I got 12 failures already, but my change introduces 13th: I'll change my patch to not affect other brains. |
cde8a4d
to
6b4eb78
Compare
While at it, I've added also some basic test for brain_gi. |
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #2453 +/- ##
=======================================
Coverage 92.72% 92.73%
=======================================
Files 94 94
Lines 10993 11007 +14
=======================================
+ Hits 10193 10207 +14
Misses 800 800
Flags with carried forward coverage won't be shown. Click here to find out more.
|
When importing Gtk, it looks like this: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk It is vital that gi.require_version() is made before related 'from gi.repository import ...'. The brain_gi tries to do that using transforms. And it works unless Gtk is imported as part of delayed assattr handling. Fix this by adding early transforms that are called before delayed assattr. Fixes pylint-dev#2190 Fixes pylint-dev/pylint#6352
Just a simple one, that checks if the correct Gtk version gets installed. Note this test is checks for the linked regression only if both Gtk3 and Gtk4 are installed. Otherwise, it checks if brain_gi works at all.
So, the test I added doesn't run in CI (which also explain minimal test coverage of brain_gi.py). Is it worth installing "gi" python module + Gtk3 (and maybe Gtk4 too?) in there to make the test run? Or is it enough for it to run when called manually locally (assuming those dependencies are installed)? |
Yeah I don't think we want to add those dependencies to the CI. I do wonder if this warrants the API change. I can't really comment on that part (and I think most maintainers are a bit afraid of making such a decision). @Pierre-Sassoulas @jacobtylerwalls Do you have any opinions here? |
Yeah, I'm reluctant to add an early transforms API for this. We should consider alternatives:
|
Type of Changes
Description
When importing Gtk, it looks like this:
It is vital that gi.require_version() is made before related 'from gi.repository import ...'. The brain_gi tries to do that using transforms. And it works unless Gtk is imported as part of delayed assattr handling.
Fix this by handling transforms earlier.
Closes #2190
Closes pylint-dev/pylint#6352