diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2022-07-20 08:45:47 +0200 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2022-08-06 09:39:39 +0200 |
commit | 2270b66d759f0a9c022576ce42fa5a770a754250 (patch) | |
tree | 3272a1c03551b96d70d0c05f8e0042e3c42a6517 /doc/languages-frameworks/python.section.md | |
parent | 6205cd64ddcc771f317cd3f400b31d1964041ac2 (diff) | |
download | nixpkgs-2270b66d759f0a9c022576ce42fa5a770a754250.tar nixpkgs-2270b66d759f0a9c022576ce42fa5a770a754250.tar.gz nixpkgs-2270b66d759f0a9c022576ce42fa5a770a754250.tar.bz2 nixpkgs-2270b66d759f0a9c022576ce42fa5a770a754250.tar.lz nixpkgs-2270b66d759f0a9c022576ce42fa5a770a754250.tar.xz nixpkgs-2270b66d759f0a9c022576ce42fa5a770a754250.tar.zst nixpkgs-2270b66d759f0a9c022576ce42fa5a770a754250.zip |
pythonPackagesExtensions: override all Python package sets at once
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 of "extensions" to `pythonPackagesExtensions`. 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.
Diffstat (limited to 'doc/languages-frameworks/python.section.md')
-rw-r--r-- | doc/languages-frameworks/python.section.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 7df8464917c..7fb8ba2e7c2 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1664,6 +1664,26 @@ self: super: { } ``` +### How to override a Python package for all Python versions using extensions? {#how-to-override-a-python-package-for-all-python-versions-using-extensions} + +The following overlay overrides the call to `buildPythonPackage` for the +`foo` package for all interpreters by appending a Python extension to the +`pythonPackagesExtensions` list of extensions. + +```nix +final: prev: { + pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ + ( + python-final: python-prev: { + foo = python-prev.foo.overridePythonAttrs (oldAttrs: { + ... + }); + } + ) + ]; +} +``` + ### How to use Intel’s MKL with numpy and scipy? {#how-to-use-intels-mkl-with-numpy-and-scipy} MKL can be configured using an overlay. See the section "[Using overlays to |