1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 alembic,
6 attrs,
7 build,
8 ruff,
9 dill,
10 fastapi,
11 granian,
12 hatchling,
13 httpx,
14 jinja2,
15 numpy,
16 packaging,
17 pandas,
18 pillow,
19 platformdirs,
20 playwright,
21 plotly,
22 psutil,
23 pydantic,
24 pytest-asyncio,
25 pytest-mock,
26 python-dotenv,
27 pytestCheckHook,
28 python-multipart,
29 python-socketio,
30 redis,
31 reflex-hosting-cli,
32 rich,
33 sqlmodel,
34 starlette-admin,
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.7.11";
47 pyproject = true;
48
49 src = fetchFromGitHub {
50 owner = "reflex-dev";
51 repo = "reflex";
52 tag = "v${version}";
53 hash = "sha256-WL61XQGBkTXHQBMEbw/pr+PrkinUGT8cPGhquduPgRY=";
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 "rich"
63 # preventative
64 "fastapi"
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 fastapi
74 granian
75 granian.optional-dependencies.reload
76 httpx
77 jinja2
78 packaging # used in utils/prerequisites.py
79 platformdirs
80 psutil
81 pydantic
82 python-multipart
83 python-socketio
84 redis
85 reflex-hosting-cli
86 rich
87 sqlmodel
88 typer # optional dep
89 typing-extensions
90 wrapt
91 ];
92
93 nativeCheckInputs = [
94 pytestCheckHook
95 pytest-asyncio
96 pytest-mock
97 python-dotenv
98 ruff
99 playwright
100 attrs
101 numpy
102 plotly
103 pandas
104 pillow
105 unzip
106 uvicorn
107 starlette-admin
108 writableTmpDirAsHomeHook
109 versionCheckHook
110 ];
111 versionCheckProgramArg = "--version";
112
113 disabledTests = [
114 # Tests touch network
115 "test_find_and_check_urls"
116 "test_event_actions"
117 "test_upload_file"
118 "test_node_version"
119 # /proc is too funky in nix sandbox
120 "test_get_cpu_info"
121 # flaky
122 "test_preprocess" # KeyError: 'reflex___state____state'
123 "test_send" # AssertionError: Expected 'post' to have been called once. Called 0 times.
124 # tries to pin the string of a traceback, doesn't account for ansi colors
125 "test_state_with_invalid_yield"
126 # tries to run bun or npm
127 "test_output_system_info"
128 ];
129
130 disabledTestPaths = [
131 "tests/benchmarks/"
132 "tests/integration/"
133 ];
134
135 pythonImportsCheck = [ "reflex" ];
136
137 meta = {
138 description = "Web apps in pure Python";
139 homepage = "https://github.com/reflex-dev/reflex";
140 changelog = "https://github.com/reflex-dev/reflex/releases/tag/${src.tag}";
141 license = lib.licenses.asl20;
142 maintainers = with lib.maintainers; [ pbsds ];
143 mainProgram = "reflex";
144 };
145}