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.14.5";
23 pyproject = true;
24
25 disabled = pythonOlder "3.8";
26
27 src = fetchFromGitHub {
28 owner = "typeddjango";
29 repo = "djangorestframework-stubs";
30 rev = "refs/tags/${version}";
31 hash = "sha256-AOhNlhTZ6Upevb/7Z1sUQoIkIlwYlIcf1CC+Ag7H4bg=";
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 passthru.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 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
55
56 # Upstream recommends mypy > 1.7 which we don't have yet, thus all testsare failing with 3.14.5 and below
57 doCheck = false;
58
59 pythonImportsCheck = [ "rest_framework-stubs" ];
60
61 meta = with lib; {
62 description = "PEP-484 stubs for Django REST Framework";
63 homepage = "https://github.com/typeddjango/djangorestframework-stubs";
64 changelog = "https://github.com/typeddjango/djangorestframework-stubs/releases/tag/${version}";
65 license = licenses.mit;
66 maintainers = with maintainers; [ elohmeier ];
67 };
68}