about summary refs log tree commit diff
path: root/pkgs/development/python-modules/json-logging/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/json-logging/default.nix')
-rw-r--r--pkgs/development/python-modules/json-logging/default.nix52
1 files changed, 29 insertions, 23 deletions
diff --git a/pkgs/development/python-modules/json-logging/default.nix b/pkgs/development/python-modules/json-logging/default.nix
index 3d22f4e878baa..ee5805e39a1ba 100644
--- a/pkgs/development/python-modules/json-logging/default.nix
+++ b/pkgs/development/python-modules/json-logging/default.nix
@@ -1,22 +1,24 @@
-{ lib
-, buildPythonPackage
-, fastapi
-, fetchFromGitHub
-, flask
-, httpx
-, pytestCheckHook
-, pythonOlder
-, quart
-, requests
-, sanic
-, uvicorn
-, wheel
+{
+  lib,
+  buildPythonPackage,
+  fastapi,
+  fetchFromGitHub,
+  flask,
+  httpx,
+  pytestCheckHook,
+  pythonOlder,
+  pythonAtLeast,
+  quart,
+  requests,
+  sanic,
+  setuptools,
+  uvicorn,
 }:
 
 buildPythonPackage rec {
   pname = "json-logging";
   version = "1.5.0-rc0";
-  format = "setuptools";
+  pyproject = true;
 
   disabled = pythonOlder "3.7";
 
@@ -27,25 +29,29 @@ buildPythonPackage rec {
     hash = "sha256-WOAEY1pONH+Gx1b8zHZDMNgJJSn7jvMO60LYTA8z/dE=";
   };
 
-  nativeCheckInputs = [
+  # The logging module introduced the `taskName` field in Python 3.12, which the tests don't expect
+  postPatch = lib.optionalString (pythonAtLeast "3.12") ''
+    substituteInPlace tests/helpers/constants.py \
+        --replace-fail '"written_at",' '"taskName", "written_at",'
+  '';
+
+  build-system = [ setuptools ];
+
+  dependencies = [
     fastapi
     flask
     httpx
-    pytestCheckHook
     quart
     requests
     sanic
     uvicorn
-    wheel
   ];
 
-  pythonImportsCheck = [
-    "json_logging"
-  ];
+  nativeCheckInputs = [ pytestCheckHook ];
 
-  disabledTests = [
-    "quart"
-  ];
+  pythonImportsCheck = [ "json_logging" ];
+
+  disabledTests = [ "quart" ];
 
   disabledTestPaths = [
     # Smoke tests don't always work