pyside6-rcc generating different output on different PCs
-
Hi,
I've got a project using PySide6 6.8.2.1 that is generating a different output on two PCs for the resources.qrc file once it's compiled using pyside6-rcc.
Both PCs running Windows 11, Python 3.12.9 & virtual environments installed using the same requirements.txt file and viewing the same commit hash.
The different is only in the "qt_resource_struct" byte array that is part of the "resources_rc.py" file and only 3 bytes are different.
This issue was present when using python 3.12.5 & PySide6 6.7.3 as well, I updated everything as part of my attempts to resolve.
Anyone got any thoughts?
Thanks in advance
-
@james0807 said in pyside6-rcc generating different output on different PCs:
Wouldn't that mean everything needs to be re-compiled locally whenever a change is made to a .ui file?
Yes, they needs to be generated again, but you always have to recompile after a change in ui file whether you store the generated files in your repo or not doesn't matter. It's like with C++ code: if you change something you have to recompile and you do not store generated object files in your repo.
-
@james0807 Why is this a problem?
-
Well... files are changing per commit depending on which PC compiles the file, which is an annoyance. I'm also unsure if the different output is expected behaviour or an indication that something is wrong behind the scenes.
I'm also intrigued that the compilation appears to not be deterministic.
-
@james0807 Generated files should not be commited.
"I'm also intrigued that the compilation appears to not be deterministic" - this is usually the case, even with C/C++ compilers. There are many things playing a role here, like timestamps.
-
@jsulm Interesting!
So *_ui.py should be in my gitignore?
Wouldn't that mean everything needs to be re-compiled locally whenever a change is made to a .ui file?
Appreciate your help here by the way, I wasn't aware those python output files were not intended to be version controlled.
-
@james0807 said in pyside6-rcc generating different output on different PCs:
Wouldn't that mean everything needs to be re-compiled locally whenever a change is made to a .ui file?
Yes, they needs to be generated again, but you always have to recompile after a change in ui file whether you store the generated files in your repo or not doesn't matter. It's like with C++ code: if you change something you have to recompile and you do not store generated object files in your repo.
-
Interesting. In C++ though you generally aren't generating .cpp files, whereas in the python case the output of the compiler are .py files, making not including them less trivial.
the PySide6-uic output is deterministic, it only seems to be rcc that has this behaviour I guess because it's embedding the resources themselves.
Thank you for your help!
-
-
Hi,
It's a bit more complicated than that.
On the C++ side, you have a bit more project management and there uic is run automatically and generates code that does not need to be stored in the repository.
With Python, you usually don't have such automated process which means that people often check-in the generated py files because they don't take the "do not edit this file" section to the letter.As you have seen, Qt uses several code generation tools whether for C++ or Python. While they have compiler in the name, they do not act as compilers in the gcc, clang, etc. sense. They rather compute a language specific output from an initial source that can then be compiled (c++) or loaded by an interpreter (Python).
-
We actually provide a tool,
pyside6-project , which defines a simple project file format and can do these steps automatically and can also be opened in Qt Creator.