summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/drf-extra-fields/default.nix
blob: 5ca6b0facc552939f6ee58297895b9953678e373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
  lib,
  buildPythonPackage,
  django,
  djangorestframework,
  fetchFromGitHub,
  filetype,
  pillow,
  psycopg2,
  pytest-django,
  pytestCheckHook,
  pythonAtLeast,
  setuptools,
  pytz,
}:

buildPythonPackage rec {
  pname = "drf-extra-fields";
  version = "3.7.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "hipo";
    repo = "drf-extra-fields";
    tag = "v${version}";
    hash = "sha256-Ym4vnZ/t0ZdSxU53BC0ducJl1YiTygRSWql/35PNbOU";
  };

  build-system = [ setuptools ];

  dependencies = [
    django
    djangorestframework
    filetype
  ];

  optional-dependencies = {
    Base64ImageField = [ pillow ];
  };

  nativeCheckInputs = [
    (django.override { withGdal = true; })
    psycopg2
    pytestCheckHook
    pytest-django
    pytz
  ]
  ++ optional-dependencies.Base64ImageField;

  pythonImportsCheck = [ "drf_extra_fields" ];

  disabledTests = [
    # pytz causes the following tests to fail
    "test_create"
    "test_create_with_base64_prefix"
    "test_create_with_webp_image"
    "test_remove_with_empty_string"
  ]
  ++ lib.optionals (pythonAtLeast "3.13") [
    # https://github.com/Hipo/drf-extra-fields/issues/210
    "test_read_source_with_context"
  ];

  meta = {
    description = "Extra Fields for Django Rest Framework";
    homepage = "https://github.com/Hipo/drf-extra-fields";
    changelog = "https://github.com/Hipo/drf-extra-fields/releases/tag/${src.rev}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ felbinger ];
  };
}