-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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, buildPythonApplication: support __structuredAttrs = true
#347194
base: staging
Are you sure you want to change the base?
buildPythonPackage, buildPythonApplication: support __structuredAttrs = true
#347194
Conversation
f3bee93
to
46f8c8a
Compare
Questions: When passing
|
Thanks for working on this! I intend to review this PR, but will not have much time the next two weeks. |
46f8c8a
to
38943f3
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.
This is not a full review, but it should be enough for a first iteration.
Most importantly I have not touched the question on how to deal with the compatibility things, yet, aside from giving a few more generic thoughts on the matter.
Maybe we can split some of the uncontroversial changes off (everything independent of compatHelpers) and merge separately?
pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh
Outdated
Show resolved
Hide resolved
pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh
Outdated
Show resolved
Hide resolved
pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh
Outdated
Show resolved
Hide resolved
pkgs/development/interpreters/python/hooks/setuptools-rust-hook.sh
Outdated
Show resolved
Hide resolved
pkgs/development/python-modules/meson-python/add-build-flags.sh
Outdated
Show resolved
Hide resolved
01ac9f7
to
ae62db1
Compare
There used to be a lot of
When We should not rely on such implementation detail of |
Thank you for reviewing!
I'll split the easier part into another PR after we reach a consensus about how to add elements to |
I wasn't aware of that PR. I see that doing the same for the last remaining |
Oops! My bad.
I'll gather them into the same commit. Update: Applied. |
21c6d04
to
9f8fa39
Compare
Ah, interesting. How about we change the existence check to only throw an error if no glob is present? So globbed paths go through unchecked, while unglobbed paths are checked. |
Sounds great! However, it's challenging to differentiate globbed paths from unglobbed ones. Formally speaking, we are trying to detect if a glob matches and only matchs a path identical to itself when an infinite set of paths is tried. |
Uhm, I thought we'd just check whether a literal |
Searching across the PyTest source code, I found that it uses the If we would like to, we could use the |
This implementation would assume:
|
That would be best, of course. |
Add flag pytestFlags as the new, conforming interface replacing pytestFlagsArray. Stop Bash-expanding disabledTests and disabledTestPaths. Handle disabledTestPaths with `pytest --ignore-glob <path>` to keep globbing support. Check if each path glob matches at least one path using the `glob` module from the Python standard library. Also make buildPythonPackage and buildPythonApplication stop escaping the elements of disabledTests and disabledTestPaths.
Handle flags with appendToVar and concatTo. Stop Bash-expanding elements of setupPyGlobalFlags and setupPyBuildFlags.
…ithout expecting Bash expansion
…expanding expection
…stically Take unittestFlags as the new and conforming interface. Keep unittestFlagsArray as is.
b213332
to
d19e36e
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 did the following:
- went through the PR line-by-line, except for a few nits the changes LGTM.
- found no remaining uses of
pytestFlagsArray
orunittestFlagsArray
in doc/*. - found no other
setupPyGlobalFlags
orsetupPyBuildFlags
depending on bash eval or passing spaces. - build some random python packages to confirm nothing is obviously broken.
- `disabledTests` and `disabledTestPaths` for `pytestCheckHook`. (`disabledTestPaths` used to be expanded twice before concatenation.) | ||
- `setupPyBuildFlags` and `setupPyGlobalFlags` for `setuptoolsBuildHook`. | ||
|
||
- `pytestFlags` and `unittestFlags` replaces `pytestFlagsArray` and `unittestFlagsArray` and become the new and conforming interface. |
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.
- `pytestFlags` and `unittestFlags` replaces `pytestFlagsArray` and `unittestFlagsArray` and become the new and conforming interface. | |
- `pytestFlags` and `unittestFlags` replace `pytestFlagsArray` and `unittestFlagsArray` and become the new and conforming interface. |
|
||
- `pytestFlags` and `unittestFlags` replaces `pytestFlagsArray` and `unittestFlagsArray` and become the new and conforming interface. | ||
|
||
- `pytestFlagsArray` and `unittestFlagsArray` are kept for compatibility purposes. They continue to be Bash-expanded before concatenated. Such compatibility layer would get removed in future releases. |
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.
- `pytestFlagsArray` and `unittestFlagsArray` are kept for compatibility purposes. They continue to be Bash-expanded before concatenated. Such compatibility layer would get removed in future releases. | |
- `pytestFlagsArray` and `unittestFlagsArray` are kept for compatibility purposes. They continue to be Bash-expanded before concatenated. This compatibility layer will be removed in future releases. |
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.
Merge conflict somewhere here on that file.
- `python3Packages.conda` now uses `__structuredAttrs = true`. | ||
|
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.
Since we don't expect any user-facing changes, I don't think this needs to be mentioned.
- `python3Packages.tensorflow` now uses `__structuredAttrs = true`. | ||
|
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.
Same here.
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.
This might break user-side overriding via overrideAttrs
. I'm unsure if we need to keep such interface stable anyway.
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.
Any change to a derivation could do so, depending on what you do. I'd say breaking override
deserves a note / deprecation etc, but breaking overrideAttrs
does not.
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.
tensorflow
points at the binary package now, but might point at the source-based one by release. Might be better to pick another test package. Agreed that it doesn't need release note.
FTR: I built conda and tensorflow successfully on x86_64-linux, when applying this set of patches on master. Let's fix the nits / docs / merge-conflict and merge this, I'd say. |
This PR refactors the setup hooks and
wrap.sh
that construct the two build helpers, makingbuildPythonPackage
andbuildPythonApplication
support both__structuredAttrs = true
andstructuredAttrs = false
.The representation of the flags attributes as shell/environment variables for most Python building setup hooks are now the same as
stdenv.mkDerivation
and other build helpers -- they are space-separated environment variables when__structuredAttrs = false
and Bash arrays when__structuredAttrs = true
, and are concatenated to the command without Bash-evaluation. The following behaviour changes are introduced during the conversion:The following flags are no longer Bash-expanded before concatenated to the command:
disabledTests
anddisabledTestPaths
forpytestCheckHook
. (disabledTestPaths
used to be expanded twice before concatenation.)setupPyBuildFlags
andsetupPyGlobalFlags
forsetuptoolsBuildHook
.pytestFlags
andunittestFlags
replacespytestFlagsArray
andunittestFlagsArray
and become the new and conforming interface.pytestFlagsArray
andunittestFlagsArray
are kept for compatibility purposes. They continue to be Bash-expanded before concatenated. Such compatibility layer would get removed in future releases.Almost all the refactored scripts are linted with ShellCheck, except
wrap.sh
, which I don't know how to lint correctly.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.