mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
doc/languages-frameworks/python: update the description for pypa builder/instller
This commit is contained in:
parent
21959d8d44
commit
0a509b237a
1 changed files with 5 additions and 11 deletions
|
@ -31,8 +31,8 @@ Each interpreter has the following attributes:
|
||||||
|
|
||||||
### Building packages and applications {#building-packages-and-applications}
|
### Building packages and applications {#building-packages-and-applications}
|
||||||
|
|
||||||
Python libraries and applications that use `setuptools` or
|
Python libraries and applications that use tools to follow PEP 517 (e.g. `setuptools` or `hatchling`, etc.) or
|
||||||
`distutils` are typically built with respectively the [`buildPythonPackage`](#buildpythonpackage-function) and
|
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`.
|
[`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
|
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:
|
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.
|
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
|
* 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`
|
wrap all programs in the `$out/bin/*` directory to include `$PATH`
|
||||||
environment variable and add dependent libraries to script's `sys.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"]`.
|
`makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`.
|
||||||
* `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this
|
* `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 `""`.
|
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`.
|
* `pypaBuildFlags ? []`: A list of strings. Arguments to be passed to `python -m build --wheel`.
|
||||||
* `pythonPath ? []`: List of packages to be added into `$PYTHONPATH`. Packages
|
* `pythonPath ? []`: List of packages to be added into `$PYTHONPATH`. Packages
|
||||||
in `pythonPath` are not propagated (contrary to [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs)).
|
in `pythonPath` are not propagated (contrary to [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs)).
|
||||||
|
@ -465,13 +461,11 @@ are used in [`buildPythonPackage`](#buildpythonpackage-function).
|
||||||
with the `eggInstallHook`
|
with the `eggInstallHook`
|
||||||
- `eggBuildHook` to skip building for eggs.
|
- `eggBuildHook` to skip building for eggs.
|
||||||
- `eggInstallHook` to install 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
|
- `pypaBuildHook` to build a wheel using
|
||||||
[`pypa/build`](https://pypa-build.readthedocs.io/en/latest/index.html) and
|
[`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
|
PEP 517/518. Note a build system (e.g. `setuptools` or `flit`) should still
|
||||||
be added as `build-system`.
|
be added as `build-system`.
|
||||||
- `pipInstallHook` to install wheels.
|
- `pypaInstallHook` to install wheels.
|
||||||
- `pytestCheckHook` to run tests with `pytest`. See [example usage](#using-pytestcheckhook).
|
- `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.
|
- `pythonCatchConflictsHook` to fail if the package depends on two different versions of the same dependency.
|
||||||
- `pythonImportsCheckHook` to check whether importing the listed modules works.
|
- `pythonImportsCheckHook` to check whether importing the listed modules works.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue