1{ lib
2, buildPythonPackage
3, pythonAtLeast
4, fetchFromGitHub
5, colorcet
6, cryptography
7, flask
8, flask-compress
9, flask-cors
10, flask-sockets
11, gevent
12, imageio
13, numpy
14, pillow
15, pyopenssl
16, scipy
17, six
18, unidecode
19, urllib3
20, wget
21, deepdiff
22, pytest-cov
23, pytestCheckHook
24, pythonOlder
25, websocket-client
26}:
27
28buildPythonPackage rec {
29 pname = "runway-python";
30 version = "0.6.1";
31 format = "setuptools";
32
33 disabled = pythonOlder "3.6";
34
35 src = fetchFromGitHub {
36 owner = "runwayml";
37 repo = "model-sdk";
38 rev = version;
39 hash = "sha256-Qn+gsvxxUJee7k060lPk53qi15xwC/JORJ5aHKLigvM=";
40 };
41
42 propagatedBuildInputs = [
43 colorcet
44 cryptography
45 flask
46 flask-compress
47 flask-cors
48 flask-sockets
49 gevent
50 imageio
51 numpy
52 pillow
53 pyopenssl
54 scipy
55 six
56 unidecode
57 urllib3
58 wget
59 ] ++ urllib3.optional-dependencies.secure;
60
61 checkInputs = [
62 deepdiff
63 pytest-cov
64 pytestCheckHook
65 websocket-client
66 ];
67
68 postPatch = ''
69 # Build fails with:
70 # ERROR: No matching distribution found for urllib3-secure-extra; extra == "secure"
71 substituteInPlace requirements.txt \
72 --replace "urllib3[secure]>=1.25.7" "urllib3"
73 '';
74
75 disabledTests = [
76 # These tests require network
77 "test_file_deserialization_remote"
78 "test_file_deserialization_absolute_directory"
79 "test_file_deserialization_remote_directory"
80 # Fails with a decoding error at the moment
81 "test_inference_async"
82 ] ++ lib.optionals (pythonAtLeast "3.9") [
83 # AttributeError: module 'base64' has no attribute 'decodestring
84 # https://github.com/runwayml/model-sdk/issues/99
85 "test_image_serialize_and_deserialize"
86 "test_segmentation_serialize_and_deserialize_colormap"
87 "test_segmentation_serialize_and_deserialize_labelmap"
88 ];
89
90 pythonImportsCheck = [
91 "runway"
92 ];
93
94 meta = {
95 description = "Helper library for creating Runway models";
96 homepage = "https://github.com/runwayml/model-sdk";
97 license = with lib.licenses; [ mit ];
98 maintainers = with lib.maintainers; [ prusnak ];
99 };
100}