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
[reverted] python2 and python3: reproducible builds #107965
Conversation
After testing I did some reordering resulting in a mass rebuild. I have not tested this new commit (its ongoing). |
Non-optimized bytecode is now removed, which I think means I don't know which .pyc is actually picked up when bytecode is available for multiple optimization levels. |
find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i - | ||
find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i - | ||
find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i - | ||
find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python 2 stores optimized bytecode in .pyo and stores only one level, not two. Thus we need to choose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thrilled this indeed seems to make python reproducible. On the other hand, I can see how disabling the optimizations is painful (not sure about the stripping)...
I looked through this PR briefly, and I was wondering if it's possible to have the optimizations as a deterministic input. That would probably be a separate PR, though. Something like:
Honestly, I haven't looked enough into the python optimization process to know if this is possible, it just seemed like a best-of-both-worlds scenario. |
Result of 1 package built:
|
f19ad43
to
7f96fa7
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/what-are-your-goals-for-21-05/11559/4 |
I will go ahead with this soon, at least before 21.05. Need to make some minor changes, and add release notes and docs. |
|
1aba2fb
to
915a30f
Compare
Achieve reproducible builds of the interpreter. Note this meant disabling optimizations again.
915a30f
to
8883f85
Compare
@FRidh why is this in |
Because this has been reverted. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/why-is-the-nix-compiled-python-slower/18717/13 |
Achieve reproducible builds of the interpreter. Note this meant
disabling optimizations again that were introduced in #84072.
Motivation for this change
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)todo: