Skip to content

Commit 1986bed

Browse files
committed
python3Packages: document how to handle extras-require
1 parent 51ef95e commit 1986bed

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

doc/languages-frameworks/python.section.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,31 @@ with import <nixpkgs> {};
979979
in python.withPackages(ps: [ps.blaze])).env
980980
```
981981

982+
#### Optional extra dependencies
983+
984+
Some packages define optional dependencies for additional features. With
985+
`setuptools` this is called `extras_require` and `flit` calls it `extras-require`. A
986+
method for supporting this is by declaring the extras of a package in its
987+
`passthru`, e.g. in case of the package `dask`
988+
989+
```nix
990+
passthru.extras-require = {
991+
complete = [ distributed ];
992+
};
993+
```
994+
995+
and letting the package requiring the extra add the list to its dependencies
996+
997+
```nix
998+
propagatedBuildInputs = [
999+
...
1000+
] ++ dask.extras-require.complete;
1001+
```
1002+
1003+
Note this method is preferred over adding parameters to builders, as that can
1004+
result in packages depending on different variants and thereby causing
1005+
collisions.
1006+
9821007
#### `buildPythonApplication` function {#buildpythonapplication-function}
9831008

9841009
The `buildPythonApplication` function is practically the same as

0 commit comments

Comments
 (0)