summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/drf-flex-fields/default.nix
blob: 5309cd811908897a3b72ed255269916d00566a01 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  appdirs,
  asgiref,
  attrs,
  black,
  click,
  django,
  djangorestframework,
  entrypoints,
  flake8,
  mccabe,
  mypy,
  mypy-extensions,
  pycodestyle,
  pyflakes,
  pytz,
  sqlparse,
  toml,
  typing-extensions,

  # tests
  pytestCheckHook,
  pytest-django,
}:

buildPythonPackage rec {
  pname = "drf-flex-fields";
  version = "1.0.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "rsinger86";
    repo = "drf-flex-fields";
    tag = version;
    hash = "sha256-+9ToxCEIDpsA+BK8Uk0VueVjoId41/S93+a716EGvCU=";
  };

  patches = [ ./django4-compat.patch ];

  build-system = [ setuptools ];

  nativeCheckInputs = [
    django
    djangorestframework
    pytestCheckHook
    pytest-django
  ];

  preCheck = ''
    export DJANGO_SETTINGS_MODULE=tests.settings
  '';

  meta = {
    changelog = "https://github.com/rsinger86/drf-flex-fields/releases/tag/${src.tag}";
    description = "Dynamically set fields and expand nested resources in Django REST Framework serializers";
    homepage = "https://github.com/rsinger86/drf-flex-fields";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ hexa ];
  };
}