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