func-to-web 2.6.2__tar.gz → 2.7.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.
Files changed (54) hide show
  1. {func_to_web-2.6.2/src/func_to_web.egg-info → func_to_web-2.7.0}/PKG-INFO +4 -4
  2. {func_to_web-2.6.2 → func_to_web-2.7.0}/README.md +2 -2
  3. {func_to_web-2.6.2 → func_to_web-2.7.0}/pyproject.toml +1 -1
  4. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/config.py +1 -1
  5. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/functions.py +28 -3
  6. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/page.js +4 -5
  7. {func_to_web-2.6.2 → func_to_web-2.7.0/src/func_to_web.egg-info}/PKG-INFO +4 -4
  8. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/requires.txt +1 -1
  9. {func_to_web-2.6.2 → func_to_web-2.7.0}/LICENSE +0 -0
  10. {func_to_web-2.6.2 → func_to_web-2.7.0}/setup.cfg +0 -0
  11. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/__init__.py +0 -0
  12. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/__init__.py +0 -0
  13. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/file_defaults.py +0 -0
  14. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/function.py +0 -0
  15. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/return_parser.py +0 -0
  16. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/submit_defaults.py +0 -0
  17. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/__init__.py +0 -0
  18. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/download.py +0 -0
  19. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/form.py +0 -0
  20. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/image.py +0 -0
  21. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/table.py +0 -0
  22. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/text.py +0 -0
  23. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/py.typed +0 -0
  24. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/emit.js +0 -0
  25. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/alert.svg +0 -0
  26. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/check.svg +0 -0
  27. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/clock.svg +0 -0
  28. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/copy.svg +0 -0
  29. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/download.svg +0 -0
  30. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/output.js +0 -0
  31. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/page.css +0 -0
  32. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/sdk.js +0 -0
  33. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/upload.js +0 -0
  34. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/__init__.py +0 -0
  35. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/doc.py +0 -0
  36. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/index.html +0 -0
  37. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/index.py +0 -0
  38. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/page.html +0 -0
  39. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/page.py +0 -0
  40. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/theme.py +0 -0
  41. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/__init__.py +0 -0
  42. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/execution.py +0 -0
  43. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/messages.py +0 -0
  44. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/pending.py +0 -0
  45. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/print_capture.py +0 -0
  46. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/references.py +0 -0
  47. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/returned_files.py +0 -0
  48. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/router.py +0 -0
  49. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/run.py +0 -0
  50. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/stream.py +0 -0
  51. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/upload.py +0 -0
  52. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/SOURCES.txt +0 -0
  53. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/dependency_links.txt +0 -0
  54. {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: func-to-web
3
- Version: 2.6.2
3
+ Version: 2.7.0
4
4
  Summary: Expose typed Python functions as web interfaces.
5
5
  Author: Beltrán Offerrall
6
6
  License: MIT License
@@ -40,7 +40,7 @@ Classifier: Typing :: Typed
40
40
  Requires-Python: >=3.11
41
41
  Description-Content-Type: text/markdown
42
42
  License-File: LICENSE
43
- Requires-Dist: pytypehintweb==1.1.0
43
+ Requires-Dist: pytypehintweb==1.2.0
44
44
  Requires-Dist: starlette==0.49.3
45
45
  Requires-Dist: uvicorn==0.38.0
46
46
  Provides-Extra: test
@@ -61,7 +61,7 @@ Provides-Extra: test-browser
61
61
  Requires-Dist: playwright; extra == "test-browser"
62
62
  Dynamic: license-file
63
63
 
64
- # FuncToWeb 2.6.2
64
+ # FuncToWeb 2.7.0
65
65
 
66
66
  [![PyPI version](https://img.shields.io/pypi/v/func-to-web.svg)](https://pypi.org/project/func-to-web/)
67
67
  [![Python](https://img.shields.io/pypi/pyversions/func-to-web.svg)](https://pypi.org/project/func-to-web/)
@@ -584,7 +584,7 @@ practice.
584
584
 
585
585
  ## Status
586
586
 
587
- **FuncToWeb 2.6.2 is stable, used daily and actively maintained.**
587
+ **FuncToWeb 2.7.0 is stable, used daily and actively maintained.**
588
588
 
589
589
  The public API is the one described in
590
590
  [`docs/`](docs/index.md), and the known limitations are listed in
@@ -1,4 +1,4 @@
1
- # FuncToWeb 2.6.2
1
+ # FuncToWeb 2.7.0
2
2
 
3
3
  [![PyPI version](https://img.shields.io/pypi/v/func-to-web.svg)](https://pypi.org/project/func-to-web/)
4
4
  [![Python](https://img.shields.io/pypi/pyversions/func-to-web.svg)](https://pypi.org/project/func-to-web/)
@@ -521,7 +521,7 @@ practice.
521
521
 
522
522
  ## Status
523
523
 
524
- **FuncToWeb 2.6.2 is stable, used daily and actively maintained.**
524
+ **FuncToWeb 2.7.0 is stable, used daily and actively maintained.**
525
525
 
526
526
  The public API is the one described in
527
527
  [`docs/`](docs/index.md), and the known limitations are listed in
@@ -25,7 +25,7 @@ classifiers = [
25
25
  ]
26
26
 
27
27
  dependencies = [
28
- "pytypehintweb==1.1.0",
28
+ "pytypehintweb==1.2.0",
29
29
  "starlette==0.49.3",
30
30
  "uvicorn==0.38.0",
31
31
  ]
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
  from sys import platform
4
4
  from tempfile import gettempdir
5
5
 
6
- __version__ = "2.6.2"
6
+ __version__ = "2.7.0"
7
7
 
8
8
  NAME: str = "".join(part.title() for part in __name__.split(".")[0].split("_"))
9
9
 
@@ -148,16 +148,41 @@ def _target_of(
148
148
 
149
149
 
150
150
  def _check_hidden(mark: OpenForm, target: WebFunction) -> None:
151
- names = {param.name for param in target.schema.params}
152
-
153
151
  for name in mark.hidden:
154
- if name not in names:
152
+ if not _has_hidden_path(target.plan, name):
155
153
  raise ReturnContractError(
156
154
  f"unknown hidden field {name!r} for OpenForm target "
157
155
  f"{target.slug!r}"
158
156
  )
159
157
 
160
158
 
159
+ def _has_hidden_path(node: dict[str, Any], path: str) -> bool:
160
+ """Resolve visibility against the same plan the browser compiles.
161
+
162
+ Optional and choice wrappers do not add path components. A list consumes
163
+ '*', so its rule also applies to items created later in the browser.
164
+ """
165
+ kind = node["kind"]
166
+ if kind in ("form", "object"):
167
+ return any(
168
+ path == field["name"] or (
169
+ path.startswith(field["name"] + ".")
170
+ and _has_hidden_path(field["node"], path[len(field["name"]) + 1:])
171
+ )
172
+ for field in node["fields"]
173
+ )
174
+ if kind == "list":
175
+ return path == "*" or (
176
+ path.startswith("*.") and _has_hidden_path(node["item"], path[2:])
177
+ )
178
+ if kind == "optional":
179
+ return _has_hidden_path(node["node"], path)
180
+ if kind == "choice":
181
+ return any(_has_hidden_path(branch["node"], path)
182
+ for branch in node["branches"])
183
+ return False
184
+
185
+
161
186
  FunctionEntry: TypeAlias = Callable[..., Any] | WebFunction
162
187
  FunctionInput: TypeAlias = (
163
188
  WebFunctions | FunctionEntry | Iterable[FunctionEntry]
@@ -8,19 +8,18 @@ import { runUploads } from "./upload.js";
8
8
 
9
9
  const plan = JSON.parse(
10
10
  document.getElementById("functoweb-plan").textContent);
11
- const form = compileForm(plan);
11
+ const hidden = JSON.parse(
12
+ document.getElementById("functoweb-hidden").textContent);
13
+ const form = compileForm(plan, { hidden });
12
14
 
13
15
  const labels = new Map(plan.fields.map((field) => [field.name, field.label]));
14
16
 
15
- const hidden = new Set(JSON.parse(
16
- document.getElementById("functoweb-hidden").textContent));
17
-
18
17
  const autorun = JSON.parse(
19
18
  document.getElementById("functoweb-autorun").textContent);
20
19
 
21
20
  const fields = document.getElementById("fields");
22
21
  for (const field of form.fields) {
23
- if (!hidden.has(field.name)) fields.append(field.widget.el);
22
+ fields.append(field.widget.el);
24
23
  }
25
24
 
26
25
  const result = document.getElementById("result");
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: func-to-web
3
- Version: 2.6.2
3
+ Version: 2.7.0
4
4
  Summary: Expose typed Python functions as web interfaces.
5
5
  Author: Beltrán Offerrall
6
6
  License: MIT License
@@ -40,7 +40,7 @@ Classifier: Typing :: Typed
40
40
  Requires-Python: >=3.11
41
41
  Description-Content-Type: text/markdown
42
42
  License-File: LICENSE
43
- Requires-Dist: pytypehintweb==1.1.0
43
+ Requires-Dist: pytypehintweb==1.2.0
44
44
  Requires-Dist: starlette==0.49.3
45
45
  Requires-Dist: uvicorn==0.38.0
46
46
  Provides-Extra: test
@@ -61,7 +61,7 @@ Provides-Extra: test-browser
61
61
  Requires-Dist: playwright; extra == "test-browser"
62
62
  Dynamic: license-file
63
63
 
64
- # FuncToWeb 2.6.2
64
+ # FuncToWeb 2.7.0
65
65
 
66
66
  [![PyPI version](https://img.shields.io/pypi/v/func-to-web.svg)](https://pypi.org/project/func-to-web/)
67
67
  [![Python](https://img.shields.io/pypi/pyversions/func-to-web.svg)](https://pypi.org/project/func-to-web/)
@@ -584,7 +584,7 @@ practice.
584
584
 
585
585
  ## Status
586
586
 
587
- **FuncToWeb 2.6.2 is stable, used daily and actively maintained.**
587
+ **FuncToWeb 2.7.0 is stable, used daily and actively maintained.**
588
588
 
589
589
  The public API is the one described in
590
590
  [`docs/`](docs/index.md), and the known limitations are listed in
@@ -1,4 +1,4 @@
1
- pytypehintweb==1.1.0
1
+ pytypehintweb==1.2.0
2
2
  starlette==0.49.3
3
3
  uvicorn==0.38.0
4
4
 
File without changes
File without changes