nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonAtLeast,
6
7 # build-system
8 hatchling,
9 pre-commit,
10 toml,
11
12 # dependencies
13 alembic,
14 click,
15 granian,
16 httpx,
17 packaging,
18 platformdirs,
19 psutil,
20 pydantic,
21 python-multipart,
22 python-socketio,
23 redis,
24 reflex-hosting-cli,
25 rich,
26 sqlmodel,
27 starlette,
28 typing-extensions,
29 wrapt,
30
31 # tests
32 attrs,
33 numpy,
34 pandas,
35 pillow,
36 playwright,
37 plotly,
38 pytest-asyncio,
39 pytest-mock,
40 pytestCheckHook,
41 python-dotenv,
42 ruff,
43 starlette-admin,
44 unzip,
45 uvicorn,
46 versionCheckHook,
47 writableTmpDirAsHomeHook,
48}:
49
50buildPythonPackage (finalAttrs: {
51 pname = "reflex";
52 version = "0.8.26";
53 pyproject = true;
54
55 src = fetchFromGitHub {
56 owner = "reflex-dev";
57 repo = "reflex";
58 tag = "v${finalAttrs.version}";
59 hash = "sha256-pV7J+O7WaD7hzrjvqOFtrj8CKT+SX6KWHot/VxEMtZQ=";
60 };
61
62 # For some reason, pre_commit is supposedly missing when python>=3.14
63 postPatch = lib.optionalString (pythonAtLeast "3.14") ''
64 substituteInPlace pyproject.toml \
65 --replace-fail '"pre_commit", ' ""
66 '';
67
68 build-system = [
69 hatchling
70 pre-commit
71 toml
72 ];
73
74 dependencies = [
75 alembic
76 click
77 granian
78 httpx
79 packaging
80 platformdirs
81 psutil
82 pydantic
83 python-multipart
84 python-socketio
85 redis
86 reflex-hosting-cli
87 rich
88 sqlmodel
89 starlette
90 typing-extensions
91 wrapt
92 ]
93 ++ granian.optional-dependencies.reload;
94
95 nativeCheckInputs = [
96 attrs
97 numpy
98 pandas
99 pillow
100 playwright
101 plotly
102 pytest-asyncio
103 pytest-mock
104 pytestCheckHook
105 python-dotenv
106 ruff
107 starlette-admin
108 unzip
109 uvicorn
110 versionCheckHook
111 writableTmpDirAsHomeHook
112 ];
113 versionCheckProgramArg = "--version";
114
115 disabledTests = [
116 # Tests touch network
117 "test_find_and_check_urls"
118 "test_event_actions"
119 "test_upload_file"
120 "test_node_version"
121 # /proc is too funky in nix sandbox
122 "test_get_cpu_info"
123 # flaky
124 "test_preprocess" # KeyError: 'reflex___state____state'
125 "test_send" # AssertionError: Expected 'post' to have been called once. Called 0 times.
126 # tries to pin the string of a traceback, doesn't account for ansi colors
127 "test_state_with_invalid_yield"
128 # tries to run bun or npm
129 "test_output_system_info"
130 # Comparison with magic string
131 "test_background_task_no_block"
132 # reflex.utils.exceptions.StateSerializationError: Failed to serialize state
133 # reflex___istate___dynamic____dill_state due to unpicklable object.
134 "test_fallback_pickle"
135 ];
136
137 disabledTestPaths = [
138 "tests/benchmarks/"
139 "tests/integration/"
140 ];
141
142 __darwinAllowLocalNetworking = true;
143
144 pythonImportsCheck = [ "reflex" ];
145
146 meta = {
147 description = "Web apps in pure Python";
148 homepage = "https://github.com/reflex-dev/reflex";
149 changelog = "https://github.com/reflex-dev/reflex/releases/tag/${finalAttrs.src.tag}";
150 license = lib.licenses.asl20;
151 maintainers = with lib.maintainers; [ pbsds ];
152 mainProgram = "reflex";
153 };
154})