···32323333- `libPrefix`. Name of the folder in `${python}/lib/` for corresponding interpreter.
3434- `interpreter`. Alias for `${python}/bin/${executable}`.
3535-- `buildEnv`. Function to build python interpreter environments with extra packages bundled together. See section *python.buildEnv function* for usage and documentation.
3636-- `withPackages`. Simpler interface to `buildEnv`. See section *python.withPackages function* for usage and documentation.
3535+- `buildEnv`. Function to build python interpreter environments with extra packages bundled together. See [](#python.buildenv-function) for usage and documentation.
3636+- `withPackages`. Simpler interface to `buildEnv`. See [](#python.withpackages-function) for usage and documentation.
3737- `sitePackages`. Alias for `lib/${libPrefix}/site-packages`.
3838- `executable`. Name of the interpreter executable, e.g. `python3.10`.
3939- `pkgs`. Set of Python packages for that specific interpreter. The package set can be modified by overriding the interpreter and passing `packageOverrides`.
···4141### Building packages and applications {#building-packages-and-applications}
42424343Python libraries and applications that use `setuptools` or
4444-`distutils` are typically built with respectively the `buildPythonPackage` and
4545-`buildPythonApplication` functions. These two functions also support installing a `wheel`.
4444+`distutils` are typically built with respectively the [`buildPythonPackage`](#buildpythonpackage-function) and
4545+[`buildPythonApplication`](#buildpythonapplication-function) functions. These two functions also support installing a `wheel`.
46464747All Python packages reside in `pkgs/top-level/python-packages.nix` and all
4848applications elsewhere. In case a package is used as both a library and an
···141141142142The `buildPythonPackage` mainly does four things:
143143144144-* In the `buildPhase`, it calls `${python.pythonForBuild.interpreter} setup.py bdist_wheel` to
144144+* In the [`buildPhase`](#build-phase), it calls `${python.pythonForBuild.interpreter} setup.py bdist_wheel` to
145145 build a wheel binary zipfile.
146146-* In the `installPhase`, it installs the wheel file using `pip install *.whl`.
147147-* In the `postFixup` phase, the `wrapPythonPrograms` bash function is called to
146146+* In the [`installPhase`](#ssec-install-phase), it installs the wheel file using `pip install *.whl`.
147147+* In the [`postFixup`](#var-stdenv-postFixup) phase, the `wrapPythonPrograms` bash function is called to
148148 wrap all programs in the `$out/bin/*` directory to include `$PATH`
149149 environment variable and add dependent libraries to script's `sys.path`.
150150-* In the `installCheck` phase, `${python.interpreter} setup.py test` is run.
150150+* In the [`installCheck`](#ssec-installCheck-phase) phase, `${python.interpreter} setup.py test` is run.
151151152152-By default tests are run because `doCheck = true`. Test dependencies, like
153153-e.g. the test runner, should be added to `nativeCheckInputs`.
152152+By default tests are run because [`doCheck = true`](#var-stdenv-doCheck). Test dependencies, like
153153+e.g. the test runner, should be added to [`nativeCheckInputs`](#var-stdenv-nativeCheckInputs).
154154155155By default `meta.platforms` is set to the same value
156156as the interpreter unless overridden otherwise.
157157158158##### `buildPythonPackage` parameters {#buildpythonpackage-parameters}
159159160160-All parameters from `stdenv.mkDerivation` function are still supported. The
160160+All parameters from [`stdenv.mkDerivation`](#sec-using-stdenv) function are still supported. The
161161following are specific to `buildPythonPackage`:
162162163163* `catchConflicts ? true`: If `true`, abort package build if a package name
···177177 format. When unset, the legacy `setuptools` hooks are used for backwards
178178 compatibility.
179179* `makeWrapperArgs ? []`: A list of strings. Arguments to be passed to
180180- `makeWrapper`, which wraps generated binaries. By default, the arguments to
181181- `makeWrapper` set `PATH` and `PYTHONPATH` environment variables before calling
180180+ [`makeWrapper`](#fun-makeWrapper), which wraps generated binaries. By default, the arguments to
181181+ [`makeWrapper`](#fun-makeWrapper) set `PATH` and `PYTHONPATH` environment variables before calling
182182 the binary. Additional arguments here can allow a developer to set environment
183183 variables which will be available when the binary is run. For example,
184184 `makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`.
···190190* `pipBuildFlags ? []`: A list of strings. Arguments to be passed to `pip wheel`.
191191* `pypaBuildFlags ? []`: A list of strings. Arguments to be passed to `python -m build --wheel`.
192192* `pythonPath ? []`: List of packages to be added into `$PYTHONPATH`. Packages
193193- in `pythonPath` are not propagated (contrary to `propagatedBuildInputs`).
193193+ in `pythonPath` are not propagated (contrary to [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs)).
194194* `preShellHook`: Hook to execute commands before `shellHook`.
195195* `postShellHook`: Hook to execute commands after `shellHook`.
196196* `removeBinByteCode ? true`: Remove bytecode from `/bin`. Bytecode is only
···198198* `setupPyGlobalFlags ? []`: List of flags passed to `setup.py` command.
199199* `setupPyBuildFlags ? []`: List of flags passed to `setup.py build_ext` command.
200200201201-The `stdenv.mkDerivation` function accepts various parameters for describing
201201+The [`stdenv.mkDerivation`](#sec-using-stdenv) function accepts various parameters for describing
202202build inputs (see "Specifying dependencies"). The following are of special
203203interest for Python packages, either because these are primarily used, or
204204because their behaviour is different:
···208208* `buildInputs ? []`: Build and/or run-time dependencies that need to be
209209 compiled for the host machine. Typically non-Python libraries which are being
210210 linked.
211211-* `nativeCheckInputs ? []`: Dependencies needed for running the `checkPhase`. These
212212- are added to `nativeBuildInputs` when `doCheck = true`. Items listed in
211211+* `nativeCheckInputs ? []`: Dependencies needed for running the [`checkPhase`](#ssec-check-phase). These
212212+ are added to [`nativeBuildInputs`](#var-stdenv-nativeBuildInputs) when [`doCheck = true`](#var-stdenv-doCheck). Items listed in
213213 `tests_require` go here.
214214* `propagatedBuildInputs ? []`: Aside from propagating dependencies,
215215 `buildPythonPackage` also injects code into and wraps executables with the
···266266267267#### `buildPythonApplication` function {#buildpythonapplication-function}
268268269269-The `buildPythonApplication` function is practically the same as
270270-`buildPythonPackage`. The main purpose of this function is to build a Python
269269+The [`buildPythonApplication`](#buildpythonapplication-function) function is practically the same as
270270+[`buildPythonPackage`](#buildpythonpackage-function). The main purpose of this function is to build a Python
271271package where one is interested only in the executables, and not importable
272272-modules. For that reason, when adding this package to a `python.buildEnv`, the
272272+modules. For that reason, when adding this package to a [`python.buildEnv`](#python.buildenv-function), the
273273modules won't be made available.
274274275275-Another difference is that `buildPythonPackage` by default prefixes the names of
275275+Another difference is that [`buildPythonPackage`](#buildpythonpackage-function) by default prefixes the names of
276276the packages with the version of the interpreter. Because this is irrelevant for
277277applications, the prefix is omitted.
278278279279-When packaging a Python application with `buildPythonApplication`, it should be
279279+When packaging a Python application with [`buildPythonApplication`](#buildpythonapplication-function), it should be
280280called with `callPackage` and passed `python` or `pythonPackages` (possibly
281281specifying an interpreter version), like this:
282282···329329duplication the `toPythonApplication` can be used to convert a library to an
330330application.
331331332332-The Nix expression shall use `buildPythonPackage` and be called from
332332+The Nix expression shall use [`buildPythonPackage`](#buildpythonpackage-function) and be called from
333333`python-packages.nix`. A reference shall be created from `all-packages.nix` to
334334the attribute in `python-packages.nix`, and the `toPythonApplication` shall be
335335applied to the reference:
···341341#### `toPythonModule` function {#topythonmodule-function}
342342343343In some cases, such as bindings, a package is created using
344344-`stdenv.mkDerivation` and added as attribute in `all-packages.nix`. The Python
344344+[`stdenv.mkDerivation`](#sec-using-stdenv) and added as attribute in `all-packages.nix`. The Python
345345bindings should be made available from `python-packages.nix`. The
346346`toPythonModule` function takes a derivation and makes certain Python-specific
347347modifications.
···407407408408#### `python.withPackages` function {#python.withpackages-function}
409409410410-The `python.withPackages` function provides a simpler interface to the `python.buildEnv` functionality.
410410+The [`python.withPackages`](#python.withpackages-function) function provides a simpler interface to the [`python.buildEnv`](#python.buildenv-function) functionality.
411411It takes a function as an argument that is passed the set of python packages and returns the list
412412-of the packages to be included in the environment. Using the `withPackages` function, the previous
412412+of the packages to be included in the environment. Using the [`withPackages`](#python.withpackages-function) function, the previous
413413example for the Pyramid Web Framework environment can be written like this:
414414415415```nix
···418418python.withPackages (ps: [ ps.pyramid ])
419419```
420420421421-`withPackages` passes the correct package set for the specific interpreter
421421+[`withPackages`](#python.withpackages-function) passes the correct package set for the specific interpreter
422422version as an argument to the function. In the above example, `ps` equals
423423`pythonPackages`. But you can also easily switch to using python3:
424424···430430431431Now, `ps` is set to `python3Packages`, matching the version of the interpreter.
432432433433-As `python.withPackages` simply uses `python.buildEnv` under the hood, it also
433433+As [`python.withPackages`](#python.withpackages-function) simply uses [`python.buildEnv`](#python.buildenv-function) under the hood, it also
434434supports the `env` attribute. The `shell.nix` file from the previous section can
435435thus be also written like this:
436436···443443])).env
444444```
445445446446-In contrast to `python.buildEnv`, `python.withPackages` does not support the
446446+In contrast to [`python.buildEnv`](#python.buildenv-function), [`python.withPackages`](#python.withpackages-function) does not support the
447447more advanced options such as `ignoreCollisions = true` or `postBuild`. If you
448448-need them, you have to use `python.buildEnv`.
448448+need them, you have to use [`python.buildEnv`](#python.buildenv-function).
449449450450Python 2 namespace packages may provide `__init__.py` that collide. In that case
451451-`python.buildEnv` should be used with `ignoreCollisions = true`.
451451+[`python.buildEnv`](#python.buildenv-function) should be used with `ignoreCollisions = true`.
452452453453#### Setup hooks {#setup-hooks}
454454455455The following are setup hooks specifically for Python packages. Most of these
456456-are used in `buildPythonPackage`.
456456+are used in [`buildPythonPackage`](#buildpythonpackage-function).
457457458458- `eggUnpackhook` to move an egg to the correct folder so it can be installed
459459 with the `eggInstallHook`
···486486### Development mode {#development-mode}
487487488488Development or editable mode is supported. To develop Python packages
489489-`buildPythonPackage` has additional logic inside `shellPhase` to run `pip
489489+[`buildPythonPackage`](#buildpythonpackage-function) has additional logic inside `shellPhase` to run `pip
490490install -e . --prefix $TMPDIR/`for the package.
491491492492Warning: `shellPhase` is executed only if `setup.py` exists.
···567567But Python libraries you would like to use for development cannot be installed,
568568at least not individually, because they won't be able to find each other
569569resulting in import errors. Instead, it is possible to create an environment
570570-with `python.buildEnv` or `python.withPackages` where the interpreter and other
570570+with [`python.buildEnv`](#python.buildenv-function) or [`python.withPackages`](#python.withpackages-function) where the interpreter and other
571571executables are wrapped to be able to find each other and all of the modules.
572572573573In the following examples we will start by creating a simple, ad-hoc environment
···747747 imports the `<nixpkgs>` function, `{}` calls it and the `with` statement
748748 brings all attributes of `nixpkgs` in the local scope. These attributes form
749749 the main package set.
750750-2. Then we create a Python 3.11 environment with the `withPackages` function, as before.
751751-3. The `withPackages` function expects us to provide a function as an argument
750750+2. Then we create a Python 3.11 environment with the [`withPackages`](#python.withpackages-function) function, as before.
751751+3. The [`withPackages`](#python.withpackages-function) function expects us to provide a function as an argument
752752 that takes the set of all Python packages and returns a list of packages to
753753 include in the environment. Here, we select the packages `numpy` and `toolz`
754754 from the package set.
···859859#### Python library packages in Nixpkgs {#python-library-packages-in-nixpkgs}
860860861861With Nix all packages are built by functions. The main function in Nix for
862862-building Python libraries is `buildPythonPackage`. Let's see how we can build the
862862+building Python libraries is [`buildPythonPackage`](#buildpythonpackage-function). Let's see how we can build the
863863`toolz` package.
864864865865```nix
···904904}
905905```
906906907907-What happens here? The function `buildPythonPackage` is called and as argument
907907+What happens here? The function [`buildPythonPackage`](#buildpythonpackage-function) is called and as argument
908908it accepts a set. In this case the set is a recursive set, `rec`. One of the
909909arguments is the name of the package, which consists of a basename (generally
910910following the name on PyPi) and a version. Another argument, `src` specifies the
911911source, which in this case is fetched from PyPI using the helper function
912912`fetchPypi`. The argument `doCheck` is used to set whether tests should be run
913913-when building the package. Since there are no tests, we rely on `pythonImportsCheck`
913913+when building the package. Since there are no tests, we rely on [`pythonImportsCheck`](#using-pythonimportscheck)
914914to test whether the package can be imported. Furthermore, we specify some meta
915915information. The output of the function is a derivation.
916916···969969So, what did we do here? Well, we took the Nix expression that we used earlier
970970to build a Python environment, and said that we wanted to include our own
971971version of `toolz`, named `my_toolz`. To introduce our own package in the scope
972972-of `withPackages` we used a `let` expression. You can see that we used
972972+of [`withPackages`](#python.withpackages-function) we used a `let` expression. You can see that we used
973973`ps.numpy` to select numpy from the nixpkgs package set (`ps`). We did not take
974974`toolz` from the Nixpkgs package set this time, but instead took our own version
975975that we introduced with the `let` expression.
···977977#### Handling dependencies {#handling-dependencies}
978978979979Our example, `toolz`, does not have any dependencies on other Python packages or
980980-system libraries. According to the manual, `buildPythonPackage` uses the
981981-arguments `buildInputs` and `propagatedBuildInputs` to specify dependencies. If
980980+system libraries. According to the manual, [`buildPythonPackage`](#buildpythonpackage-function) uses the
981981+arguments [`buildInputs`](#var-stdenv-buildInputs) and [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs) to specify dependencies. If
982982something is exclusively a build-time dependency, then the dependency should be
983983-included in `buildInputs`, but if it is (also) a runtime dependency, then it
984984-should be added to `propagatedBuildInputs`. Test dependencies are considered
985985-build-time dependencies and passed to `nativeCheckInputs`.
983983+included in [`buildInputs`](#var-stdenv-buildInputs), but if it is (also) a runtime dependency, then it
984984+should be added to [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs). Test dependencies are considered
985985+build-time dependencies and passed to [`nativeCheckInputs`](#var-stdenv-nativeCheckInputs).
986986987987-The following example shows which arguments are given to `buildPythonPackage` in
987987+The following example shows which arguments are given to [`buildPythonPackage`](#buildpythonpackage-function) in
988988order to build [`datashape`](https://github.com/blaze/datashape).
989989990990```nix
···10381038```
1039103910401040We can see several runtime dependencies, `numpy`, `multipledispatch`, and
10411041-`python-dateutil`. Furthermore, we have `nativeCheckInputs` with `pytest`.
10421042-`pytest` is a test runner and is only used during the `checkPhase` and is
10431043-therefore not added to `propagatedBuildInputs`.
10411041+`python-dateutil`. Furthermore, we have [`nativeCheckInputs`](#var-stdenv-nativeCheckInputs) with `pytest`.
10421042+`pytest` is a test runner and is only used during the [`checkPhase`](#ssec-check-phase) and is
10431043+therefore not added to [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs).
1044104410451045In the previous case we had only dependencies on other Python packages to consider.
10461046Occasionally you have also system libraries to consider. E.g., `lxml` provides
10471047Python bindings to `libxml2` and `libxslt`. These libraries are only required
10481048-when building the bindings and are therefore added as `buildInputs`.
10481048+when building the bindings and are therefore added as [`buildInputs`](#var-stdenv-buildInputs).
1049104910501050```nix
10511051{ lib
···10931093The example below shows bindings to The Fastest Fourier Transform in the West,
10941094commonly known as FFTW. On Nix we have separate packages of FFTW for the
10951095different types of floats (`"single"`, `"double"`, `"long-double"`). The
10961096-bindings need all three types, and therefore we add all three as `buildInputs`.
10961096+bindings need all three types, and therefore we add all three as [`buildInputs`](#var-stdenv-buildInputs).
10971097The bindings don't expect to find each of them in a different folder, and
10981098therefore we have to set `LDFLAGS` and `CFLAGS`.
10991099···11581158}
11591159```
1160116011611161-Note also the line `doCheck = false;`, we explicitly disabled running the test-suite.
11611161+Note also the line [`doCheck = false;`](#var-stdenv-doCheck), we explicitly disabled running the test-suite.
1162116211631163#### Testing Python Packages {#testing-python-packages}
11641164···11671167but is not usable at runtime. Currently, all packages will use the `test`
11681168command provided by the setup.py (i.e. `python setup.py test`). However,
11691169this is currently deprecated https://github.com/pypa/setuptools/pull/1878
11701170-and your package should provide its own checkPhase.
11701170+and your package should provide its own [`checkPhase`](#ssec-check-phase).
1171117111721172::: {.note}
11731173-The `checkPhase` for python maps to the `installCheckPhase` on a
11731173+The [`checkPhase`](#ssec-check-phase) for python maps to the `installCheckPhase` on a
11741174normal derivation. This is due to many python packages not behaving well
11751175to the pre-installed version of the package. Version info, and natively
11761176compiled extensions generally only exist in the install directory, and
···12351235#### Using pytestCheckHook {#using-pytestcheckhook}
1236123612371237`pytestCheckHook` is a convenient hook which will substitute the setuptools
12381238-`test` command for a `checkPhase` which runs `pytest`. This is also beneficial
12381238+`test` command for a [`checkPhase`](#ssec-check-phase) which runs `pytest`. This is also beneficial
12391239when a package may need many items disabled to run the test suite.
1240124012411241Using the example above, the analogous `pytestCheckHook` usage would be:
···12801280```
1281128112821282Trying to concatenate the related strings to disable tests in a regular
12831283-`checkPhase` would be much harder to read. This also enables us to comment on
12831283+[`checkPhase`](#ssec-check-phase) would be much harder to read. This also enables us to comment on
12841284why specific tests are disabled.
1285128512861286#### Using pythonImportsCheck {#using-pythonimportscheck}
1287128712881288Although unit tests are highly preferred to validate correctness of a package, not
12891289all packages have test suites that can be run easily, and some have none at all.
12901290-To help ensure the package still works, `pythonImportsCheck` can attempt to import
12901290+To help ensure the package still works, [`pythonImportsCheck`](#using-pythonimportscheck) can attempt to import
12911291the listed modules.
1292129212931293```
···13061306 '';
13071307```
1308130813091309-However, this is done in its own phase, and not dependent on whether `doCheck = true;`.
13091309+However, this is done in its own phase, and not dependent on whether [`doCheck = true;`](#var-stdenv-doCheck).
1310131013111311This can also be useful in verifying that the package doesn't assume commonly
13121312present packages (e.g. `setuptools`).
···1378137813791379Keep in mind that while the examples above are done with `requirements.txt`,
13801380`pythonRelaxDepsHook` works by modifying the resulting wheel file, so it should
13811381-work with any of the existing [hooks](#setup-hooks).
13811381+work with any of the [existing hooks](#setup-hooks).
1382138213831383#### Using unittestCheckHook {#using-unittestcheckhook}
1384138413851385-`unittestCheckHook` is a hook which will substitute the setuptools `test` command for a `checkPhase` which runs `python -m unittest discover`:
13851385+`unittestCheckHook` is a hook which will substitute the setuptools `test` command for a [`checkPhase`](#ssec-check-phase) which runs `python -m unittest discover`:
1386138613871387```
13881388 nativeCheckInputs = [
···14521452In the previous Nix expression the source was fetched from a url. We can also
14531453refer to a local source instead using `src = ./path/to/source/tree;`
1454145414551455-If we create a `shell.nix` file which calls `buildPythonPackage`, and if `src`
14551455+If we create a `shell.nix` file which calls [`buildPythonPackage`](#buildpythonpackage-function), and if `src`
14561456is a local source, and if the local source has a `setup.py`, then development
14571457mode is activated.
1458145814591459In the following example, we create a simple environment that has a Python 3.11
14601460version of our package in it, as well as its dependencies and other packages we
14611461-like to have in the environment, all specified with `propagatedBuildInputs`.
14611461+like to have in the environment, all specified with [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs).
14621462Indeed, we can just add any package we like to have in our environment to
14631463-`propagatedBuildInputs`.
14631463+[`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs).
1464146414651465```nix
14661466with import <nixpkgs> {};
···1494149414951495### Including a derivation using `callPackage` {#including-a-derivation-using-callpackage}
1496149614971497-Earlier we created a Python environment using `withPackages`, and included the
14971497+Earlier we created a Python environment using [`withPackages`](#python.withpackages-function), and included the
14981498`toolz` package via a `let` expression.
14991499Let's split the package definition from the environment definition.
15001500···15331533}
15341534```
1535153515361536-It takes an argument `buildPythonPackage`. We now call this function using
15361536+It takes an argument [`buildPythonPackage`](#buildpythonpackage-function). We now call this function using
15371537`callPackage` in the definition of our environment
1538153815391539```nix
···15521552```
1553155315541554Important to remember is that the Python version for which the package is made
15551555-depends on the `python` derivation that is passed to `buildPythonPackage`. Nix
15551555+depends on the `python` derivation that is passed to [`buildPythonPackage`](#buildpythonpackage-function). Nix
15561556tries to automatically pass arguments when possible, which is why generally you
15571557don't explicitly define which `python` derivation should be used. In the above
15581558-example we use `buildPythonPackage` that is part of the set `python3Packages`,
15581558+example we use [`buildPythonPackage`](#buildpythonpackage-function) that is part of the set `python3Packages`,
15591559and in this case the `python3` interpreter is automatically used.
1560156015611561## FAQ {#faq}
···16981698packages are available. There is therefore no need to maintain a global `site-packages`.
1699169917001700If you want to create a Python environment for development, then the recommended
17011701-method is to use `nix-shell`, either with or without the `python.buildEnv`
17011701+method is to use `nix-shell`, either with or without the [`python.buildEnv`](#python.buildenv-function)
17021702function.
1703170317041704### How to consume Python modules using pip in a virtual environment like I am used to on other Operating Systems? {#how-to-consume-python-modules-using-pip-in-a-virtual-environment-like-i-am-used-to-on-other-operating-systems}
···1875187518761876### How to override a Python package for all Python versions using extensions? {#how-to-override-a-python-package-for-all-python-versions-using-extensions}
1877187718781878-The following overlay overrides the call to `buildPythonPackage` for the
18781878+The following overlay overrides the call to [`buildPythonPackage`](#buildpythonpackage-function) for the
18791879`foo` package for all interpreters by appending a Python extension to the
18801880`pythonPackagesExtensions` list of extensions.
18811881···1902190219031903In a `setup.py` or `setup.cfg` it is common to declare dependencies:
1904190419051905-* `setup_requires` corresponds to `nativeBuildInputs`
19061906-* `install_requires` corresponds to `propagatedBuildInputs`
19071907-* `tests_require` corresponds to `nativeCheckInputs`
19051905+* `setup_requires` corresponds to [`nativeBuildInputs`](#var-stdenv-nativeBuildInputs)
19061906+* `install_requires` corresponds to [`propagatedBuildInputs`](#var-stdenv-propagatedBuildInputs)
19071907+* `tests_require` corresponds to [`nativeCheckInputs`](#var-stdenv-nativeCheckInputs)
1908190819091909### How to enable interpreter optimizations? {#optimizations}
19101910···1951195119521952### How to contribute a Python package to nixpkgs? {#tools}
1953195319541954-Packages inside nixpkgs must use the `buildPythonPackage` or `buildPythonApplication` function directly,
19541954+Packages inside nixpkgs must use the [`buildPythonPackage`](#buildpythonpackage-function) or [`buildPythonApplication`](#buildpythonapplication-function) function directly,
19551955because we can only provide security support for non-vendored dependencies.
1956195619571957We recommend [nix-init](https://github.com/nix-community/nix-init) for creating new python packages within nixpkgs,
···19651965`nix-shell`.
1966196619671967When the environment variable `DETERMINISTIC_BUILD` is set, all bytecode will
19681968-have timestamp 1. The `buildPythonPackage` function sets `DETERMINISTIC_BUILD=1`
19681968+have timestamp 1. The [`buildPythonPackage`](#buildpythonpackage-function) function sets `DETERMINISTIC_BUILD=1`
19691969and [PYTHONHASHSEED=0](https://docs.python.org/3.11/using/cmdline.html#envvar-PYTHONHASHSEED).
19701970Both are also exported in `nix-shell`.
19711971···19751975Source distributions (`sdist`) often include test files, but not always.
1976197619771977By default the command `python setup.py test` is run as part of the
19781978-`checkPhase`, but often it is necessary to pass a custom `checkPhase`. An
19781978+[`checkPhase`](#ssec-check-phase), but often it is necessary to pass a custom [`checkPhase`](#ssec-check-phase). An
19791979example of such a situation is when `py.test` is used.
1980198019811981#### Common issues {#common-issues}
1982198219831983-* Non-working tests can often be deselected. By default `buildPythonPackage`
19831983+* Non-working tests can often be deselected. By default [`buildPythonPackage`](#buildpythonpackage-function)
19841984 runs `python setup.py test`. which is deprecated. Most Python modules however
19851985 do follow the standard test protocol where the pytest runner can be used
19861986 instead. `pytest` supports the `-k` and `--ignore` parameters to ignore test
···20152015The following rules are desired to be respected:
2016201620172017* Python libraries are called from `python-packages.nix` and packaged with
20182018- `buildPythonPackage`. The expression of a library should be in
20182018+ [`buildPythonPackage`](#buildpythonpackage-function). The expression of a library should be in
20192019 `pkgs/development/python-modules/<name>/default.nix`.
20202020* Python applications live outside of `python-packages.nix` and are packaged
20212021- with `buildPythonApplication`.
20212021+ with [`buildPythonApplication`](#buildpythonapplication-function).
20222022* Make sure libraries build for all Python interpreters.
20232023* By default we enable tests. Make sure the tests are found and, in the case of
20242024 libraries, are passing for all interpreters. If certain tests fail they can be
+2
nixos/doc/manual/release-notes/rl-2311.section.md
···229229230230- `rome` was removed because it is no longer maintained and is succeeded by `biome`.
231231232232+- The `services.mtr-exporter.target` has been removed in favor of `services.mtr-exporter.jobs` which allows specifying multiple targets.
233233+232234## Other Notable Changes {#sec-release-23.11-notable-changes}
233235234236- The Cinnamon module now enables XDG desktop integration by default. If you are experiencing collisions related to xdg-desktop-portal-gtk you can safely remove `xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];` from your NixOS configuration.
···1414 # it is known to cause problems. Search online for "rpl_malloc" and
1515 # "rpl_realloc" to find out more.
1616 ./fix-rpl_malloc.patch
1717+ ./suse-bug-580609.patch
1818+ ./suse-bug-955687.patch
1719 ];
18201921 nativeBuildInputs = [ autoreconfHook pkg-config ];