@@ -186,7 +186,7 @@ building Python libraries is `buildPythonPackage`. Let's see how we can build th
186186`toolz` package.
187187
188188```nix
189−{ # ...
189+{ lib, buildPythonPackage, fetchPypi }:
190190
191191 toolz = buildPythonPackage rec {
192192 pname = "toolz";
@@ -199,8 +199,8 @@ building Python libraries is `buildPythonPackage`. Let's see how we can build th
199199
200200 doCheck = false;
201201
202− meta = {
203− homepage = "https://github.com/pytoolz/toolz/";
202+ meta = with lib; {
203+ homepage = https://github.com/pytoolz/toolz;
204204 description = "List processing tools and functional utilities";
205205 license = licenses.bsd3;
206206 maintainers = with maintainers; [ fridh ];
@@ -267,12 +267,13 @@ that we introduced with the `let` expression.
267267
268268#### Handling dependencies
269269
270−Our example, `toolz`, does not have any dependencies on other Python
271−packages or system libraries. According to the manual, `buildPythonPackage`
272−uses the arguments `buildInputs` and `propagatedBuildInputs` to specify dependencies. If something is
273−exclusively a build-time dependency, then the dependency should be included as a
274−`buildInput`, but if it is (also) a runtime dependency, then it should be added
275−to `propagatedBuildInputs`. Test dependencies are considered build-time dependencies.
270+Our example, `toolz`, does not have any dependencies on other Python packages or
271+system libraries. According to the manual, `buildPythonPackage` uses the
272+arguments `buildInputs` and `propagatedBuildInputs` to specify dependencies. If
273+something is exclusively a build-time dependency, then the dependency should be
274+included as a `buildInput`, but if it is (also) a runtime dependency, then it
275+should be added to `propagatedBuildInputs`. Test dependencies are considered
276+build-time dependencies and passed to `checkInputs`.
276277
277278The following example shows which arguments are given to `buildPythonPackage` in
278279order to build [`datashape`](https://github.com/blaze/datashape).
@@ -292,7 +293,7 @@ order to build [`datashape`](https://github.com/blaze/datashape).
292293 checkInputs = with self; [ pytest ];
293294 propagatedBuildInputs = with self; [ numpy multipledispatch dateutil ];
294295
295− meta = {
296+ meta = with lib; {
296297 homepage = https://github.com/ContinuumIO/datashape;
297298 description = "A data description language";
298299 license = licenses.bsd2;
@@ -326,7 +327,7 @@ when building the bindings and are therefore added as `buildInputs`.
326327
327328 buildInputs = with self; [ pkgs.libxml2 pkgs.libxslt ];
328329
329− meta = {
330+ meta = with lib; {
330331 description = "Pythonic binding for the libxml2 and libxslt libraries";
331332 homepage = https://lxml.de;
332333 license = licenses.bsd3;
@@ -370,9 +371,9 @@ and `CFLAGS`.
370371 export CFLAGS="-I${pkgs.fftw.dev}/include -I${pkgs.fftwFloat.dev}/include -I${pkgs.fftwLongDouble.dev}/include"
371372 '';
372373
373− meta = {
374+ meta = with lib; {
374375 description = "A pythonic wrapper around FFTW, the FFT library, presenting a unified interface for all the supported transforms";
375− homepage = http://hgomersall.github.com/pyFFTW/;
376+ homepage = http://hgomersall.github.com/pyFFTW;
376377 license = with licenses; [ bsd2 bsd3 ];
377378 maintainers = with maintainers; [ fridh ];
378379 };
@@ -478,8 +479,6 @@ don't explicitly define which `python` derivation should be used. In the above
478479example we use `buildPythonPackage` that is part of the set `python35Packages`,
479480and in this case the `python35` interpreter is automatically used.
480481
481−
482−
483482## Reference
484483
485484### Interpreters
@@ -549,31 +548,31 @@ The `buildPythonPackage` function is implemented in
549548
550549The following is an example:
551550```nix
551+{ lib, buildPythonPackage, fetchPypi, hypothesis, setuptools_scm, attrs, py, setuptools, six, pluggy }:
552552
553553buildPythonPackage rec {
554− version = "3.3.1";
555554 pname = "pytest";
556−
557− preCheck = ''
558− # don't test bash builtins
559− rm testing/test_argcomplete.py
560− '';
555+ version = "3.3.1";
561556
562557 src = fetchPypi {
563558 inherit pname version;
564559 sha256 = "cf8436dc59d8695346fcd3ab296de46425ecab00d64096cebe79fb51ecb2eb93";
565560 };
566561
562+ preCheck = ''
563+ # don't test bash builtins
564+ rm testing/test_argcomplete.py
565+ '';
566+
567567 checkInputs = [ hypothesis ];
568568 buildInputs = [ setuptools_scm ];
569569 propagatedBuildInputs = [ attrs py setuptools six pluggy ];
570570
571− meta = with stdenv.lib; {
571+ meta = with lib; {
572572 maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
573573 description = "Framework for writing tests";
574574 };
575575}
576−
577576```
578577
579578The `buildPythonPackage` mainly does four things:
@@ -655,6 +654,9 @@ Another difference is that `buildPythonPackage` by default prefixes the names of
655654the packages with the version of the interpreter. Because this is irrelevant for
656655applications, the prefix is omitted.
657656
657+When packaging a python application with `buildPythonApplication`, it should be
658+invoked with `callPackage` and passed `python` or `pythonPackages`.
659+
658660#### `toPythonApplication` function
659661
660662A distinction is made between applications and libraries, however, sometimes a