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

pythonPackagesOverrides: override all Python package sets at once #91850

Open
wants to merge 1 commit into
base: master
from

Conversation

@FRidh
Copy link
Member

FRidh commented Jun 30, 2020

Python package sets can be overridden by overriding an interpreter
and passing in packageOverrides = self: super: {...};. This is fine
in case you need a single interpreter, however, it does not help you when
you want to override all sets.

With this change it is possible to override all sets at once by appending
a list a list of "overlays" to pythonPackagesOverrides.

From reading the implementation you might wonder why a list is used, and not
lib.composeExtensions? The reason is the latter requires knowledge of
the library function. This approach should be easier for most users
as it is similar to how we append to lists of e.g. inputs or patches
when overriding a derivation.

Motivation for this change
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.
@FRidh FRidh requested a review from jonringer as a code owner Jun 30, 2020
@FRidh FRidh requested review from Infinisil and alyssais Jun 30, 2020
@FRidh
Copy link
Member Author

FRidh commented Jun 30, 2020

I would still prefer to go via an RFC but I don't see that happening any time soon really.

Python package sets can be overridden by overriding an interpreter
and passing in `packageOverrides = self: super: {...};`. This is fine
in case you need a single interpreter, however, it does not help you when
you want to override all sets.

With this change it is possible to override all sets at once by appending
a list a list of "overlays" to `pythonPackagesOverrides`.

From reading the implementation you might wonder why a list is used, and not
`lib.composeExtensions`? The reason is the latter requires knowledge of
the library function. This approach should be easier for most users
as it is similar to how we append to lists of e.g. inputs or patches
when overriding a derivation.
@FRidh FRidh force-pushed the FRidh:pythonpackagesoverrides branch from 699e9ad to 6817787 Jun 30, 2020
@@ -9720,6 +9720,10 @@ in
pythonInterpreters = callPackage ./../development/interpreters/python {};
inherit (pythonInterpreters) python27 python35 python36 python37 python38 python39 python3Minimal pypy27 pypy36;

# Overrides applied to all Python package sets
pythonPackagesOverrides = [
(self: super: { })

This comment has been minimized.

Copy link
@Infinisil

Infinisil Jun 30, 2020

Member

This can just be an empty list

This comment has been minimized.

Copy link
@FRidh

FRidh Jul 2, 2020

Author Member

Correct. I added this here to show what kind of "type" is needed.

@Infinisil
Copy link
Member

Infinisil commented Jun 30, 2020

On one hand, I'd rather not have yet another override mechanism but make an RFC about it instead.
On the other hand, we already have so many override mechanisms, one more won't hurt ¯_(ツ)_/¯

So eh, I'm about 50/50 on doing this.

@jonringer jonringer mentioned this pull request Jul 4, 2020
4 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.