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