-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
buildPythonPackage: Add support for running tests in a separate derivation #272177
Conversation
I'm marking this as draft: Not because I don't think it's ready for review but because I think we need to have a discussion around the implications it has to remove python test running from the critical path in nixpkgs. |
I think it would be useful to introduce a convention such as |
I think if we introduce such a convention, and then update our |
92fc039
to
81d5779
Compare
81d5779
to
aa22c6d
Compare
4534349
to
f2f8a1f
Compare
f2f8a1f
to
c1df366
Compare
Rebased & marked ready for review. |
ced195f
to
936fe14
Compare
936fe14
to
37fe155
Compare
37fe155
to
b315c18
Compare
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 love it!
Considering the number of rebuilding packages, should this PR target the |
One thing I like about |
This is what I meant by:
I'm not sure what the fix for that is. |
My suggestion is that the derivation produced by this new implementation adds automatically some |
@adisbladis, would there be a chance to learn about the considerations behind closing this PR? I look forward to it, and many people approve of the idea. |
I have burnt out on trying to accomplish meaningful change in the nixpkgs Python infra and I'm spending all that energy towards pyproject.nix & it's builders instead. |
Description of changes
Introduces a new argument to
buildPythonPackage
calledseparateChecks
.A
passthru.tests.python
attribute is added where the tests are run separately from building the package.By removing check inputs from the main derivation we can drastically reduce build closures & reduce issues with circular dependencies.
For more motivations see the related tracking issue.
This work is a part of #272178.
Implications
With tests no longer running in the same derivation as the build it can be harder to find issues early.
OTOH debug cycles can be cut shorter as you don't need to wait for a package rebuild to find out that a test failed because it lacked networking access.
With tests running separately I expect iteration cycles to be quicker, once the new workflow has been adopted.
passthru.tests
is evaluated by OfBorg. Checks for nixpkgs contributions should be fine.It's possible we may want to add another Hydra attrset so it can find tests, or make Hydra smart enough to explore
passthru.tests
.In this PR only one derivation has been converted as a PoC. Locally I have converted many more and also found some issues.
This seems to work out fine for most pure Python packages, but Pandas was problematic. I think that particular issue is because of a bug in pytest that I will take a closer look at.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-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.