-
-
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
Python: build wheels in separate derivation #170577
Comments
After 22.05 I want to pick up #102613 again and merge that. Once that is done, I will split the building and testing. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nixpkgss-current-development-workflow-is-not-sustainable/18741/75 |
Is it the intention to make all python builds follow the "anything-to-wheel, wheel to /nix/store" path? |
in Non-wheel builds are rare so I think it's best to keep them in the same derivation and indeed use wheels as artifacts to pass on. |
|
I highly doubt we have any flit packages left that are not yet compatible with pyproject and pip. We should get rid of that one. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/python-propagatedbuildinputs-could-we-do-better/29035/5 |
FWIW today I found another use case for this: python circular dependencies. Here you have an issue from the past where this was a problem for nix: mkdocstrings/mkdocstrings#376 Today I'm hitting it in other project. The truth is that it's not a problem for python resolvers because they split the build dependencies from the runtime ones. Thus, for building, it won't have circular dependencies; it's usually just setuptools, hatchling, poetry-core, etc. However, for runtime, circulars aren't a problem because all is already built, so you just have to put them all together in the same env. I guess splitting build and runtime deps in nixpkgs just like pypi does would let us safely support circular dependencies. |
A few thoughts:
We could possibly get rid of the idiom of We'd also not have to rebuild just because runtime deps change. This would mean far less rebuilds for Python going forward.
Shells looking like let
pkgs = import <nixpkgs> {};
inherit (pkgs) python3Packages;
in
pkgs.mkShell {
packages = [
python3Packages.requests
];
} are common, but are relying on a bad practice. The mechanism that makes Things like
passthru.dependencies = [
brotlicffi
certifi
charset-normalizer
idna
urllib3
];
passthru.optional-dependencies = {
security = [];
socks = [
pysocks
];
use_chardet_on_py3 = [
chardet
];
}; |
see #102613 |
Describe the bug
Perform wheel building and wheel installing in two separate derivations.
Additional context
Builds of Python wheels typically have only very few dependencies. When installing the wheel, wrapping needs to be done and propagated build inputs are added to the store resulting in a much larger closure.
By putting the building in a separate derivation, we can avoid rebuilds which is especially interesting for larger builds.
Related issue for tests #26400
The text was updated successfully, but these errors were encountered: