1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 setuptools,
7 pytestCheckHook,
8 matplotlib,
9 legacy-cgi,
10 python-snap7,
11 opencv4,
12}:
13
14buildPythonPackage rec {
15 pname = "remi";
16 version = "2022.7.27";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "rawpython";
21 repo = "remi";
22 rev = version;
23 hash = "sha256-VQn+Uzp6oGSit8ot0e8B0C2N41Q8+J+o91skyVN1gDA=";
24 };
25
26 preCheck = ''
27 # for some reason, REMI already deal with these using try blocks, but they fail
28 substituteInPlace test/test_widget.py \
29 --replace-fail \
30 "from html_validator import " \
31 "from .html_validator import "
32 substituteInPlace test/test_examples_app.py \
33 --replace-fail \
34 "from mock_server_and_request import " \
35 "from .mock_server_and_request import " \
36 --replace-fail \
37 "from html_validator import " \
38 "from .html_validator import "
39 # Halves number of warnings
40 substituteInPlace test/test_*.py \
41 --replace-quiet \
42 "self.assertEquals(" \
43 "self.assertEqual("
44 '';
45
46 build-system = [ setuptools ];
47
48 dependencies = [
49 setuptools # pkg_resources is referenced at runtime
50 ]
51 ++ lib.optionals (!pythonOlder "3.13") [
52 legacy-cgi
53 ];
54
55 nativeCheckInputs = [
56 pytestCheckHook
57 python-snap7
58 opencv4
59 matplotlib
60 ];
61
62 pythonImportsCheck = [
63 "remi"
64 "editor"
65 "editor.widgets"
66 ];
67
68 meta = {
69 description = "Pythonic, lightweight and websocket-based webui library";
70 homepage = "https://github.com/rawpython/remi";
71 license = with lib.licenses; [ asl20 ];
72 maintainers = with lib.maintainers; [ pbsds ];
73 };
74}