NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.87k stars 13.94k forks source link

PySide6 rebuilds Qt WebEngine #330736

Open emilazy opened 2 months ago

emilazy commented 2 months ago

…because, I think, it propagates its Python to the Qt build, even though there’s no reason those should need to be shared.

NickCao commented 2 months ago

Ah I always wondered why qtwebengine is build twice, thanks for solving the mystery! This is indeed some interesting design choice, why do we even have the python3Package.qt6 package set? It's not like that qt is exposing some python api?

NickCao commented 2 months ago

Ping @Majiir who introduced the override in https://github.com/NixOS/nixpkgs/commit/2f5f1647c36f08195b008f6d5e4418d4e8c3dc29

emilazy commented 2 months ago

Thanks for the pointer. The original PR says:

  • Added a pythonPackages.qt6 override so that qt6 modules using are built with the correct python version when a Python module (e.g. pyside6) is built with a different Python package (e.g. python311).

but I’m not sure I understand – isn’t the Python just used to run build tools for the Qt build? Does the Python version used “leak” to the outside in any way that matters?

NickCao commented 2 months ago

but I’m not sure I understand – isn’t the Python just used to run build tools for the Qt build?

AFAIK, yes.

Does the Python version used “leak” to the outside in any way that matters?

It does leak through propagated dependencies, whether that matters or not is another question.

emilazy commented 2 months ago

Hmm, why does it need to propagate Python if it’s solely a nativeBuildInput?

NickCao commented 2 months ago

Hmm, why does it need to propagate Python if it’s solely a nativeBuildInput?

Not by qt itself, but transitive dependencies.

nix why-depends --precise --all .#qt6.full .#python3 shows it hiding in a bunch of shebangs.

emilazy commented 2 months ago

Makes sense. Hopefully we can hear back from the original PR author about whether this is truly necessary or not. Letting the two Pythons coexist in the same dependency tree should be a core strength of Nix…

Atemu commented 2 months ago

Letting the two Pythons coexist in the same dependency tree should be a core strength of Nix…

Python throws a monkey wrench into that idea because it necessitates a rather widely-scoped PYTHONPATH for anything to work and you can't mix python versions in a single PYTHONPATH. It gets populated by propagated deps automagically because the PYTHONPATH must also include all transitive deps.

emilazy commented 2 months ago

Sure, but that shouldn’t matter if it’s just shebangs on scripts with their own hermetic PYTHONPATH, right?

Atemu commented 2 months ago

As long as it's hermetic, sure but if anything on the outside needs to depend on it, it no longer works.

emilazy commented 2 months ago

What I mean is, for scripts it should work fine because they manage their own PYTHONPATH, right? And since Python is just used for the WebEngine build, it shouldn’t be propagating any actual non‐script Python packages; everything it pulls in should be an application.

Majiir commented 2 months ago

On https://github.com/NixOS/nixpkgs/pull/247618 you can see that before I had made the qt6 change, I had seen build failures for python311Packages.pyside6 while python310Packages.pyside6 built fine. I then found that in the 3.11 case, some propagated build inputs were missing from PYTHONPATH. (See this Discourse thread.) To be honest, I don't fully understand all the implications of this change. Sorry I can't be more help.

NickCao commented 2 months ago

On #247618 you can see that before I had made the qt6 change, I had seen build failures for python311Packages.pyside6 while python310Packages.pyside6 built fine.

Doesn't seem to be an issue now

I then found that in the 3.11 case, some propagated build inputs were missing from PYTHONPATH. (See this Discourse thread.)

Some are still missing (namely libselinux), but at least the python version matches for the rest.