From 0a509b237a29841b9236b2bc3296d93d7c4d96a6 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sun, 2 Jun 2024 00:43:52 +0900 Subject: [PATCH] doc/languages-frameworks/python: update the description for pypa builder/instller --- doc/languages-frameworks/python.section.md | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 4c4ecf0fa278..71d3c373a5d9 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -31,8 +31,8 @@ Each interpreter has the following attributes: ### Building packages and applications {#building-packages-and-applications} -Python libraries and applications that use `setuptools` or -`distutils` are typically built with respectively the [`buildPythonPackage`](#buildpythonpackage-function) and +Python libraries and applications that use tools to follow PEP 517 (e.g. `setuptools` or `hatchling`, etc.) or +previous tools such as `distutils` are typically built with respectively the [`buildPythonPackage`](#buildpythonpackage-function) and [`buildPythonApplication`](#buildpythonapplication-function) functions. These two functions also support installing a `wheel`. All Python packages reside in `pkgs/top-level/python-packages.nix` and all @@ -134,9 +134,9 @@ buildPythonPackage rec { The `buildPythonPackage` mainly does four things: -* In the [`buildPhase`](#build-phase), it calls `${python.pythonOnBuildForHost.interpreter} setup.py bdist_wheel` to +* In the [`buildPhase`](#build-phase), it calls `${python.pythonOnBuildForHost.interpreter} -m build --wheel` to build a wheel binary zipfile. -* In the [`installPhase`](#ssec-install-phase), it installs the wheel file using `pip install *.whl`. +* In the [`installPhase`](#ssec-install-phase), it installs the wheel file using `${python.pythonOnBuildForHost.interpreter} -m installer *.whl`. * In the [`postFixup`](#var-stdenv-postFixup) phase, the `wrapPythonPrograms` bash function is called to wrap all programs in the `$out/bin/*` directory to include `$PATH` environment variable and add dependent libraries to script's `sys.path`. @@ -177,10 +177,6 @@ following are specific to `buildPythonPackage`: `makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`. * `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications to `""`. -* `pipInstallFlags ? []`: A list of strings. Arguments to be passed to `pip - install`. To pass options to `python setup.py install`, use - `--install-option`. E.g., `pipInstallFlags=["--install-option='--cpp_implementation'"]`. -* `pipBuildFlags ? []`: A list of strings. Arguments to be passed to `pip wheel`. * `pypaBuildFlags ? []`: A list of strings. Arguments to be passed to `python -m build --wheel`. * `pythonPath ? []`: List of packages to be added into `$PYTHONPATH`. Packages in `pythonPath` are not propagated (contrary to [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs)). @@ -465,13 +461,11 @@ are used in [`buildPythonPackage`](#buildpythonpackage-function). with the `eggInstallHook` - `eggBuildHook` to skip building for eggs. - `eggInstallHook` to install eggs. -- `pipBuildHook` to build a wheel using `pip` and PEP 517. Note a build system - (e.g. `setuptools` or `flit`) should still be added as `build-system`. - `pypaBuildHook` to build a wheel using [`pypa/build`](https://pypa-build.readthedocs.io/en/latest/index.html) and PEP 517/518. Note a build system (e.g. `setuptools` or `flit`) should still be added as `build-system`. -- `pipInstallHook` to install wheels. +- `pypaInstallHook` to install wheels. - `pytestCheckHook` to run tests with `pytest`. See [example usage](#using-pytestcheckhook). - `pythonCatchConflictsHook` to fail if the package depends on two different versions of the same dependency. - `pythonImportsCheckHook` to check whether importing the listed modules works.