diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2022-02-25 14:09:41 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2022-02-25 14:09:41 +0100 |
commit | 1986bedcffc8f378a8bfe90e8225c9d5fcf69883 (patch) | |
tree | 48df423696e490a5b086b6e7b6ae61da20967d89 /doc/languages-frameworks | |
parent | 51ef95e6faa8efd644424dd72796e1bb9997983c (diff) | |
download | nixpkgs-1986bedcffc8f378a8bfe90e8225c9d5fcf69883.tar nixpkgs-1986bedcffc8f378a8bfe90e8225c9d5fcf69883.tar.gz nixpkgs-1986bedcffc8f378a8bfe90e8225c9d5fcf69883.tar.bz2 nixpkgs-1986bedcffc8f378a8bfe90e8225c9d5fcf69883.tar.lz nixpkgs-1986bedcffc8f378a8bfe90e8225c9d5fcf69883.tar.xz nixpkgs-1986bedcffc8f378a8bfe90e8225c9d5fcf69883.tar.zst nixpkgs-1986bedcffc8f378a8bfe90e8225c9d5fcf69883.zip |
python3Packages: document how to handle extras-require
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r-- | doc/languages-frameworks/python.section.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 9f9ace513c3..693ea016e0a 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -979,6 +979,31 @@ with import <nixpkgs> {}; in python.withPackages(ps: [ps.blaze])).env ``` +#### Optional extra dependencies + +Some packages define optional dependencies for additional features. With +`setuptools` this is called `extras_require` and `flit` calls it `extras-require`. A +method for supporting this is by declaring the extras of a package in its +`passthru`, e.g. in case of the package `dask` + +```nix +passthru.extras-require = { + complete = [ distributed ]; +}; +``` + +and letting the package requiring the extra add the list to its dependencies + +```nix +propagatedBuildInputs = [ + ... +] ++ dask.extras-require.complete; +``` + +Note this method is preferred over adding parameters to builders, as that can +result in packages depending on different variants and thereby causing +collisions. + #### `buildPythonApplication` function {#buildpythonapplication-function} The `buildPythonApplication` function is practically the same as |