diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 4a8db80289fa..2fecf6ffa9c7 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -27,6 +27,7 @@ Each interpreter has the following attributes: - `withPackages`. Simpler interface to `buildEnv`. See [](#python.withpackages-function) for usage and documentation. - `sitePackages`. Alias for `lib/${libPrefix}/site-packages`. - `executable`. Name of the interpreter executable, e.g. `python3.10`. +- `isFreeThreaded`. Whether the interpreter is a free-threaded build (`enableGIL = false`), e.g. `python314FreeThreading`. - `pkgs`. Set of Python packages for that specific interpreter. The package set can be modified by overriding the interpreter and passing `packageOverrides`. ### Building packages and applications {#building-packages-and-applications} diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 81d7d51857f3..a2ac8e7626a1 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -217,6 +217,7 @@ let executable = "python${pythonVersion}${abiFlags}"; sitePackages = "lib/${libPrefix}/site-packages"; inherit hasDistutilsCxxPatch pythonAttr; + isFreeThreaded = !enableGIL; inherit (splices) pythonOnBuildForBuild pythonOnBuildForHost diff --git a/pkgs/development/interpreters/python/passthrufun.nix b/pkgs/development/interpreters/python/passthrufun.nix index 005ba62ba742..70aafed11466 100644 --- a/pkgs/development/interpreters/python/passthrufun.nix +++ b/pkgs/development/interpreters/python/passthrufun.nix @@ -24,6 +24,7 @@ pythonOnTargetForTarget, pythonAttr ? null, pythonABITags ? [ "none" ], + isFreeThreaded ? false, self, # is pythonOnHostForTarget }: let @@ -127,6 +128,7 @@ rec { inherit executable implementation + isFreeThreaded libPrefix pythonVersion sitePackages diff --git a/pkgs/development/interpreters/python/python-packages-base.nix b/pkgs/development/interpreters/python/python-packages-base.nix index ad335a1c0ac8..623f1cf876e4 100644 --- a/pkgs/development/interpreters/python/python-packages-base.nix +++ b/pkgs/development/interpreters/python/python-packages-base.nix @@ -203,6 +203,7 @@ in { inherit lib pkgs stdenv; inherit (python.passthru) + isFreeThreaded isPy311 isPy312 isPy313