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
python3Packages.wxPython_4_0: remove unused dependencies #94108
Conversation
fwiw, in a failed attempt to get wxPython 4.1 to work for kicad, i copied the wxPython 4.0 package, checked the dependencies they listed for 4.1 and separated the ones not listed as a dependency there seems to be a fairly large overlap between those and the ones you removed |
@lopsided98 I’m not sure this is advisable. There indeed may be some unneeded packages but many of these are necessary. See https://github.com/wxWidgets/Phoenix#prerequisites |
Despite what the documentation says, the lack of a reference to them basically proves they are not actually used by our build. I don't see how this PR can cause any new problems due to missing dependencies (unless they are needed for Darwin), because those dependencies are already missing from the build output. Perhaps some configure flags or something else should be added to cause the build to actually make use of those dependencies, but that can be done in a different PR. |
I used diffoscope to compare the output with and without this PR (changing gstreamer 0.10 to 1.0 to make it eval), and there were no differences other than a different |
this PR fixes kicad's |
I added another commit that removes the |
@lopsided98 I expect that most of them are not statically linked. For example, without |
I'm not sure what you mean about static linking. This PR has no effect on the package output; I verified this with diffoscope. Therefore any potential problem like you describe already happens without this PR. |
for example, I expect It's actually quite rare that devs take the time to specify all the binary dependencies of python packages, and I trust their judgment more than ours for what is needed... |
Again, how can this start happening if there is no change to the package output? None of those dependencies are propagated, and even if they were that would show up as a change in the output because |
have you tried It does seem that you identified a bunch of packages that should be listed in If we want to go the route of removing dependencies that the devs say are necessary, proof isn't in the build succeeding but in the tests succeeding. If you remove libjpeg from buildInputs, then libjpeg.so.8 is not going to be found. My understanding is that packages put in buildInputs are also available at run-time. |
Yes, In Nix, the only thing that really matters is the output. No change in the output means no change in the dependencies that are available at runtime. 'buildInputs` are not available at runtime unless they are referenced by the output. As far as I can tell, the documentation seems to be listing the dependencies required to build both wxPython and wxGTK. wxGTK links against |
at least for wxPython 4.1, it seems like building the version of wxWidgets (wxGTK) they include with it is required |
@lopsided98 Really appreciate the help maintaining this package, but you are wrong about buildInputs. They are available at runtime. See
Also: test.nix:
The wxPython Phoenix (4.0==first phoenix release) team is very clear that these dependencies are for Phoenix:
|
That works in Nix has no concept of runtime dependencies other than those that are referenced by the output. No change in the output means no change in the runtime dependencies. |
Maybe @FRidh can resolve this debate. In python packages, are buildInputs available at runtime? |
@lopsided98 is indeed correct. If the output (using e.g. diffoscope) doesn't change when the libraries are removed, they are indeed not used at all. And That said, even though all these libraries are removed, some of them are still referenced and used, such as libjpeg:
and libtiff:
Maybe more. I think the best thing to do here is to figure out if wxPython's build would complain about missing libraries. Because if it does, then we don't have to worry, since the build here passes and can therefore find all necessary libraries. |
I can also confirm that diffoscope doesn't show any significant changes before and after this PR, so this is essentially just a code cleanup that can't break anything. But I say let's take this opportunity to verify the package still works and has all deps it needs. |
Huh, ok sounds like I am indeed wrong! Thank you both for educating me. I did not realize that Nix would not make the buildInputs available at runtime if the hash does not appear in the output. This actually explains a lot of problems in the Python and Julia ecosystem that rely on various versions of wxPython itself uses find_library several times: https://github.com/wxWidgets/Phoenix/search?q=find_library So apologies for mistakenly opposing these changes, I understand now why it doesn’t make it any worse off, but it does highlight for me that some of these libraries may indeed still be runtime dependencies that we are missing. |
I looked into enabling the tests, but ran into various tooling related errors. I also tried I don't really have time to look into fixing the tests. This was supposed to be a quick and safe fix to unbreak a relatively important dependency, so I would like to get it merged without making it more complex than it needs to be. |
python by default will add the $PWD to |
I think it would be a good idea to make sure this package works before unbreaking it (even if just indirectly). |
4a8bc11
to
bfa448d
Compare
I ran the demo application included in the source and everything seemed to work. I did notice that some more dependencies were listed in the |
I'd love to see this PR being merged (or something being done to get wxpython4 working again)! |
The package contains no references to many of its declared dependencies, and the build succeeds without them.
This was inherited from wxPython 3 and does not seem to be necessary.
…tion This was causing programs to be wrapped twice, as wrapping occurs automatically during the fixup phase.
bfa448d
to
7f15e31
Compare
After some more thought, I decided to remove my last change (adding the propagated dependencies from I believe this PR is ready to be merged. |
I guess we can always add more deps later if needed. This does at least unbreak the package partially for now |
I'm confused, was this supposed to add I'm building an application where in one of the phases |
Those packages were the ones I was talking about here: #94108 (comment). I initially added them, then removed them from |
https://github.com/wxWidgets/Phoenix/blob/64e5d863f7833f10df6a0fbcf3221a730562224b/requirements/install.txt appears to impose runtime requirements for |
They should probably be added, I just decided they were out of scope for this PR since they didn't seem to be needed by any dependents at the time. |
Hm. https://discuss.wxpython.org/t/does-wxpython-4-0-6-must-also-install-numpy/32969/2 I also don't quite understand why no one has run into the issue of pip doesn't seem to provide any sane way of excluding deps pypa/pip#3090 , so I probably need to use some sort of indirect method if I deem them unnecessary. Well, Robin (discuss.wxpython.org link above) does list The concrete example of these deps attempting to be pulled is this: f33d2a5#diff-9e9c51bfcf7e9562777c9c8d1b946f5a61995d0947955d188c7f1fc5b9a4c5c0R27 When run you get:
I'm entirely unsure what the best thing to do here is. (Where does one find a list of these optional dependencies?) related: wxWidgets/Phoenix#1932 |
Hi @RobinD42 , can you maybe clarify the dependency situation with Specifically I would appreciate clarification on
in relation to https://discuss.wxpython.org/t/does-wxpython-4-0-6-must-also-install-numpy/32969/2 . wxWidgets/Phoenix#1932 is already asking to make these dependencies optional, and they seem to have done a little work looking at what's needed where.
From a practical point of view, adding dependencies seems to be easier than removing them. - which contravariantly, means that the requirement should be removed from upstream. |
I've filed #127768 , so I think any additional discussion should go there. |
Motivation for this change
wxPython_4_0
is currently broken because GStreamer 0.1 is broken.wxPython_4_0
apparently supports GStreamer 1.0, but looking closer at the package, I realized that the GStreamer dependency, along with many others, are not actually used.The build still succeeds even after removing many of the dependencies, and there is no way they are needed at runtime because the package retains no references to them.
I also re-enabled format hardening, because that appears to have been unnecessarily inherited from wxPython 3, and the build still succeeds.
I have not tested this on macOS.
cc @FRidh @tbenst @evils
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)