1{
2 lib,
3 buildPythonPackage,
4 django-stubs,
5 fetchFromGitHub,
6 mypy,
7 py,
8 coreapi,
9 pytest-mypy-plugins,
10 pytestCheckHook,
11 pythonOlder,
12 requests,
13 types-pyyaml,
14 setuptools,
15 types-markdown,
16 types-requests,
17 typing-extensions,
18}:
19
20buildPythonPackage rec {
21 pname = "djangorestframework-stubs";
22 version = "3.16.0";
23 pyproject = true;
24
25 disabled = pythonOlder "3.9";
26
27 src = fetchFromGitHub {
28 owner = "typeddjango";
29 repo = "djangorestframework-stubs";
30 tag = version;
31 hash = "sha256-q/9tCMT79TMHIQ4KH8tiunaTt7L6IItwNYBFlbNxBcE=";
32 };
33
34 nativeBuildInputs = [ setuptools ];
35
36 propagatedBuildInputs = [
37 django-stubs
38 requests
39 types-pyyaml
40 types-requests
41 typing-extensions
42 ];
43
44 optional-dependencies = {
45 compatible-mypy = [ mypy ] ++ django-stubs.optional-dependencies.compatible-mypy;
46 coreapi = [ coreapi ];
47 markdown = [ types-markdown ];
48 };
49
50 nativeCheckInputs = [
51 py
52 pytest-mypy-plugins
53 pytestCheckHook
54 ]
55 ++ lib.flatten (builtins.attrValues optional-dependencies);
56
57 # Upstream recommends mypy > 1.7 which we don't have yet, thus all testsare failing with 3.14.5 and below
58 doCheck = false;
59
60 pythonImportsCheck = [ "rest_framework-stubs" ];
61
62 meta = with lib; {
63 description = "PEP-484 stubs for Django REST Framework";
64 homepage = "https://github.com/typeddjango/djangorestframework-stubs";
65 changelog = "https://github.com/typeddjango/djangorestframework-stubs/releases/tag/${src.tag}";
66 license = licenses.mit;
67 maintainers = with maintainers; [ elohmeier ];
68 };
69}