1{
2 lib,
3 buildPythonPackage,
4 django,
5 djangorestframework,
6 fetchFromGitHub,
7 filetype,
8 pillow,
9 psycopg2,
10 pytest-django,
11 pytestCheckHook,
12 pythonAtLeast,
13 setuptools,
14 pytz,
15}:
16
17buildPythonPackage rec {
18 pname = "drf-extra-fields";
19 version = "3.7.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "hipo";
24 repo = "drf-extra-fields";
25 tag = "v${version}";
26 hash = "sha256-Ym4vnZ/t0ZdSxU53BC0ducJl1YiTygRSWql/35PNbOU";
27 };
28
29 build-system = [ setuptools ];
30
31 dependencies = [
32 django
33 djangorestframework
34 filetype
35 ];
36
37 optional-dependencies = {
38 Base64ImageField = [ pillow ];
39 };
40
41 nativeCheckInputs = [
42 (django.override { withGdal = true; })
43 psycopg2
44 pytestCheckHook
45 pytest-django
46 pytz
47 ]
48 ++ optional-dependencies.Base64ImageField;
49
50 pythonImportsCheck = [ "drf_extra_fields" ];
51
52 disabledTests = [
53 # pytz causes the following tests to fail
54 "test_create"
55 "test_create_with_base64_prefix"
56 "test_create_with_webp_image"
57 "test_remove_with_empty_string"
58 ]
59 ++ lib.optionals (pythonAtLeast "3.13") [
60 # https://github.com/Hipo/drf-extra-fields/issues/210
61 "test_read_source_with_context"
62 ];
63
64 meta = {
65 description = "Extra Fields for Django Rest Framework";
66 homepage = "https://github.com/Hipo/drf-extra-fields";
67 changelog = "https://github.com/Hipo/drf-extra-fields/releases/tag/${src.rev}";
68 license = lib.licenses.asl20;
69 maintainers = with lib.maintainers; [ felbinger ];
70 };
71}