1{
2 lib,
3 buildPythonPackage,
4 django-stubs-ext,
5 django,
6 fetchFromGitHub,
7 hatchling,
8 redis,
9 mypy,
10 pytest-mypy-plugins,
11 oracledb,
12 pytestCheckHook,
13 pythonOlder,
14 tomli,
15 types-pytz,
16 types-pyyaml,
17 types-redis,
18 typing-extensions,
19}:
20
21buildPythonPackage rec {
22 pname = "django-stubs";
23 version = "5.2.2";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "typeddjango";
28 repo = "django-stubs";
29 tag = version;
30 hash = "sha256-kF5g0/rkMQxYTfSrTqzZ6BuqGlE42K/AVhc1/ARc+/c=";
31 };
32
33 build-system = [ hatchling ];
34
35 dependencies = [
36 django
37 django-stubs-ext
38 types-pytz
39 types-pyyaml
40 typing-extensions
41 ]
42 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
43
44 optional-dependencies = {
45 compatible-mypy = [ mypy ];
46 oracle = [ oracledb ];
47 redis = [
48 redis
49 types-redis
50 ];
51 };
52
53 nativeCheckInputs = [
54 pytest-mypy-plugins
55 pytestCheckHook
56 ]
57 ++ lib.flatten (lib.attrValues optional-dependencies);
58
59 disabledTests = [
60 # AttributeError: module 'django.contrib.auth.forms' has no attribute 'SetUnusablePasswordMixin'
61 "test_find_classes_inheriting_from_generic"
62 ];
63
64 disabledTestPaths = [
65 # Skip type checking
66 "tests/typecheck/"
67 ];
68
69 pythonImportsCheck = [ "django-stubs" ];
70
71 meta = with lib; {
72 description = "PEP-484 stubs for Django";
73 homepage = "https://github.com/typeddjango/django-stubs";
74 changelog = "https://github.com/typeddjango/django-stubs/releases/tag/${version}";
75 license = licenses.mit;
76 maintainers = with maintainers; [ ];
77 };
78}