buildPythonPackage, buildPythonApplication: make doCheck default less confusing#308377
Conversation
|
@ShamrockLee, thanks for this. Apologies if my confusion about around the Also: should this information about what ( |
|
I think this is the classic mistake of expecting the Example: # a.nix
{ a ? "foo" }@attrs:
attrs.a or "bar"When doing |
|
Here's the change that broke/changed the old default of |
|
We could also set |
I haven't inspect into the reason why it is enabled by default. The design choice has been made years ago. What I'm doing in this PR is to uncover it. Besides, defaulting
It would be great to explain them in the Nixpkgs Manual. However, I plan to propose setting it directly via |
Thanks a lot for finding it out! (#68244)
According to the documentation, |
Oh, I see. I didn't see that it was set by default. I expected it to be this way, because every place that mentions this config option has an |
|
Python tests have always been enabled because it is otherwise very hard to
judge during build time whether the package will work at all.
…On Sun, May 5, 2024, 01:44 Toma ***@***.***> wrote:
@TomaSajt <https://github.com/TomaSajt>
Here's the change that broke/changed the old default of false to true:
f7e28bf
<f7e28bf>
Thanks a lot for finding it out! (#68244
<#68244>)
We could also set config.doCheckByDefault or true as the default, so that
it starts respecting the config value again. This should not cause
rebuilds, unless you have the config set to false, but then you're
probably always expecting massive rebuilds anyway.
According to the documentation
<https://nixos.org/manual/nixpkgs/unstable/#opt-doCheckByDefault>,
config.doCheckByDefault is "default to false", and "changing the default
may cause a mass rebuild." AFAIK, it is unexpected for doCheckByDefault =
false to cause rebuild.
Oh, I see. I didn't see that it was set by default.
I thought the docs would be something like: "either set this to true/false
to force it to be true/false, or don't set it to leave the choice to the
builder helpers".
—
Reply to this email directly, view it on GitHub
<#308377 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQHZ3Y22OESB5N55DNN4CLZAVXFNAVCNFSM6AAAAABHCTZE5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUGUYDGMJZGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
afh
left a comment
There was a problem hiding this comment.
With the information provided and my current understanding, I support this change. Someone more knowledgable may disagree and hopefully they decide to speak up and share their insight.
Thank you for putting this together, @ShamrockLee, much appreciated! And thank you everyone else for chiming in with your expertise.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
@JohnRTitor would you be willing to lend your expertise for review and if acceptable merge this PR? |
There was a problem hiding this comment.
| doInstallCheck = doCheck; | |
| doInstallCheck = attrs.doCheck; |
Could you clarify this with attrs?
I think it is confusing since there is a doCheck = false right above it.
There was a problem hiding this comment.
Can't test it right now, but IIRC if we use the @attrs pattern, the defaults set with ? will not be applied when accessing through attrs.
There was a problem hiding this comment.
Could you clarify this with
attrs?
attrs does not consider the default value given by the set pattern of the build helper. It would be confusing to set a default value in the set pattern ({ doCheck ? true, ... }) but shadow it with another default when accessing (doInstallCheck = attrs.doCheck or true).
There was a problem hiding this comment.
Hmmm, indeed, attrs seems to be empty, as @TomaSajt pointed out at the beginning.
Then I think attrs.doCheck or true would be easier to understand.
The confusion was originally caused by the fact that the argument, doCheck, actually evaluates to true even though it defaults to false, right?
Do we need to change this here?
There was a problem hiding this comment.
Hmmm, indeed,
attrsseems empty, as @TomaSajt pointed out at the beginning. Then I thinkattrs.doCheck or truewould be easier to understand.
It still shadows the default set by the set pattern, but it sounds like an acceptable trade-off, considering the increased readability.
IMO, the root cause of the readability issue is the choice to specify the doInstallCheck attribute with the doCheck argument. In subsequent PR, I propose unifying the name (as doInstallCheck).
There was a problem hiding this comment.
This comment explains what it does, but I don't think it's necessary because it's just what the code says.
ced9eeb to
60cfc1e
Compare
Modify the set pattern to hint developers that the doInstallCheck attribute of Python packages, specified by the doCheck argument of buildPythonPackage and buildPythonApplication, defaults to true instead of false.
60cfc1e to
455314a
Compare
|
I just rebased it onto the tip of the |
natsukium
left a comment
There was a problem hiding this comment.
Thanks for improving this. LGTM
|
Thanks for merging. I created another PR #324124 proposing directly taking the |
| , meta ? {} | ||
|
|
||
| , doCheck ? config.doCheckByDefault or false | ||
| , doCheck ? true |
There was a problem hiding this comment.
It's a bit late now, but I think this fix was not the one that needed to happen, since doCheck never gets used.
Only attrs.doCheck is ever referenced, which doesn't need this line.
| , doCheck ? true |
Should we open another PR that just removes this line?
There was a problem hiding this comment.
Ah, yes. Removing this line from the set pattern is a better solution to such confusion.
Description of changes
Make it clear that argument doCheck of buildPythonPackage and buildPythonApplication defaults to true instead of false.
(For context, see #307838 (comment))
The current implementation of
mk-python-derivation.nixappears to defaultdoCheckconfig.doCheckByDefault or false, but effectively default ittrue.This PR resolves such confusion:
Another confusion caused by argument
doCheckdetermining attributedoInstallCheckshould be resolved by instructing people to specifydoInstallCheckinstead ofdoCheckandinstallCheckPhaseinstead ofcheckPhase. That's a change of interface that needs more discussion, and is excluded from the scope of this PR.This PR is a back-portable fix that brings no interface changes and no rebuilds.
Cc: @FRidh @afh
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.