3
0
Fork 0
forked from mirrors/nixpkgs

doc/python: use optional-dependencies instead of extras-require

This is the term that PEP 621 uses and it is less likely to be
misspelled.

https://peps.python.org/pep-0621/#dependencies-optional-dependencies

I was never sure if it was `extra` or `extras`, or `require` or
`requires` and finally committed a mistake in #167405.
This commit is contained in:
Martin Weinelt 2022-05-22 16:27:48 +02:00
parent 394687bf39
commit 809ffd6cd3
No known key found for this signature in database
GPG key ID: 87C1E9888F856759

View file

@ -982,12 +982,13 @@ 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
`setuptools` this is called `extras_require` and `flit` calls it
`extras-require`, while PEP 621 calls these `optional-dependencies`. 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 = {
passthru.optional-dependencies = {
complete = [ distributed ];
};
```
@ -997,7 +998,7 @@ and letting the package requiring the extra add the list to its dependencies
```nix
propagatedBuildInputs = [
...
] ++ dask.extras-require.complete;
] ++ dask.optional-dependencies.complete;
```
Note this method is preferred over adding parameters to builders, as that can