diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/languages-frameworks/python.section.md | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 4d6dd876abd1..d171e8419188 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1190,11 +1190,12 @@ following are specific to `buildPythonPackage`: variables which will be available when the binary is run. For example, `makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`. * `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this - defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications - to `""`. + defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications to `""`. * `pipInstallFlags ? []`: A list of strings. Arguments to be passed to `pip install`. To pass options to `python setup.py install`, use `--install-option`. E.g., `pipInstallFlags=["--install-option='--cpp_implementation'"]`. +* `pipBuildFlags ? []`: A list of strings. Arguments to be passed to `pip wheel`. +* `pypaBuildFlags ? []`: A list of strings. Arguments to be passed to `python -m build --wheel`. * `pythonPath ? []`: List of packages to be added into `$PYTHONPATH`. Packages in `pythonPath` are not propagated (contrary to `propagatedBuildInputs`). * `preShellHook`: Hook to execute commands before `shellHook`. @@ -1249,6 +1250,27 @@ with import <nixpkgs> {}; in python.withPackages(ps: [ ps.blaze ])).env ``` +The next example shows a non trivial overriding of the `blas` implementation to +be used through out all of the Python package set: + +```nix +python3MyBlas = pkgs.python3.override { + packageOverrides = self: super: { + # We need toPythonModule for the package set to evaluate this + blas = super.toPythonModule(super.pkgs.blas.override { + blasProvider = super.pkgs.mkl; + }); + lapack = super.toPythonModule(super.pkgs.lapack.override { + lapackProvider = super.pkgs.mkl; + }); + }; +}; +``` + +This is particularly useful for numpy and scipy users who want to gain speed with other blas implementations. +Note that using simply `scipy = super.scipy.override { blas = super.pkgs.mkl; };` will likely result in +compilation issues, because scipy dependencies need to use the same blas implementation as well. + #### Optional extra dependencies {#python-optional-dependencies} Some packages define optional dependencies for additional features. With @@ -1468,6 +1490,10 @@ are used in `buildPythonPackage`. - `flitBuildHook` to build a wheel using `flit`. - `pipBuildHook` to build a wheel using `pip` and PEP 517. Note a build system (e.g. `setuptools` or `flit`) should still be added as `nativeBuildInput`. +- `pypaBuildHook` to build a wheel using + [`pypa/build`](https://pypa-build.readthedocs.io/en/latest/index.html) and + PEP 517/518. Note a build system (e.g. `setuptools` or `flit`) should still + be added as `nativeBuildInput`. - `pipInstallHook` to install wheels. - `pytestCheckHook` to run tests with `pytest`. See [example usage](#using-pytestcheckhook). - `pythonCatchConflictsHook` to check whether a Python package is not already existing. |