summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/flask-restful/default.nix
blob: def4743eccb99ce3d1a5ba9bc31c179dbf3baf91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  lib,
  aniso8601,
  blinker,
  buildPythonPackage,
  fetchPypi,
  flask,
  fetchpatch2,
  mock,
  pytest8_3CheckHook,
  pytz,
  six,
  werkzeug,
}:

buildPythonPackage rec {
  pname = "flask-restful";
  version = "0.3.10";
  format = "setuptools";

  src = fetchPypi {
    pname = "Flask-RESTful";
    inherit version;
    hash = "sha256-/kry7wAn34+bT3l6uiDFVmgBtq3plaxjtYir8aWc7Dc=";
  };

  # conditional so that overrides are easier for web applications
  patches =
    lib.optionals (lib.versionAtLeast werkzeug.version "2.1.0") [ ./werkzeug-2.1.0-compat.patch ]
    ++ lib.optionals (lib.versionAtLeast flask.version "3.0.0") [ ./flask-3.0-compat.patch ]
    ++ [
      # replace use nose by pytest: https://github.com/flask-restful/flask-restful/pull/970
      (fetchpatch2 {
        url = "https://github.com/flask-restful/flask-restful/commit/6cc4b057e5450e0c84b3ee5f6f7a97e648a816d6.patch?full_index=1";
        hash = "sha256-kIjrkyL0OfX+gjoiYfchU0QYTPHz4JMCQcHLFH9oEF4=";
      })
      ./fix-test-inputs.patch
    ];

  propagatedBuildInputs = [
    aniso8601
    flask
    pytz
    six
  ];

  nativeCheckInputs = [
    blinker
    mock
    pytest8_3CheckHook
  ];

  disabledTests = [
    # Broke in flask 2.2 upgrade
    "test_exception_header_forwarded"
    # Broke in werkzeug 2.3 upgrade
    "test_media_types_method"
    "test_media_types_q"
    # time shenanigans
    "test_iso8601_date_field_with_offset"
    "test_rfc822_date_field_with_offset"
  ];

  pythonImportsCheck = [ "flask_restful" ];

  meta = {
    description = "Framework for creating REST APIs";
    homepage = "https://flask-restful.readthedocs.io";
    longDescription = ''
      Flask-RESTful provides the building blocks for creating a great
      REST API.
    '';
    license = lib.licenses.bsd3;
    maintainers = [ ];
  };
}