Skip to content
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: Add overrideAttrs attribute aliasing overridePythonAttrs #82772

Closed
wants to merge 2 commits into from

Conversation

adisbladis
Copy link
Member

@adisbladis adisbladis commented Mar 17, 2020

Motivation for this change

This will make lib.makeOverridable use overridePythonAttrs by default.

Overriding Python packages has some surprising properties unless you use overridePythonAttrs and it can be incredibly frustrating to try and find out why that is.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This will make lib.makeOverridable use overridePythonAttrs by default.
@adisbladis
Copy link
Member Author

@FRidh What kind of tests do you have in mind?

@FRidh
Copy link
Member

FRidh commented Mar 17, 2020

Testing that buildPythonPackage is indeed invoked again. One way to assert this is by adding to propagatedBuildInputs and testing it has an affect on requiredPythonModules, which serves as input to python.buildEnv.

@FRidh
Copy link
Member

FRidh commented Mar 17, 2020

cc @alyssais because of #46842.

That discussion was already a year and a half ago...time flies.

@adisbladis
Copy link
Member Author

@FRidh I added a test. Since it's not actually building anything but only asserts attributes I made a new type of test.

@FRidh
Copy link
Member

FRidh commented Mar 17, 2020

@GrahamcOfBorg build python2.tests python3.tests python38.tests

@FRidh
Copy link
Member

FRidh commented Mar 17, 2020

@GrahamcOfBorg build pypy2.tests pypy3.tests

@FRidh
Copy link
Member

FRidh commented Mar 17, 2020

Let's wait a bit with merging this.

@alyssais
Copy link
Member

@FRidh yiu don’t think this needs an RFC any more?

@FRidh
Copy link
Member

FRidh commented Mar 17, 2020

Right, I wrote that. I do think it is best we standardize interfaces like these and I see you asked matthewbauer at the time to help with it. Let's write a small RFC and see where that takes us.

@FRidh
Copy link
Member

FRidh commented Mar 17, 2020

RFC proposal #46842 (comment)

FRidh added a commit that referenced this pull request Apr 26, 2020
…oCheck (#86051)"

For disabling tests when overriding, use `.overridePythonAttrs`.

Discussion about aliasing `.overridePythonAttrs` to `.overrideAttrs`.
#82772

This reverts commit 3581287.
@infinisil
Copy link
Member

Not sure about this, because we already have a bunch of override mechanisms which all work slightly differently. And by doing this it gets even more complex because it mixes ones name with anothers behavior. But then again, python packages accept pretty much all arguments of mkDerivation and juts forward them, so .overrideAttrs would mostly still behave the same for mkDerivation argument overrides. But still, I feel like this is going in the wrong direction of mixing concepts.

@adisbladis
Copy link
Member Author

Closing, see NixOS/rfcs#67.

@adisbladis adisbladis closed this Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants