More import fixes for cx_freeze#1801
Conversation
|
CI says no 😆 looks like |
|
thanks for hte PR @fbordignon ... pyqtgraph has had some minor annoyances involving freezing applications such as cx_freeze and pyinstaller. Another one that gets me frequently is the use of template files: The freezing applications seem to miss these (due to how we handle their imports); so I'm definitely in support of making pyqtgraph a bit more robust in that regard. |
|
Yeah, I've just finished working around the missing template files: ... It will copy as .py files and not .pyc, but it works for now. |
|
Do you think it is Ok to include this hack into the cx_freeze example or is it too hacky? |
Sounds like par for the course here, I think that would be a welcome addition! I'm in the middle of trying to wrap up (and expand) PR 1796 so I'm not sure how much help I'll be with dealing with the CI errors this PR has caused for the coming days/week. |
|
I rebased master onto this branch; and I modified That said, freeze applications do need a way of knowing to grab stuff; and we shouldn't be dependent on on people tweaking hooks/config files to make sure they package correctly with greater ease. I do want to get this working a bit better, and I suspect there is a way we can do this w/o polluting the top level namespace too much. Actually, I'm curious if #1846 may have fixed this issue in general. @fbordignon could you try and verify it's still a problem based on the 0.12.2 release (or current master branch)? |
|
defining |
Hy @j9ac9k. thanks for the update. The master branch at a472f8c does not fix the issue. The error message when freezing the application still is: @ksunden, defining |
|
@fbordignon , is it actually necessary to import * from debug in order to make cx_freeze work again? Or is the main thing to ensure that there is an import in I think the point of #1846 was to more carefully consider what needs to be part of the main pg.(???) namespace and what can be called as pg.module.(???). The debug module comes with a huge number of functions/classes, but these would normally be used as e.g. But I don't know if that is enough to make cx_freeze happy. :) |
|
@fbordignon Thanks for following up. Can you provide some step-by-step instructions to replicate the issue as part of some minimum example? In case you need a dummy app to try and freeze, may I recommend using one of the examples? As I said, I am motivated to fix this, but I need to try and find a way of doing so without polluting the namespace. There is likely a solution here that will work for all cases. |
|
A possible alternate solution would be to use a single generated file (with a minor edit) usable for all bindings. The minor edit required would be changing from PyQt6 import QtCore, QtGui, QtWidgetsto: (number of dots varies) from ...Qt import QtCore, QtGui, QtWidgets |
|
I'm 100% on board with this
…On Tue, Oct 19, 2021 at 18:34 pijyoi ***@***.***> wrote:
A possible alternate solution would be to use a single generated file
(with a minor edit) usable for all bindings.
For that, the PyQt6 generated file is the only one that is suitable as it
is the only one that uses the long enum spellings.
The minor edit required would be changing
from PyQt6 import QtCore, QtGui, QtWidgets
to: (number of dots varies)
from ...Qt import QtCore, QtGui, QtWidgets
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1801 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE5Z7QEFMT7NFA2MO7QTQLUHYMA3ANCNFSM45NKNUTA>
.
|
Fixes pyqtgraph#1303 for windows
d862ec3 to
8e573d4
Compare
|
Turns out the original issue with cx_freeze and statements like Oops, I was testing the issue and accidentally pushed changes to SignalProxy.py as well. May not change anything but if needed I can revert it. |
|
Hi @fbordignon if I'm reading the PR and your comment right, the only diff you're proposing is removing this bit from |
|
Implementing this change would break things like... import pyqtgraph as pg
...
obj = pg.ThreadSafetimer()@outofculture you were using this very object in ACQ4, I imagine this change would impact you? @fbordignon does cx_freeze 6.8+ work w/ pyqtgraph as it is on master (or 0.12.3) as is? |
Yes it does. The removal I am proposing is only to revert the changes made on issue #1303 and completely optional. If it is to break something I think we can close this issue and do nothing. |
Cool, I'm leaning on closing this PR as things are working. Merging the change as-is could have some breakages I think as the previous change added an object to the namespace... but I'll wait to hear from people that actually use the ThreadSafeTimer to chime in 👍🏻 |
|
Hi @fbordignon I finally got ahold of some folks that I thought might be impacted by this PR, they gave it a thumbs up. I see we've created some merge conflicts for you. Would you mind if I resolved the conflicts and then merged this? |
|
@j9ac9k I just did, but I believe the changes I've proposed were on master already. Please close this PR without merging since the change that remains does nothing. |
|
I still see |
|
Ok, Maybe I messed things on the merge with master. I did not see I was overwriting the |
…freeze an app with cx_freeze
|
Yeah, the only change is that line now on the diff to master. It does not impact a lot because there is an all defined inside ThreadSafeTimer so I believe it is OK to leave it and do not merge. ThreadSafeTimer.py is fairly small anyways so no harm. The whole ordeal was me trying to merge imports defined at 6eeb0b5 from .debug import *
from .reload import *which were needed to freeze an app on a previous version of cx_freeze but were polluting the namespace. |
|
Sorry for the very delayed follow up; really appreciate your prompt responses. Please don't hesitate to reach out of pyqtgraph is not meeting some criteria regarding being frozen and such (or any other issue w/ the library) 👍🏻 |
|
Nothing to be sorry about, your responses were always on point. It is me that should be thanking you guys for such a great lib! |
Related to #1303 for windows. @berr was working on this and forgot to open a PR for the latest commit on his fork from last year. cx_Freeze is going strong.