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: introduce config.pythonPackageOverrides for proper overrides #40417

Closed
wants to merge 1 commit into from

Conversation

oxij
Copy link
Member

@oxij oxij commented May 13, 2018

The way it was done before didn't even really work because it inherited
top-level packageOverrides into python-packages.nix and top-level
packageOverrides has a different type.

This patch copies the way Haskell and R do the same thing.

  • Now it works.
  • Nothing changes if you don't use any overrides.
  • Fits CONTRIBUTING.md.

The way it was done before didn't even really work because it inherited
top-level `packageOverrides` into `python-packages.nix` and top-level
`packageOverrides` has a different type.

This patch copies the way Haskell and R do the same thing.
Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did not work?

The manual explains how a packageOverrides (which is indeed NOT the same as one may use for the top-level) can be passed into python. This does completely break the current documented and used way of overriding.

@oxij
Copy link
Member Author

oxij commented May 13, 2018 via email

@FRidh
Copy link
Member

FRidh commented May 13, 2018

I think in general it would be good if we have a similar UI for the different package sets. But, before actually doing that I am of the opinion we should have a RFC about what this UI ought to be. And I think before that also an RFC to define the scope of config and overlays in Nixpkgs.

Regarding the implementation. I personally dislike using config because its impure. Yet at the same time I recognize the simplicity it can offer. However, should config be used, or overlays?

TBH, now I feel like removing pkgs and moving buildEnv and withPackages passthrus from python derivations to python-packages.nix to make Python and Haskell infra match in usage completely in this regard (i.e., e.g. you would need to do python2Packages.pythonWithPackages arg instead of python2.withPackages arg).

At the time I added some of these attributes (pkgs and withPackages) to python, because I found it fits there better. But, in retrospect it might have indeed been easier to add them (withPackages and buildEnv) to the package set. With that in mind, I prefer not to make any more hasty changes.

@oxij
Copy link
Member Author

oxij commented May 13, 2018 via email

@FRidh
Copy link
Member

FRidh commented May 13, 2018

Sorry, but when somebody says "RFC" I can only hear "please, go away". Especially when the whole change is less than ten lines of code (duplicated four times because there are four almost identical python expressions).

At which point you might realize you forgot something and you want to again change your interface. Let's consider an example.

If you have some technical arguments against this style I'd like to hear them out. If you think we should fix Haskell infra instead, I'm would be ok with that. But if not I outlined why I prefer Haskell style above (it can express everything I can come up with and it is simpler).

I have no technical reason against using

overrides ? config.pythonPackageOverrides or (self: super: {})

except that, when we do a refactor, we should provide a simpler way to have multiple overrides of a sub package set, e.g. if I have an overlay A that changes pythonPackages, and an overlay B that does so as well, then I don't want it to remove the changes made by A.

I'd like to be able to do ...for everything I use

This is about the common interface. There are more package sets than Haskell and Python. We should also take those into account when designing said interface.

Btw, if we rewrite the whole nixpkgs into this style then you won't really need the config, because you could then just .override the top-level package set itself with something like

There you go. That is exactly the kind of thing to have an RFC for. To agree on a common direction. I'm pretty sure there will be lots of agreement so it could go fast.

@knedlsepp
Copy link
Member

I cannot currently get a layer of multiple overlays overriding python-packages to work. Only one layer of the python overrides is taken into account. Would this fix that?

@oxij
Copy link
Member Author

oxij commented Jun 22, 2018 via email

@mmahut
Copy link
Member

mmahut commented Aug 3, 2019

What is the status of this pull request?

@oxij
Copy link
Member Author

oxij commented Aug 19, 2019

This is a wontfix, I guess. Closing, though, IMHO, this is useful.

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

5 participants