Merge pull request #177732 from tljuniper/python-doc-typos

doc/languages-frameworks: Fix typos

authored by

Valentin Gagarin and committed by
GitHub
15edb27d e8385102

+30 -20
+24 -19
doc/languages-frameworks/python.section.md
··· 602 602 #### Using pytestCheckHook {#using-pytestcheckhook} 603 603 604 604 `pytestCheckHook` is a convenient hook which will substitute the setuptools 605 - `test` command for a checkPhase which runs `pytest`. This is also beneficial 605 + `test` command for a `checkPhase` which runs `pytest`. This is also beneficial 606 606 when a package may need many items disabled to run the test suite. 607 607 608 - Using the example above, the analagous pytestCheckHook usage would be: 608 + Using the example above, the analagous `pytestCheckHook` usage would be: 609 609 610 610 ``` 611 611 checkInputs = [ pytestCheckHook ]; ··· 624 624 ]; 625 625 ``` 626 626 627 - This is expecially useful when tests need to be conditionallydisabled, 627 + This is expecially useful when tests need to be conditionally disabled, 628 628 for example: 629 629 630 630 ``` ··· 640 640 "socket" 641 641 ]; 642 642 ``` 643 - Trying to concatenate the related strings to disable tests in a regular checkPhase 644 - would be much harder to read. This also enables us to comment on why specific tests 645 - are disabled. 643 + 644 + Trying to concatenate the related strings to disable tests in a regular 645 + `checkPhase` would be much harder to read. This also enables us to comment on 646 + why specific tests are disabled. 646 647 647 648 #### Using pythonImportsCheck {#using-pythonimportscheck} 648 649 649 - Although unit tests are highly prefered to validate correctness of a package, not 650 - all packages have test suites that can be ran easily, and some have none at all. 650 + Although unit tests are highly preferred to validate correctness of a package, not 651 + all packages have test suites that can be run easily, and some have none at all. 651 652 To help ensure the package still works, `pythonImportsCheck` can attempt to import 652 653 the listed modules. 653 654 654 655 ``` 655 656 pythonImportsCheck = [ "requests" "urllib" ]; 656 657 ``` 658 + 657 659 roughly translates to: 660 + 658 661 ``` 659 662 postCheck = '' 660 663 PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH 661 664 python -c "import requests; import urllib" 662 665 ''; 663 666 ``` 664 - However, this is done in it's own phase, and not dependent on whether `doCheck = true;` 667 + 668 + However, this is done in its own phase, and not dependent on whether `doCheck = true;`. 665 669 666 670 This can also be useful in verifying that the package doesn't assume commonly 667 - present packages (e.g. `setuptools`) 671 + present packages (e.g. `setuptools`). 668 672 669 673 #### Using pythonRelaxDepsHook {#using-pythonrelaxdepshook} 670 674 ··· 719 723 ``` 720 724 721 725 In general you should always use `pythonRelaxDeps`, because `pythonRemoveDeps` 722 - will convert build errors in runtime errors. However `pythonRemoveDeps` may 726 + will convert build errors into runtime errors. However `pythonRemoveDeps` may 723 727 still be useful in exceptional cases, and also to remove dependencies wrongly 724 728 declared by upstream (for example, declaring `black` as a runtime dependency 725 729 instead of a dev dependency). ··· 738 742 without having to reinstall after each and every change you make. Development 739 743 mode is also available. Let's see how you can use it. 740 744 741 - In the previous Nix expression the source was fetched from an url. We can also 745 + In the previous Nix expression the source was fetched from a url. We can also 742 746 refer to a local source instead using `src = ./path/to/source/tree;` 743 747 744 748 If we create a `shell.nix` file which calls `buildPythonPackage`, and if `src` 745 749 is a local source, and if the local source has a `setup.py`, then development 746 750 mode is activated. 747 751 748 - In the following example we create a simple environment that has a Python 3.9 752 + In the following example, we create a simple environment that has a Python 3.9 749 753 version of our package in it, as well as its dependencies and other packages we 750 754 like to have in the environment, all specified with `propagatedBuildInputs`. 751 755 Indeed, we can just add any package we like to have in our environment to ··· 862 866 863 867 ### Optimizations {#optimizations} 864 868 865 - The Python interpreters are by default not build with optimizations enabled, because 869 + The Python interpreters are by default not built with optimizations enabled, because 866 870 the builds are in that case not reproducible. To enable optimizations, override the 867 871 interpreter of interest, e.g using 868 872 ··· 913 917 #### `buildPythonPackage` function {#buildpythonpackage-function} 914 918 915 919 The `buildPythonPackage` function is implemented in 916 - `pkgs/development/interpreters/python/mk-python-derivation` 920 + `pkgs/development/interpreters/python/mk-python-derivation.nix` 917 921 using setup hooks. 918 922 919 923 The following is an example: ··· 954 958 * In the `postFixup` phase, the `wrapPythonPrograms` bash function is called to 955 959 wrap all programs in the `$out/bin/*` directory to include `$PATH` 956 960 environment variable and add dependent libraries to script's `sys.path`. 957 - * In the `installCheck` phase, `${python.interpreter} setup.py test` is ran. 961 + * In the `installCheck` phase, `${python.interpreter} setup.py test` is run. 958 962 959 963 By default tests are run because `doCheck = true`. Test dependencies, like 960 964 e.g. the test runner, should be added to `checkInputs`. ··· 969 973 970 974 * `catchConflicts ? true`: If `true`, abort package build if a package name 971 975 appears more than once in dependency tree. Default is `true`. 972 - * `disabled` ? false: If `true`, package is not built for the particular Python 976 + * `disabled ? false`: If `true`, package is not built for the particular Python 973 977 interpreter version. 974 978 * `dontWrapPythonPrograms ? false`: Skip wrapping of Python programs. 975 979 * `permitUserSite ? false`: Skip setting the `PYTHONNOUSERSITE` environment ··· 1421 1425 1422 1426 ### `python setup.py bdist_wheel` cannot create .whl {#python-setup.py-bdist_wheel-cannot-create-.whl} 1423 1427 1424 - Executing `python setup.py bdist_wheel` in a `nix-shell `fails with 1428 + Executing `python setup.py bdist_wheel` in a `nix-shell`fails with 1429 + 1425 1430 ``` 1426 1431 ValueError: ZIP does not support timestamps before 1980 1427 1432 ``` ··· 1513 1518 # the environment. 1514 1519 pythonPackages.python 1515 1520 1516 - # This execute some shell code to initialize a venv in $venvDir before 1521 + # This executes some shell code to initialize a venv in $venvDir before 1517 1522 # dropping into the shell 1518 1523 pythonPackages.venvShellHook 1519 1524
+3 -1
nixos/doc/manual/development/writing-nixos-tests.section.md
··· 362 362 ... # Put `foo` through its paces 363 363 ``` 364 364 365 - 366 365 `polling_condition` takes the following (optional) arguments: 367 366 368 367 `seconds_interval` ··· 406 405 extraPythonPackages = p: [ p.numpy ]; 407 406 408 407 nodes = { }; 408 + 409 + # Type checking on extra packages doesn't work yet 410 + skipTypeCheck = true; 409 411 410 412 testScript = '' 411 413 import numpy as np
+3
nixos/doc/manual/from_md/development/writing-nixos-tests.section.xml
··· 680 680 681 681 nodes = { }; 682 682 683 + # Type checking on extra packages doesn't work yet 684 + skipTypeCheck = true; 685 + 683 686 testScript = '' 684 687 import numpy as np 685 688 assert str(np.zeros(4) == "array([0., 0., 0., 0.])")