From f2cd48bb9c12fba299375e93225a70d4aa2f2680 Mon Sep 17 00:00:00 2001 From: Kerstin Humm Date: Sat, 15 Feb 2025 15:38:38 +0100 Subject: [PATCH] python3Packages.drf-standardized-errors: init at 0.14.1 --- .../drf-standardized-errors/default.nix | 66 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 68 insertions(+) create mode 100644 pkgs/development/python-modules/drf-standardized-errors/default.nix diff --git a/pkgs/development/python-modules/drf-standardized-errors/default.nix b/pkgs/development/python-modules/drf-standardized-errors/default.nix new file mode 100644 index 000000000000..c20114c2542f --- /dev/null +++ b/pkgs/development/python-modules/drf-standardized-errors/default.nix @@ -0,0 +1,66 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + fetchpatch, + flit-core, + django, + djangorestframework, + drf-spectacular, + inflection, + pytestCheckHook, + pytest-django, + django-filter, +}: + +buildPythonPackage rec { + pname = "drf-standardized-errors"; + version = "0.14.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "ghazi-git"; + repo = "drf-standardized-errors"; + tag = "v${version}"; + hash = "sha256-Gr4nj2dd0kZTc4IbLhb0i3CnY+VZaNnr3YJctyxIgQU="; + }; + + patches = [ + # fix test_openapi_utils test + (fetchpatch { + url = "https://github.com/ghazi-git/drf-standardized-errors/pull/96/commits/4a2b1be3c97cd6db50543e6ff0303c0df0731d8a.patch"; + hash = "sha256-8+zVzBX7yDGfpsyvj61auqV+zdG6mIyj2LtR3D8l4jc="; + }) + ]; + + build-system = [ flit-core ]; + + dependencies = [ + django + djangorestframework + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-django + django-filter + drf-spectacular + ]; + + env.DJANGO_SETTINGS_MODULE = "tests.settings"; + + pythonImportsCheck = [ "drf_standardized_errors" ]; + + optional-dependencies.openapi = [ + drf-spectacular + inflection + ]; + + meta = with lib; { + description = "Standardize your DRF API error responses"; + homepage = "https://github.com/ghazi-git/drf-standardized-errors"; + changelog = "https://github.com/ghazi-git/drf-standardized-errors/releases/tag/${src.tag}"; + license = licenses.mit; + maintainers = with maintainers; [ erictapen ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 51bc0c6ba105..1852bf1e842f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3926,6 +3926,8 @@ self: super: with self; { drf-spectacular-sidecar = callPackage ../development/python-modules/drf-spectacular-sidecar { }; + drf-standardized-errors = callPackage ../development/python-modules/drf-standardized-errors { }; + drf-ujson2 = callPackage ../development/python-modules/drf-ujson2 { }; drf-writable-nested = callPackage ../development/python-modules/drf-writable-nested { };