wtforms-htmx-components 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wtforms_htmx_components-0.1.0/LICENSE.rst +28 -0
- wtforms_htmx_components-0.1.0/PKG-INFO +83 -0
- wtforms_htmx_components-0.1.0/README.md +53 -0
- wtforms_htmx_components-0.1.0/pyproject.toml +299 -0
- wtforms_htmx_components-0.1.0/pyproject.toml.orig +211 -0
- wtforms_htmx_components-0.1.0/src/wtforms_htmx_components/__init__.py +25 -0
- wtforms_htmx_components-0.1.0/src/wtforms_htmx_components/combobox.py +756 -0
- wtforms_htmx_components-0.1.0/src/wtforms_htmx_components/py.typed +0 -0
- wtforms_htmx_components-0.1.0/src/wtforms_htmx_components/validators.py +54 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Copyright 2026 WTForms
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
19
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
20
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
21
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
22
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
23
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
24
|
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
25
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
26
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
27
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
28
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wtforms-htmx-components
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Ready-made interactive WTForms fields built on wtforms-htmx.
|
|
5
|
+
Keywords: wtforms,htmx,forms,validation,combobox
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
License-File: LICENSE.rst
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Web Environment
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
19
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
20
|
+
Requires-Dist: wtforms>=3.3.0,<4
|
|
21
|
+
Requires-Dist: wtforms-htmx>=0.1.0
|
|
22
|
+
Maintainer: Éloi Rivard
|
|
23
|
+
Maintainer-email: Éloi Rivard <eloi@yaal.coop>
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Project-URL: Documentation, https://wtforms-htmx-components.readthedocs.io/
|
|
26
|
+
Project-URL: Changes, https://wtforms-htmx-components.readthedocs.io/changes/
|
|
27
|
+
Project-URL: Source Code, https://github.com/yaal-coop/wtforms-htmx-components
|
|
28
|
+
Project-URL: Issue Tracker, https://github.com/yaal-coop/wtforms-htmx-components/issues
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# wtforms-htmx-components
|
|
32
|
+
|
|
33
|
+
Ready-made interactive [WTForms](https://wtforms.readthedocs.io/) fields
|
|
34
|
+
built on [wtforms-htmx](https://github.com/yaal-coop/wtforms-htmx).
|
|
35
|
+
|
|
36
|
+
**Status: alpha, work in progress.**
|
|
37
|
+
|
|
38
|
+
Each field packages a recipe of several triggers (typing, suggestions,
|
|
39
|
+
pick, store, chip) into a single `FormField` declaration. Available now:
|
|
40
|
+
the combobox, single and multi value, strict or with free-form values.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
pip install wtforms-htmx-components
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Example
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from wtforms import SelectChoice
|
|
52
|
+
from wtforms import SubmitField
|
|
53
|
+
from wtforms_htmx import HtmxForm
|
|
54
|
+
from wtforms_htmx_components import ComboboxMultiField
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def suggest(query, form):
|
|
58
|
+
q = query.lower()
|
|
59
|
+
return [SelectChoice(tag, tag) for tag in CATALOG if q in tag.lower()]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class TagsForm(HtmxForm):
|
|
63
|
+
tags = ComboboxMultiField("Tags", suggest=suggest)
|
|
64
|
+
save = SubmitField()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Run the example app:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
uv sync --group example
|
|
71
|
+
uv run python -m examples
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then open <http://127.0.0.1:5000/>.
|
|
75
|
+
|
|
76
|
+
## Links
|
|
77
|
+
|
|
78
|
+
- Source: <https://github.com/yaal-coop/wtforms-htmx-components>
|
|
79
|
+
- Issues: <https://github.com/yaal-coop/wtforms-htmx-components/issues>
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
BSD-3-Clause. See `LICENSE.rst`.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# wtforms-htmx-components
|
|
2
|
+
|
|
3
|
+
Ready-made interactive [WTForms](https://wtforms.readthedocs.io/) fields
|
|
4
|
+
built on [wtforms-htmx](https://github.com/yaal-coop/wtforms-htmx).
|
|
5
|
+
|
|
6
|
+
**Status: alpha, work in progress.**
|
|
7
|
+
|
|
8
|
+
Each field packages a recipe of several triggers (typing, suggestions,
|
|
9
|
+
pick, store, chip) into a single `FormField` declaration. Available now:
|
|
10
|
+
the combobox, single and multi value, strict or with free-form values.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pip install wtforms-htmx-components
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from wtforms import SelectChoice
|
|
22
|
+
from wtforms import SubmitField
|
|
23
|
+
from wtforms_htmx import HtmxForm
|
|
24
|
+
from wtforms_htmx_components import ComboboxMultiField
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def suggest(query, form):
|
|
28
|
+
q = query.lower()
|
|
29
|
+
return [SelectChoice(tag, tag) for tag in CATALOG if q in tag.lower()]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class TagsForm(HtmxForm):
|
|
33
|
+
tags = ComboboxMultiField("Tags", suggest=suggest)
|
|
34
|
+
save = SubmitField()
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Run the example app:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
uv sync --group example
|
|
41
|
+
uv run python -m examples
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then open <http://127.0.0.1:5000/>.
|
|
45
|
+
|
|
46
|
+
## Links
|
|
47
|
+
|
|
48
|
+
- Source: <https://github.com/yaal-coop/wtforms-htmx-components>
|
|
49
|
+
- Issues: <https://github.com/yaal-coop/wtforms-htmx-components/issues>
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
BSD-3-Clause. See `LICENSE.rst`.
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wtforms-htmx-components"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Ready-made interactive WTForms fields built on wtforms-htmx."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
license-files = ["LICENSE.rst"]
|
|
8
|
+
keywords = [
|
|
9
|
+
"wtforms",
|
|
10
|
+
"htmx",
|
|
11
|
+
"forms",
|
|
12
|
+
"validation",
|
|
13
|
+
"combobox",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Web Environment",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Programming Language :: Python :: 3.15",
|
|
27
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
28
|
+
]
|
|
29
|
+
requires-python = ">=3.11"
|
|
30
|
+
dependencies = [
|
|
31
|
+
"wtforms>=3.3.0,<4",
|
|
32
|
+
"wtforms-htmx>=0.1.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[[project.maintainers]]
|
|
36
|
+
name = "Éloi Rivard"
|
|
37
|
+
email = "eloi@yaal.coop"
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Documentation = "https://wtforms-htmx-components.readthedocs.io/"
|
|
41
|
+
Changes = "https://wtforms-htmx-components.readthedocs.io/changes/"
|
|
42
|
+
"Source Code" = "https://github.com/yaal-coop/wtforms-htmx-components"
|
|
43
|
+
"Issue Tracker" = "https://github.com/yaal-coop/wtforms-htmx-components/issues"
|
|
44
|
+
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["uv_build>=0.13.1,<0.14"]
|
|
47
|
+
build-backend = "uv_build"
|
|
48
|
+
|
|
49
|
+
[tool.uv]
|
|
50
|
+
required-version = ">=0.13.1"
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests/unit"]
|
|
54
|
+
pythonpath = ["."]
|
|
55
|
+
filterwarnings = ["error"]
|
|
56
|
+
|
|
57
|
+
[tool.coverage.run]
|
|
58
|
+
branch = true
|
|
59
|
+
source = [
|
|
60
|
+
"wtforms_htmx_components",
|
|
61
|
+
"tests",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.coverage.paths]
|
|
65
|
+
source = [
|
|
66
|
+
"src",
|
|
67
|
+
"*/site-packages",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[tool.coverage.report]
|
|
71
|
+
fail_under = 100
|
|
72
|
+
exclude_lines = [
|
|
73
|
+
"pragma: no cover",
|
|
74
|
+
"except ImportError",
|
|
75
|
+
"if TYPE_CHECKING:",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[tool.ruff]
|
|
79
|
+
src = ["src"]
|
|
80
|
+
fix = true
|
|
81
|
+
show-fixes = true
|
|
82
|
+
output-format = "full"
|
|
83
|
+
|
|
84
|
+
[tool.ruff.lint]
|
|
85
|
+
select = [
|
|
86
|
+
"B",
|
|
87
|
+
"C90",
|
|
88
|
+
"D",
|
|
89
|
+
"E",
|
|
90
|
+
"F",
|
|
91
|
+
"I",
|
|
92
|
+
"UP",
|
|
93
|
+
"W",
|
|
94
|
+
"SIM",
|
|
95
|
+
"RET",
|
|
96
|
+
"BLE",
|
|
97
|
+
"TRY",
|
|
98
|
+
"ERA",
|
|
99
|
+
"PIE",
|
|
100
|
+
"RUF",
|
|
101
|
+
"DTZ",
|
|
102
|
+
"PTH",
|
|
103
|
+
]
|
|
104
|
+
ignore = [
|
|
105
|
+
"E501",
|
|
106
|
+
"E722",
|
|
107
|
+
"D100",
|
|
108
|
+
"D101",
|
|
109
|
+
"D102",
|
|
110
|
+
"D103",
|
|
111
|
+
"D104",
|
|
112
|
+
"D105",
|
|
113
|
+
"D106",
|
|
114
|
+
"D107",
|
|
115
|
+
"D203",
|
|
116
|
+
"D213",
|
|
117
|
+
"RUF001",
|
|
118
|
+
"RUF002",
|
|
119
|
+
"RUF003",
|
|
120
|
+
"TRY003",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[tool.ruff.lint.per-file-ignores]
|
|
124
|
+
"examples/**" = [
|
|
125
|
+
"D205",
|
|
126
|
+
"D400",
|
|
127
|
+
"D404",
|
|
128
|
+
"D415",
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
[tool.ruff.lint.isort]
|
|
132
|
+
force-single-line = true
|
|
133
|
+
order-by-type = false
|
|
134
|
+
|
|
135
|
+
[tool.ruff.lint.mccabe]
|
|
136
|
+
max-complexity = 10
|
|
137
|
+
|
|
138
|
+
[tool.mypy]
|
|
139
|
+
python_version = "3.11"
|
|
140
|
+
packages = ["wtforms_htmx_components"]
|
|
141
|
+
mypy_path = "src"
|
|
142
|
+
ignore_missing_imports = true
|
|
143
|
+
|
|
144
|
+
[tool.tox]
|
|
145
|
+
requires = [
|
|
146
|
+
"tox>=4.22",
|
|
147
|
+
"tox-uv>=1.16",
|
|
148
|
+
]
|
|
149
|
+
env_list = [
|
|
150
|
+
"py3.11",
|
|
151
|
+
"py3.12",
|
|
152
|
+
"py3.13",
|
|
153
|
+
"py3.14",
|
|
154
|
+
"py3.15",
|
|
155
|
+
"minversions",
|
|
156
|
+
"typing",
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
[tool.tox.env_run_base]
|
|
160
|
+
runner = "uv-venv-lock-runner"
|
|
161
|
+
dependency_groups = ["test"]
|
|
162
|
+
commands = [[
|
|
163
|
+
"pytest",
|
|
164
|
+
{ replace = "posargs", extend = true },
|
|
165
|
+
]]
|
|
166
|
+
|
|
167
|
+
[tool.tox.env.typing]
|
|
168
|
+
runner = "uv-venv-lock-runner"
|
|
169
|
+
dependency_groups = ["dev"]
|
|
170
|
+
commands = [["mypy"]]
|
|
171
|
+
|
|
172
|
+
[tool.tox.env.minversions]
|
|
173
|
+
runner = "uv-venv-runner"
|
|
174
|
+
base_python = ["py3.11"]
|
|
175
|
+
uv_resolution = "lowest-direct"
|
|
176
|
+
dependency_groups = ["test"]
|
|
177
|
+
commands = [[
|
|
178
|
+
"pytest",
|
|
179
|
+
"tests/unit",
|
|
180
|
+
{ replace = "posargs", extend = true },
|
|
181
|
+
]]
|
|
182
|
+
|
|
183
|
+
[tool.tox.env.coverage]
|
|
184
|
+
runner = "uv-venv-lock-runner"
|
|
185
|
+
allowlist_externals = ["npm"]
|
|
186
|
+
commands_pre = [[
|
|
187
|
+
"npm",
|
|
188
|
+
"ci",
|
|
189
|
+
"--no-audit",
|
|
190
|
+
"--no-fund",
|
|
191
|
+
]]
|
|
192
|
+
dependency_groups = [
|
|
193
|
+
"e2e",
|
|
194
|
+
"test",
|
|
195
|
+
]
|
|
196
|
+
commands = [
|
|
197
|
+
[
|
|
198
|
+
"coverage",
|
|
199
|
+
"erase",
|
|
200
|
+
],
|
|
201
|
+
[
|
|
202
|
+
"coverage",
|
|
203
|
+
"run",
|
|
204
|
+
"--module",
|
|
205
|
+
"pytest",
|
|
206
|
+
"tests/unit",
|
|
207
|
+
"tests/e2e",
|
|
208
|
+
"--browser",
|
|
209
|
+
"chromium",
|
|
210
|
+
{ replace = "posargs", extend = true },
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
"coverage",
|
|
214
|
+
"html",
|
|
215
|
+
"--fail-under",
|
|
216
|
+
"0",
|
|
217
|
+
],
|
|
218
|
+
[
|
|
219
|
+
"coverage",
|
|
220
|
+
"report",
|
|
221
|
+
"--fail-under",
|
|
222
|
+
"0",
|
|
223
|
+
],
|
|
224
|
+
]
|
|
225
|
+
|
|
226
|
+
[tool.tox.env.e2e]
|
|
227
|
+
runner = "uv-venv-lock-runner"
|
|
228
|
+
allowlist_externals = ["npm"]
|
|
229
|
+
commands_pre = [[
|
|
230
|
+
"npm",
|
|
231
|
+
"ci",
|
|
232
|
+
"--no-audit",
|
|
233
|
+
"--no-fund",
|
|
234
|
+
]]
|
|
235
|
+
dependency_groups = ["e2e"]
|
|
236
|
+
commands = [[
|
|
237
|
+
"pytest",
|
|
238
|
+
"tests/e2e",
|
|
239
|
+
"--browser",
|
|
240
|
+
"chromium",
|
|
241
|
+
"--browser",
|
|
242
|
+
"firefox",
|
|
243
|
+
{ replace = "posargs", extend = true },
|
|
244
|
+
]]
|
|
245
|
+
|
|
246
|
+
[tool.tox.env.e2e-htmx2]
|
|
247
|
+
runner = "uv-venv-lock-runner"
|
|
248
|
+
allowlist_externals = ["npm"]
|
|
249
|
+
commands_pre = [[
|
|
250
|
+
"npm",
|
|
251
|
+
"ci",
|
|
252
|
+
"--no-audit",
|
|
253
|
+
"--no-fund",
|
|
254
|
+
]]
|
|
255
|
+
dependency_groups = ["e2e"]
|
|
256
|
+
commands = [[
|
|
257
|
+
"pytest",
|
|
258
|
+
"tests/e2e",
|
|
259
|
+
"--browser",
|
|
260
|
+
"chromium",
|
|
261
|
+
"--htmx-version",
|
|
262
|
+
"2",
|
|
263
|
+
"--ignore-glob",
|
|
264
|
+
"tests/e2e/*_nojs.py",
|
|
265
|
+
{ replace = "posargs", extend = true },
|
|
266
|
+
]]
|
|
267
|
+
|
|
268
|
+
[dependency-groups]
|
|
269
|
+
doc = [
|
|
270
|
+
"pallets-sphinx-themes>=2.5.0",
|
|
271
|
+
"sphinx>=8.1.0",
|
|
272
|
+
"sphinx-issues>=6.0.0",
|
|
273
|
+
"sphinxcontrib-screenshot>=1.2.0; python_version < '3.12'",
|
|
274
|
+
"sphinxcontrib-screenshot>=2.1.2; python_version >= '3.12'",
|
|
275
|
+
]
|
|
276
|
+
test = [
|
|
277
|
+
"pytest>=8.0",
|
|
278
|
+
"pytest-cov>=5.0",
|
|
279
|
+
"flask>=3.0",
|
|
280
|
+
]
|
|
281
|
+
dev = [
|
|
282
|
+
{ include-group = "test" },
|
|
283
|
+
{ include-group = "example" },
|
|
284
|
+
"mypy>=1.11",
|
|
285
|
+
"prek>=0.3.9",
|
|
286
|
+
"pytest-xdist>=3.8.0",
|
|
287
|
+
"tox-uv>=1.35.1",
|
|
288
|
+
]
|
|
289
|
+
example = [
|
|
290
|
+
"flask>=3.0",
|
|
291
|
+
"email-validator>=2",
|
|
292
|
+
"pycountry>=24",
|
|
293
|
+
]
|
|
294
|
+
e2e = [
|
|
295
|
+
{ include-group = "example" },
|
|
296
|
+
"pytest>=8.0",
|
|
297
|
+
"pytest-playwright>=0.5",
|
|
298
|
+
"pytest-xdist>=3.8.0",
|
|
299
|
+
]
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wtforms-htmx-components"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Ready-made interactive WTForms fields built on wtforms-htmx."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
license-files = ["LICENSE.rst"]
|
|
8
|
+
maintainers = [
|
|
9
|
+
{ name = "Éloi Rivard", email = "eloi@yaal.coop" },
|
|
10
|
+
]
|
|
11
|
+
keywords = ["wtforms", "htmx", "forms", "validation", "combobox"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Environment :: Web Environment",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Programming Language :: Python :: 3.15",
|
|
24
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">=3.11"
|
|
27
|
+
dependencies = [
|
|
28
|
+
"wtforms>=3.3.0,<4",
|
|
29
|
+
"wtforms-htmx>=0.1.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Documentation = "https://wtforms-htmx-components.readthedocs.io/"
|
|
34
|
+
Changes = "https://wtforms-htmx-components.readthedocs.io/changes/"
|
|
35
|
+
"Source Code" = "https://github.com/yaal-coop/wtforms-htmx-components"
|
|
36
|
+
"Issue Tracker" = "https://github.com/yaal-coop/wtforms-htmx-components/issues"
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["uv_build>=0.13.1,<0.14"]
|
|
40
|
+
build-backend = "uv_build"
|
|
41
|
+
|
|
42
|
+
[tool.uv]
|
|
43
|
+
required-version = ">=0.13.1"
|
|
44
|
+
|
|
45
|
+
[dependency-groups]
|
|
46
|
+
doc = [
|
|
47
|
+
"pallets-sphinx-themes>=2.5.0",
|
|
48
|
+
"sphinx>=8.1.0",
|
|
49
|
+
"sphinx-issues>=6.0.0",
|
|
50
|
+
"sphinxcontrib-screenshot>=1.2.0; python_version < '3.12'",
|
|
51
|
+
"sphinxcontrib-screenshot>=2.1.2; python_version >= '3.12'",
|
|
52
|
+
]
|
|
53
|
+
test = [
|
|
54
|
+
"pytest>=8.0",
|
|
55
|
+
"pytest-cov>=5.0",
|
|
56
|
+
"flask>=3.0",
|
|
57
|
+
]
|
|
58
|
+
dev = [
|
|
59
|
+
{ include-group = "test" },
|
|
60
|
+
{ include-group = "example" },
|
|
61
|
+
"mypy>=1.11",
|
|
62
|
+
"prek>=0.3.9",
|
|
63
|
+
"pytest-xdist>=3.8.0",
|
|
64
|
+
"tox-uv>=1.35.1",
|
|
65
|
+
]
|
|
66
|
+
example = [
|
|
67
|
+
"flask>=3.0",
|
|
68
|
+
"email-validator>=2",
|
|
69
|
+
"pycountry>=24",
|
|
70
|
+
]
|
|
71
|
+
e2e = [
|
|
72
|
+
{ include-group = "example" },
|
|
73
|
+
"pytest>=8.0",
|
|
74
|
+
"pytest-playwright>=0.5",
|
|
75
|
+
"pytest-xdist>=3.8.0",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
# tests/e2e needs pytest-playwright and is run explicitly (tox -e e2e, the e2e
|
|
79
|
+
# CI job); the default run stays browser-free so the unit suite needs no Playwright.
|
|
80
|
+
[tool.pytest.ini_options]
|
|
81
|
+
testpaths = ["tests/unit"]
|
|
82
|
+
pythonpath = ["."]
|
|
83
|
+
filterwarnings = ["error"]
|
|
84
|
+
|
|
85
|
+
[tool.coverage.run]
|
|
86
|
+
branch = true
|
|
87
|
+
source = ["wtforms_htmx_components", "tests"]
|
|
88
|
+
|
|
89
|
+
[tool.coverage.paths]
|
|
90
|
+
source = ["src", "*/site-packages"]
|
|
91
|
+
|
|
92
|
+
[tool.coverage.report]
|
|
93
|
+
fail_under = 100
|
|
94
|
+
exclude_lines = [
|
|
95
|
+
"pragma: no cover",
|
|
96
|
+
"except ImportError",
|
|
97
|
+
"if TYPE_CHECKING:",
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
[tool.ruff]
|
|
101
|
+
src = ["src"]
|
|
102
|
+
fix = true
|
|
103
|
+
show-fixes = true
|
|
104
|
+
output-format = "full"
|
|
105
|
+
|
|
106
|
+
[tool.ruff.lint]
|
|
107
|
+
select = [
|
|
108
|
+
"B", # flake8-bugbear
|
|
109
|
+
"C90", # mccabe
|
|
110
|
+
"D", # pydocstyle
|
|
111
|
+
"E", # pycodestyle error
|
|
112
|
+
"F", # pyflakes
|
|
113
|
+
"I", # isort
|
|
114
|
+
"UP", # pyupgrade
|
|
115
|
+
"W", # pycodestyle warning
|
|
116
|
+
"SIM",
|
|
117
|
+
"RET",
|
|
118
|
+
"BLE",
|
|
119
|
+
"TRY",
|
|
120
|
+
"ERA",
|
|
121
|
+
"PIE",
|
|
122
|
+
"RUF",
|
|
123
|
+
"DTZ",
|
|
124
|
+
"PTH",
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
ignore = [
|
|
128
|
+
"E501", # line-too-long
|
|
129
|
+
"E722", # bare-except
|
|
130
|
+
"D100", # public module
|
|
131
|
+
"D101", # public class
|
|
132
|
+
"D102", # public method
|
|
133
|
+
"D103", # public function
|
|
134
|
+
"D104", # public package
|
|
135
|
+
"D105", # magic method
|
|
136
|
+
"D106", # nested class
|
|
137
|
+
"D107", # public init
|
|
138
|
+
"D203", # no-blank-line-before-class
|
|
139
|
+
"D213", # multi-line-summary-second-line
|
|
140
|
+
"RUF001",
|
|
141
|
+
"RUF002",
|
|
142
|
+
"RUF003",
|
|
143
|
+
"TRY003", # raise-vanilla-args — dedicated exception classes would be overkill here
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
[tool.ruff.lint.per-file-ignores]
|
|
147
|
+
"examples/**" = [
|
|
148
|
+
"D205", # blank-line-after-summary
|
|
149
|
+
"D400", # first-line-period
|
|
150
|
+
"D404", # docstring-starts-with-this
|
|
151
|
+
"D415", # first-line-punctuation
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
[tool.ruff.lint.isort]
|
|
155
|
+
force-single-line = true
|
|
156
|
+
order-by-type = false
|
|
157
|
+
|
|
158
|
+
[tool.ruff.lint.mccabe]
|
|
159
|
+
max-complexity = 10
|
|
160
|
+
|
|
161
|
+
[tool.mypy]
|
|
162
|
+
python_version = "3.11"
|
|
163
|
+
packages = ["wtforms_htmx_components"]
|
|
164
|
+
mypy_path = "src"
|
|
165
|
+
ignore_missing_imports = true
|
|
166
|
+
|
|
167
|
+
[tool.tox]
|
|
168
|
+
requires = ["tox>=4.22", "tox-uv>=1.16"]
|
|
169
|
+
env_list = ["py3.11", "py3.12", "py3.13", "py3.14", "py3.15", "minversions", "typing"]
|
|
170
|
+
|
|
171
|
+
[tool.tox.env_run_base]
|
|
172
|
+
runner = "uv-venv-lock-runner"
|
|
173
|
+
dependency_groups = ["test"]
|
|
174
|
+
commands = [["pytest", { replace = "posargs", extend = true }]]
|
|
175
|
+
|
|
176
|
+
[tool.tox.env.typing]
|
|
177
|
+
runner = "uv-venv-lock-runner"
|
|
178
|
+
dependency_groups = ["dev"]
|
|
179
|
+
commands = [["mypy"]]
|
|
180
|
+
|
|
181
|
+
[tool.tox.env.minversions]
|
|
182
|
+
runner = "uv-venv-runner"
|
|
183
|
+
base_python = ["py3.11"]
|
|
184
|
+
uv_resolution = "lowest-direct"
|
|
185
|
+
dependency_groups = ["test"]
|
|
186
|
+
commands = [["pytest", "tests/unit", { replace = "posargs", extend = true }]]
|
|
187
|
+
[tool.tox.env.coverage]
|
|
188
|
+
runner = "uv-venv-lock-runner"
|
|
189
|
+
allowlist_externals = ["npm"]
|
|
190
|
+
commands_pre = [["npm", "ci", "--no-audit", "--no-fund"]]
|
|
191
|
+
dependency_groups = ["e2e", "test"]
|
|
192
|
+
commands = [
|
|
193
|
+
["coverage", "erase"],
|
|
194
|
+
["coverage", "run", "--module", "pytest", "tests/unit", "tests/e2e", "--browser", "chromium", { replace = "posargs", extend = true }],
|
|
195
|
+
["coverage", "html", "--fail-under", "0"],
|
|
196
|
+
["coverage", "report", "--fail-under", "0"],
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
[tool.tox.env.e2e]
|
|
200
|
+
runner = "uv-venv-lock-runner"
|
|
201
|
+
allowlist_externals = ["npm"]
|
|
202
|
+
commands_pre = [["npm", "ci", "--no-audit", "--no-fund"]]
|
|
203
|
+
dependency_groups = ["e2e"]
|
|
204
|
+
commands = [["pytest", "tests/e2e", "--browser", "chromium", "--browser", "firefox", { replace = "posargs", extend = true }]]
|
|
205
|
+
|
|
206
|
+
[tool.tox.env.e2e-htmx2]
|
|
207
|
+
runner = "uv-venv-lock-runner"
|
|
208
|
+
allowlist_externals = ["npm"]
|
|
209
|
+
commands_pre = [["npm", "ci", "--no-audit", "--no-fund"]]
|
|
210
|
+
dependency_groups = ["e2e"]
|
|
211
|
+
commands = [["pytest", "tests/e2e", "--browser", "chromium", "--htmx-version", "2", "--ignore-glob", "tests/e2e/*_nojs.py", { replace = "posargs", extend = true }]]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Ready-made interactive WTForms fields built on wtforms-htmx."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .combobox import ChipsWidget
|
|
6
|
+
from .combobox import ComboboxField
|
|
7
|
+
from .combobox import ComboboxMultiField
|
|
8
|
+
from .combobox import ComboboxSingleField
|
|
9
|
+
from .combobox import ComboboxWidget
|
|
10
|
+
from .combobox import ListboxWidget
|
|
11
|
+
from .combobox import QueryInputWidget
|
|
12
|
+
from .combobox import SingleChipWidget
|
|
13
|
+
from .validators import MaxItems
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"ChipsWidget",
|
|
17
|
+
"ComboboxField",
|
|
18
|
+
"ComboboxMultiField",
|
|
19
|
+
"ComboboxSingleField",
|
|
20
|
+
"ComboboxWidget",
|
|
21
|
+
"ListboxWidget",
|
|
22
|
+
"MaxItems",
|
|
23
|
+
"QueryInputWidget",
|
|
24
|
+
"SingleChipWidget",
|
|
25
|
+
]
|