forked from mirrors/nixpkgs
python3Packages: document how to handle extras-require
This commit is contained in:
parent
51ef95e6fa
commit
1986bedcff
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue