1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 alembic,
6 attrs,
7 build,
8 ruff,
9 dill,
10 granian,
11 hatchling,
12 httpx,
13 jinja2,
14 numpy,
15 packaging,
16 pandas,
17 pillow,
18 platformdirs,
19 playwright,
20 plotly,
21 psutil,
22 pydantic,
23 pytest-asyncio,
24 pytest-mock,
25 python-dotenv,
26 pytestCheckHook,
27 python-multipart,
28 python-socketio,
29 redis,
30 reflex-hosting-cli,
31 rich,
32 sqlmodel,
33 starlette-admin,
34 stdenv,
35 typer,
36 typing-extensions,
37 unzip,
38 uvicorn,
39 versionCheckHook,
40 wrapt,
41 writableTmpDirAsHomeHook,
42}:
43
44buildPythonPackage rec {
45 pname = "reflex";
46 version = "0.8.6";
47 pyproject = true;
48
49 src = fetchFromGitHub {
50 owner = "reflex-dev";
51 repo = "reflex";
52 tag = "v${version}";
53 hash = "sha256-Tas67x9UEFSR7yyENvixzCWbbKgP+OBMw6prnxWgCQo=";
54 };
55
56 # 'rich' is also somehow checked when building the wheel,
57 # pythonRelaxDepsHook modifies the wheel METADATA in postBuild
58 pypaBuildFlags = [ "--skip-dependency-check" ];
59
60 pythonRelaxDeps = [
61 # needed
62 "click"
63 "starlette"
64 "rich"
65 ];
66
67 build-system = [ hatchling ];
68
69 dependencies = [
70 alembic
71 build # used in custom_components/custom_components.py
72 dill # used in state.py
73 granian
74 granian.optional-dependencies.reload
75 httpx
76 jinja2
77 packaging # used in utils/prerequisites.py
78 platformdirs
79 psutil
80 pydantic
81 python-multipart
82 python-socketio
83 redis
84 reflex-hosting-cli
85 rich
86 sqlmodel
87 typer # optional dep
88 typing-extensions
89 wrapt
90 ];
91
92 nativeCheckInputs = [
93 pytestCheckHook
94 pytest-asyncio
95 pytest-mock
96 python-dotenv
97 ruff
98 playwright
99 attrs
100 numpy
101 plotly
102 pandas
103 pillow
104 unzip
105 uvicorn
106 starlette-admin
107 writableTmpDirAsHomeHook
108 versionCheckHook
109 ];
110 versionCheckProgramArg = "--version";
111
112 disabledTests = [
113 # Tests touch network
114 "test_find_and_check_urls"
115 "test_event_actions"
116 "test_upload_file"
117 "test_node_version"
118 # /proc is too funky in nix sandbox
119 "test_get_cpu_info"
120 # flaky
121 "test_preprocess" # KeyError: 'reflex___state____state'
122 "test_send" # AssertionError: Expected 'post' to have been called once. Called 0 times.
123 # tries to pin the string of a traceback, doesn't account for ansi colors
124 "test_state_with_invalid_yield"
125 # tries to run bun or npm
126 "test_output_system_info"
127 # Comparison with magic string
128 "test_background_task_no_block"
129 ]
130 ++ lib.optionals stdenv.hostPlatform.isDarwin [
131 # PermissionError: [Errno 1] Operation not permitted (fails in sandbox)
132 "test_is_process_on_port_free_port"
133 "test_is_process_on_port_occupied_port"
134 "test_is_process_on_port_both_protocols"
135 "test_is_process_on_port_concurrent_access"
136 ];
137
138 disabledTestPaths = [
139 "tests/benchmarks/"
140 "tests/integration/"
141 ];
142
143 pythonImportsCheck = [ "reflex" ];
144
145 meta = {
146 description = "Web apps in pure Python";
147 homepage = "https://github.com/reflex-dev/reflex";
148 changelog = "https://github.com/reflex-dev/reflex/releases/tag/${src.tag}";
149 license = lib.licenses.asl20;
150 maintainers = with lib.maintainers; [ pbsds ];
151 mainProgram = "reflex";
152 };
153}