1{ stdenv
2, lib
3, buildPythonPackage
4, pythonAtLeast
5, pythonOlder
6, fetchFromGitHub
7
8, graphene
9, graphql-core
10, django
11, djangorestframework
12, promise
13, text-unidecode
14
15, django-filter
16, mock
17, py
18, pytest-django
19, pytest-random-order
20, pytestCheckHook
21}:
22
23buildPythonPackage rec {
24 pname = "graphene-django";
25 version = "3.1.5";
26 format = "setuptools";
27
28 disabled = pythonOlder "3.6";
29
30 src = fetchFromGitHub {
31 owner = "graphql-python";
32 repo = pname;
33 rev = "refs/tags/v${version}";
34 hash = "sha256-1vl1Yj9MVBej5aFND8A63JMIog8aIW9SdwiOLIUwXxI=";
35 };
36
37 postPatch = ''
38 substituteInPlace setup.py \
39 --replace '"pytest-runner"' ""
40 '';
41
42 propagatedBuildInputs = [
43 djangorestframework
44 graphene
45 graphql-core
46 django
47 promise
48 text-unidecode
49 ];
50
51 preCheck = ''
52 export DJANGO_SETTINGS_MODULE=examples.django_test_settings
53 '';
54
55 nativeCheckInputs = [
56 django-filter
57 mock
58 py
59 pytest-django
60 pytest-random-order
61 pytestCheckHook
62 ];
63
64 disabledTests = lib.optionals (pythonAtLeast "3.11") [
65 # Python 3.11 support, https://github.com/graphql-python/graphene-django/pull/1365
66 "test_django_objecttype_convert_choices_enum_naming_collisions"
67 "test_django_objecttype_choices_custom_enum_name"
68 "test_django_objecttype_convert_choices_enum_list"
69 "test_schema_representation"
70 ] ++ lib.optionals stdenv.isDarwin [
71 # this test touches files in the "/" directory and fails in darwin sandbox
72 "test_should_filepath_convert_string"
73 ];
74
75 meta = with lib; {
76 description = "Integrate GraphQL into your Django project";
77 homepage = "https://github.com/graphql-python/graphene-django";
78 changelog = "https://github.com/graphql-python/graphene-django/releases/tag/v${version}";
79 license = licenses.mit;
80 maintainers = with maintainers; [ hexa ];
81 };
82}