@@ -73,7 +73,7 @@ artifacts = ["*.pyi"]
7373
7474[tool .hatch .build .hooks .custom ]
7575path = " scripts/hatch_build.py"
76- dependencies = [" plotly" , " ruff" ]
76+ dependencies = [" plotly" , " ruff" , " pre_commit " , " toml " ]
7777require-runtime-dependencies = true
7878
7979[tool .pyright ]
@@ -149,7 +149,7 @@ dev = [
149149 " pillow >=11" ,
150150 " playwright >=1.51" ,
151151 " plotly >=6.0" ,
152- " pre-commit >= 4.2" ,
152+ " pre-commit == 4.2.0 " ,
153153 " psycopg[binary] >=3.2" ,
154154 " pyright >=1.1.400" ,
155155 " pytest >=8.3" ,
@@ -165,6 +165,7 @@ dev = [
165165 " ruff >=0.11" ,
166166 " selenium >=4.31" ,
167167 " starlette-admin >=0.14" ,
168+ " toml >=0.10.2" ,
168169 " uvicorn >=0.34.0" ,
169170]
170171
@@ -206,3 +207,53 @@ exclude_also = [
206207
207208[tool .coverage .html ]
208209directory = " coverage_html_report"
210+
211+ [tool .pre-commit ]
212+ fail_fast = true
213+
214+ [[tool .pre-commit .repos ]]
215+ repo = " https://github.com/astral-sh/ruff-pre-commit"
216+ rev = " v0.11.8"
217+ hooks = [
218+ { id = " ruff-format" , args = [
219+ " reflex" ,
220+ " tests" ,
221+ ] },
222+ { id = " ruff" , args = [
223+ " --fix" ,
224+ " --exit-non-zero-on-fix" ,
225+ ], exclude = " ^integration/benchmarks/" },
226+ ]
227+
228+ [[tool .pre-commit .repos ]]
229+ repo = " https://github.com/codespell-project/codespell"
230+ rev = " v2.4.1"
231+ hooks = [
232+ { id = " codespell" , args = [
233+ " reflex" ,
234+ ], additional_dependencies = [
235+ " tomli" ,
236+ ] },
237+ ]
238+
239+ # Run pyi check before pyright because pyright can fail if pyi files are wrong.
240+ [[tool .pre-commit .repos ]]
241+ repo = " local"
242+ hooks = [
243+ { id = " update-pyi-files" , name = " update-pyi-files" , always_run = true , language = " system" , require_serial = true , description = " Update pyi files as needed" , entry = " python3 scripts/make_pyi.py" },
244+ ]
245+
246+ [[tool .pre-commit .repos ]]
247+ repo = " https://github.com/RobertCraigie/pyright-python"
248+ rev = " v1.1.400"
249+ hooks = [{ id = " pyright" , args = [" reflex" , " tests" ], language = " system" }]
250+
251+ [[tool .pre-commit .repos ]]
252+ repo = " https://github.com/terrencepreilly/darglint"
253+ rev = " v1.8.1"
254+ hooks = [{ id = " darglint" , exclude = " ^reflex/reflex.py" }]
255+
256+ [[tool .pre-commit .repos ]]
257+ repo = " https://github.com/pre-commit/mirrors-prettier"
258+ rev = " f62a70a3a7114896b062de517d72829ea1c884b6"
259+ hooks = [{ id = " prettier" , require_serial = true }]
0 commit comments