-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
pyproject.toml
239 lines (209 loc) · 6.45 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "hatch-build-scripts"]
##############################
# >>> Hatch Build Config <<< #
##############################
[project]
name = "reactpy_django"
description = "It's React, but in Python. Now with Django integration."
readme = "README.md"
keywords = [
"React",
"ReactJS",
"ReactPy",
"components",
"asgi",
"django",
"http",
"server",
"reactive",
"interactive",
]
license = "MIT"
authors = [{ name = "Mark Bakhit", email = "[email protected]" }]
requires-python = ">=3.9"
classifiers = [
"Framework :: Django",
"Framework :: Django :: 4.0",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Multimedia :: Graphics",
"Topic :: Software Development :: Widget Sets",
"Topic :: Software Development :: User Interfaces",
"Environment :: Web Environment",
"Typing :: Typed",
]
dependencies = [
"channels>=4.0.0",
"django>=4.2.0",
"reactpy>=1.1.0, <2.0.0",
"reactpy-router>=1.0.3, <2.0.0",
"dill>=0.3.5",
"orjson>=3.6.0",
"nest_asyncio>=1.5.0",
"typing_extensions",
]
dynamic = ["version"]
urls.Changelog = "https://reactive-python.github.io/reactpy-django/latest/about/changelog/"
urls.Documentation = "https://reactive-python.github.io/reactpy-django/"
urls.Source = "https://github.com/reactive-python/reactpy-django"
[tool.hatch.version]
path = "src/reactpy_django/__init__.py"
[tool.hatch.build.targets.sdist]
include = ["/src"]
artifacts = ["/src/reactpy_django/static/"]
[tool.hatch.build.targets.wheel]
artifacts = ["/src/reactpy_django/static/"]
[tool.hatch.metadata]
license-files = { paths = ["LICENSE.md"] }
[tool.hatch.envs.default]
installer = "uv"
[[tool.hatch.build.hooks.build-scripts.scripts]]
commands = [
"bun install --cwd src/js",
"bun build src/js/src/index.ts --outfile src/reactpy_django/static/reactpy_django/client.js --minify",
'cd src/build_scripts && python copy_dir.py "src/js/node_modules/@pyscript/core/dist" "src/reactpy_django/static/reactpy_django/pyscript"',
'cd src/build_scripts && python copy_dir.py "src/js/node_modules/morphdom/dist" "src/reactpy_django/static/reactpy_django/morphdom"',
]
artifacts = []
#############################
# >>> Hatch Test Runner <<< #
#############################
[tool.hatch.envs.hatch-test]
extra-dependencies = [
"pytest-sugar",
"pytest-django",
"playwright",
"channels[daphne]>=4.0.0",
"twisted",
"tblib",
"servestatic",
"django-bootstrap5",
"decorator",
]
matrix-name-format = "{variable}-{value}"
# Django 4.2
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.9", "3.10", "3.11", "3.12"]
django = ["4.2"]
# Django 5.0
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.10", "3.11", "3.12"]
django = ["5.0"]
# Django 5.1
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.10", "3.11", "3.12", "3.13"]
django = ["5.1"]
[tool.hatch.envs.hatch-test.overrides]
matrix.django.dependencies = [
{ if = [
"4.2",
], value = "django~=4.2" },
{ if = [
"5.0",
], value = "django~=5.0" },
{ if = [
"5.1",
], value = "django~=5.1" },
]
[tool.pytest.ini_options]
addopts = """\
--strict-config
--strict-markers
--reuse-db
"""
django_find_project = false
DJANGO_SETTINGS_MODULE = "test_app.settings_single_db"
pythonpath = [".", "tests/"]
################################
# >>> Hatch Django Scripts <<< #
################################
[tool.hatch.envs.django]
extra-dependencies = [
"channels[daphne]>=4.0.0",
"twisted",
"servestatic",
"django-bootstrap5",
]
[tool.hatch.envs.django.scripts]
runserver = [
"cd tests && python manage.py migrate --noinput",
"cd tests && python manage.py runserver",
]
#######################################
# >>> Hatch Documentation Scripts <<< #
#######################################
[tool.hatch.envs.docs]
template = "docs"
extra-dependencies = [
"mkdocs",
"mkdocs-git-revision-date-localized-plugin",
"mkdocs-material==9.4.0",
"mkdocs-include-markdown-plugin",
"mkdocs-spellcheck[all]",
"mkdocs-git-authors-plugin",
"mkdocs-minify-plugin",
"mike",
"ruff",
"django-stubs",
"linkcheckmd",
]
[tool.hatch.envs.docs.scripts]
serve = ["cd docs && mkdocs serve"]
build = ["cd docs && mkdocs build --strict"]
linkcheck = [
"linkcheckMarkdown docs/ -v -r --method head",
"linkcheckMarkdown README.md -v -r",
"linkcheckMarkdown CHANGELOG.md -v -r",
]
deploy_latest = ["cd docs && mike deploy --push --update-aliases {args} latest"]
deploy_develop = ["cd docs && mike deploy --push develop"]
################################
# >>> Hatch Python Scripts <<< #
################################
[tool.hatch.envs.python]
extra-dependencies = ["django-stubs", "channels-redis", "pyright"]
[tool.hatch.envs.python.scripts]
type_check = ["pyright src"]
############################
# >>> Hatch JS Scripts <<< #
############################
[tool.hatch.envs.javascript]
detached = true
[tool.hatch.envs.javascript.scripts]
check = ["cd src/js && bun install", "cd src/js && bun run check"]
fix = ["cd src/js && bun install", "cd src/js && bun run format"]
#########################
# >>> Generic Tools <<< #
#########################
[tool.ruff]
extend-exclude = ["*/migrations/*", ".venv/*", ".eggs/*", "build/*"]
line-length = 120
format.preview = true
lint.extend-ignore = [
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"ARG004", # Unused static method argument
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"PLR2004", # Magic value used in comparison
"SIM115", # Use context handler for opening files
"SLF001", # Private member accessed
"E501", # Line too long
"PLC0415", # `import` should be at the top-level of a file
"BLE001", # Do not catch blind exception: `Exception`
"PLW0603", # Using global statement is discouraged
"PLR6301", # Method could be a function, class method, or static method
"S403", # `dill` module is possibly insecure
"S301", # `dill` deserialization is possibly insecure unless using trusted data
"RUF029", # Function is declared async but doesn't contain await expression
]
lint.preview = true
lint.isort.known-first-party = ["reactpy_django", "test_app", "example"]
lint.isort.known-third-party = ["js"]