dash-fn-form 0.0.1__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 (58) hide show
  1. dash_fn_form-0.0.1/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
  2. dash_fn_form-0.0.1/.github/ISSUE_TEMPLATE/config.yml +2 -0
  3. dash_fn_form-0.0.1/.github/ISSUE_TEMPLATE/documentation.md +29 -0
  4. dash_fn_form-0.0.1/.github/ISSUE_TEMPLATE/feature_request.md +34 -0
  5. dash_fn_form-0.0.1/.github/dependabot.yml +6 -0
  6. dash_fn_form-0.0.1/.github/workflows/lint.yml +19 -0
  7. dash_fn_form-0.0.1/.github/workflows/publish.yml +25 -0
  8. dash_fn_form-0.0.1/.github/workflows/test.yml +31 -0
  9. dash_fn_form-0.0.1/.gitignore +161 -0
  10. dash_fn_form-0.0.1/.pre-commit-config.yaml +27 -0
  11. dash_fn_form-0.0.1/.vscode/launch.json +13 -0
  12. dash_fn_form-0.0.1/.vscode/linux.env +3 -0
  13. dash_fn_form-0.0.1/.vscode/settings.json +31 -0
  14. dash_fn_form-0.0.1/.vscode/windows.env +1 -0
  15. dash_fn_form-0.0.1/CONTRIBUTING.md +29 -0
  16. dash_fn_form-0.0.1/LICENSE +21 -0
  17. dash_fn_form-0.0.1/PKG-INFO +87 -0
  18. dash_fn_form-0.0.1/README.md +63 -0
  19. dash_fn_form-0.0.1/docs/index.md +62 -0
  20. dash_fn_form-0.0.1/examples/interact.py +113 -0
  21. dash_fn_form-0.0.1/examples/ipywidgets_interact.ipynb +212 -0
  22. dash_fn_form-0.0.1/mkdocs.yml +109 -0
  23. dash_fn_form-0.0.1/pyproject.toml +78 -0
  24. dash_fn_form-0.0.1/setup.cfg +4 -0
  25. dash_fn_form-0.0.1/src/dash_fn_form/__init__.py +37 -0
  26. dash_fn_form-0.0.1/src/dash_fn_form/_field_components.py +582 -0
  27. dash_fn_form-0.0.1/src/dash_fn_form/_form_layouts.py +213 -0
  28. dash_fn_form-0.0.1/src/dash_fn_form/_forms.py +1576 -0
  29. dash_fn_form-0.0.1/src/dash_fn_form/_renderers.py +202 -0
  30. dash_fn_form-0.0.1/src/dash_fn_form/_spec.py +247 -0
  31. dash_fn_form-0.0.1/src/dash_fn_form/_version.py +24 -0
  32. dash_fn_form-0.0.1/src/dash_fn_form/fn_interact.py +252 -0
  33. dash_fn_form-0.0.1/src/dash_fn_form/layout.py +28 -0
  34. dash_fn_form-0.0.1/src/dash_fn_form/py.typed +0 -0
  35. dash_fn_form-0.0.1/src/dash_fn_form/utils.py +27 -0
  36. dash_fn_form-0.0.1/src/dash_fn_form.egg-info/PKG-INFO +87 -0
  37. dash_fn_form-0.0.1/src/dash_fn_form.egg-info/SOURCES.txt +56 -0
  38. dash_fn_form-0.0.1/src/dash_fn_form.egg-info/dependency_links.txt +1 -0
  39. dash_fn_form-0.0.1/src/dash_fn_form.egg-info/requires.txt +3 -0
  40. dash_fn_form-0.0.1/src/dash_fn_form.egg-info/top_level.txt +1 -0
  41. dash_fn_form-0.0.1/tests/conftest.py +21 -0
  42. dash_fn_form-0.0.1/tests/dash_fn_form/test_coerce_validate.py +562 -0
  43. dash_fn_form-0.0.1/tests/dash_fn_form/test_dbc_fields.py +398 -0
  44. dash_fn_form-0.0.1/tests/dash_fn_form/test_declarative_form.py +197 -0
  45. dash_fn_form-0.0.1/tests/dash_fn_form/test_dmc_fields.py +386 -0
  46. dash_fn_form-0.0.1/tests/dash_fn_form/test_field_components.py +400 -0
  47. dash_fn_form-0.0.1/tests/dash_fn_form/test_fn_interact.py +345 -0
  48. dash_fn_form-0.0.1/tests/dash_fn_form/test_forms.py +992 -0
  49. dash_fn_form-0.0.1/tests/dash_fn_form/test_layout.py +79 -0
  50. dash_fn_form-0.0.1/tests/dash_fn_form/test_no_default.py +57 -0
  51. dash_fn_form-0.0.1/tests/dash_fn_form/test_read_only.py +30 -0
  52. dash_fn_form-0.0.1/tests/dash_fn_form/test_renderers.py +212 -0
  53. dash_fn_form-0.0.1/tests/dash_fn_form/test_sections.py +40 -0
  54. dash_fn_form-0.0.1/tests/dash_fn_form/test_spec.py +209 -0
  55. dash_fn_form-0.0.1/tests/dash_fn_form/test_utils.py +35 -0
  56. dash_fn_form-0.0.1/tests/dash_fn_form/test_visibility_extended.py +30 -0
  57. dash_fn_form-0.0.1/tests/test_smoke.py +5 -0
  58. dash_fn_form-0.0.1/uv.lock +2221 -0
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: 🐛 Bug Report
3
+ about: Report a bug
4
+ ---
5
+
6
+ <!--To help us understand and resolve your issue, please fill out the form to the best of your ability.-->
7
+ <!--You can feel free to delete the sections that do not apply.-->
8
+
9
+ ### Bug report
10
+
11
+ **Bug summary**
12
+
13
+ <!--A short 1-2 sentences that succinctly describes the bug-->
14
+
15
+ **Code for reproduction**
16
+
17
+ <!--A minimum code snippet required to reproduce the bug.
18
+ Please make sure to minimize the number of dependencies required.
19
+
20
+ ```python
21
+ # Paste your code here
22
+ #
23
+ #
24
+ ```
25
+
26
+ **Actual outcome**
27
+
28
+ <!--The output produced by the above code, which may be a screenshot, console output, etc.-->
29
+
30
+ **Expected outcome**
31
+
32
+ <!--A description of the expected outcome from the code snippet-->
33
+
34
+ **Version Info**
35
+ <!--Please specify your platform and versions of the relevant libraries you are using:-->
36
+ * Operating system:
37
+ * Python version:
38
+ * Package version:
39
+ * Other libraries:
@@ -0,0 +1,2 @@
1
+ # Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
2
+ blank_issues_enabled: true # default
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: 📖 Documentation improvement
3
+ about: Report parts of the docs that are wrong or unclear
4
+ labels: documentation, bug
5
+ ---
6
+
7
+ <!--To help us understand and resolve your issue, please fill out the form to the best of your ability.-->
8
+ <!--You can feel free to delete the sections that do not apply.-->
9
+
10
+ ### Problem
11
+
12
+ <!--
13
+ If you are referencing an existing piece of documentation or example please provide a link.
14
+
15
+ * I found [...] to be unclear because [...]
16
+ * [...] made me think that [...] when really it should be [...]
17
+ * There is no example showing how to do [...]
18
+ -->
19
+
20
+
21
+ ### Suggested Improvement
22
+
23
+ <!--
24
+ If you have an idea to improve the documentation please suggest it here
25
+
26
+ * This line should be be changed to say [...]
27
+ * Include a paragraph explaining [...]
28
+ * Add a figure showing [...]
29
+ -->
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: 🚀 Enhancement/Feature Request
3
+ about: Suggest something that could be improved or a New Feature to add
4
+ labels: enhancement
5
+ ---
6
+
7
+ <!--
8
+ Thanks for thinking of a way to improve this project. If this solves a problem for you, then it probably solves that problem for lots of people! So the whole community will benefit from this request.
9
+
10
+
11
+ Before creating a new feature request please search the issues for relevant feature requests.
12
+ -->
13
+
14
+ ### Problem
15
+
16
+ <!-- Provide a clear and concise description of what problem this feature will solve. For example:
17
+
18
+ * I'm always frustrated when [...] because [...]
19
+ * I would like it if [...] happened when I [...] because [...]
20
+ -->
21
+
22
+ ### Proposed Solution
23
+
24
+ <!-- Provide a clear and concise description of a way to accomplish what you want. For example:
25
+
26
+ * Add an option so that when [...] [...] will happen
27
+ -->
28
+
29
+ ### Additional context
30
+
31
+ <!-- Add any other context or screenshots about the feature request here. You can also include links to examples of other programs that have something similar to your request. For example:
32
+
33
+ * Another project [...] solved this by [...]
34
+ -->
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,19 @@
1
+ name: Checks
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ prek:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v4
9
+ - uses: j178/prek-action@v1
10
+
11
+ typecheck:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v6
16
+ - name: Install dependencies
17
+ run: uv sync --group dev
18
+ - name: ty
19
+ run: uv run ty check
@@ -0,0 +1,25 @@
1
+ name: Publish Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write # required for OIDC
12
+ contents: read
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ - name: Set up uv
19
+ uses: astral-sh/setup-uv@v6
20
+
21
+ - name: Build package
22
+ run: uv build
23
+
24
+ - name: Publish to PyPI
25
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,31 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ name: Python ${{ matrix.python-version }}
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - name: Set up uv
23
+ uses: astral-sh/setup-uv@v6
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+
27
+ - name: Install dependencies
28
+ run: uv sync --group test
29
+
30
+ - name: Tests
31
+ run: uv run pytest
@@ -0,0 +1,161 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+
116
+ # Spyder project settings
117
+ .spyderproject
118
+ .spyproject
119
+
120
+ # Rope project settings
121
+ .ropeproject
122
+
123
+ # mkdocs documentation
124
+ /site
125
+ docs/generated
126
+
127
+
128
+ # mypy
129
+ .mypy_cache/
130
+ .dmypy.json
131
+ dmypy.json
132
+
133
+ # Pyre type checker
134
+ .pyre/
135
+
136
+ # pytype static type analyzer
137
+ .pytype/
138
+
139
+ # Cython debug symbols
140
+ cython_debug/
141
+
142
+ # mac stuff
143
+ .DS_store
144
+
145
+ # editors
146
+
147
+ ## vim
148
+ [._]*.s[a-v][a-z]
149
+ !*.svg # comment out if you don't need vector files
150
+ [._]*.sw[a-p]
151
+ [._]s[a-rt-v][a-z]
152
+ [._]ss[a-gi-z]
153
+ [._]sw[a-p]
154
+ [._]*.un~
155
+
156
+ ## vscode
157
+ _notes.md
158
+ _local_notes.md
159
+
160
+ # setuptools-scm generated version file
161
+ **/_version.py
@@ -0,0 +1,27 @@
1
+ minimum_prek_version: "0.2.0"
2
+ exclude: "^uv\\.lock$"
3
+
4
+ repos:
5
+ - repo: builtin
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ - id: check-added-large-files
9
+ - id: check-case-conflict
10
+ - id: end-of-file-fixer
11
+ - id: fix-byte-order-marker
12
+ - id: check-json
13
+ - id: check-json5
14
+ - id: check-toml
15
+ - id: check-yaml
16
+ - id: check-xml
17
+ - id: mixed-line-ending
18
+ - id: check-symlinks
19
+ - id: check-merge-conflict
20
+ - id: detect-private-key
21
+ - id: check-executables-have-shebangs
22
+ - repo: https://github.com/astral-sh/ruff-pre-commit
23
+ rev: v0.11.6
24
+ hooks:
25
+ - id: ruff
26
+ args: [--fix]
27
+ - id: ruff-format
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Python: Current File",
6
+ "type": "python",
7
+ "request": "launch",
8
+ "program": "${file}",
9
+ "console": "integratedTerminal",
10
+ "justMyCode": true
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,3 @@
1
+ # "${workspaceFolder}/src" is properly parsed and replacement is made by the debugger
2
+ # Test explorer seems not to do replacement and thus ${workspaceFolder}/src is not enough, therefore use "src" in addition
3
+ PYTHONPATH=${workspaceFolder}/src:src:${env:PYTHONPATH}
@@ -0,0 +1,31 @@
1
+ {
2
+ "python.testing.pytestArgs": [
3
+ "tests"
4
+ ],
5
+ "python.testing.unittestEnabled": false,
6
+ "python.testing.pytestEnabled": true,
7
+ "terminal.integrated.env.linux": {
8
+ "PYTHONPATH": "${workspaceFolder}/src:${env:PYTHONPATH}"
9
+ },
10
+ "terminal.integrated.env.windows": {
11
+ "PYTHONPATH": "${workspaceFolder}\\src;${env:PYTHONPATH}"
12
+ },
13
+ "terminal.integrated.env.osx": {
14
+ "PYTHONPATH": "${workspaceFolder}/src:${env:PYTHONPATH}"
15
+ },
16
+ "python.envFile": "${workspaceFolder}/.vscode/windows.env",
17
+ "jupyter.notebookFileRoot": "${workspaceFolder}/src",
18
+ "cSpell.enableFiletypes": [
19
+ "!python"
20
+ ],
21
+ "cSpell.words": [
22
+ "Plotly",
23
+ "plotly",
24
+ "Dash"
25
+ ],
26
+ "yaml.customTags": [
27
+ "!reference sequence"
28
+ ],
29
+ "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
30
+ "python.languageServer": "Pylance"
31
+ }
@@ -0,0 +1 @@
1
+ PYTHONPATH=${workspaceFolder}\src;src;${env:PYTHONPATH}
@@ -0,0 +1,29 @@
1
+ # Contributing
2
+
3
+ Bug reports, feature requests, and pull requests are welcome on [GitHub](https://github.com/saemeon/dash-fn-form/issues).
4
+
5
+ ## Development setup
6
+
7
+ ```bash
8
+ git clone https://github.com/saemeon/dash-fn-form
9
+ cd dash-fn-form
10
+ uv sync --group dev
11
+ ```
12
+
13
+ Pre-commit hooks are managed with [prek](https://github.com/saemeon/prek). They run automatically on `git commit` once you have installed the dev dependencies.
14
+
15
+ ## Running checks
16
+
17
+ ```bash
18
+ uv run ruff check .
19
+ uv run ruff format --check .
20
+ uv run ty check
21
+ uv run pytest
22
+ ```
23
+
24
+ ## Building docs
25
+
26
+ ```bash
27
+ uv sync --group doc
28
+ uv run mkdocs serve
29
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Simon Niederberger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: dash-fn-form
3
+ Version: 0.0.1
4
+ Summary: Introspection-based UI engine for Plotly Dash — transform type-hinted Python functions into reactive Dash forms.
5
+ Author-email: Simon Niederberger <s.niederberger@hotmail.com>
6
+ Maintainer-email: Simon Niederberger <s.niederberger@hotmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/saemeon/dash-fn-form
9
+ Project-URL: Repository, https://github.com/saemeon/dash-fn-form
10
+ Keywords: plotly,dash,visualization,dashboard
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: annotated-types>=0.7.0
21
+ Requires-Dist: dash>=4.0.0
22
+ Requires-Dist: plotly>=6.6.0
23
+ Dynamic: license-file
24
+
25
+ [![PyPI](https://img.shields.io/pypi/v/dash-fn-form)](https://pypi.org/project/dash-fn-form/)
26
+ [![Python](https://img.shields.io/pypi/pyversions/dash-fn-form)](https://pypi.org/project/dash-fn-form/)
27
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
28
+ [![Dash](https://img.shields.io/badge/Dash-008DE4?logo=plotly&logoColor=white)](https://dash.plotly.com/)
29
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
30
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
31
+ [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
32
+ [![prek](https://img.shields.io/badge/prek-checked-blue)](https://github.com/saemeon/prek)
33
+
34
+ # dash-fn-form
35
+
36
+ Introspection-based UI engine for Plotly Dash — transform type-hinted Python functions into reactive Dash forms.
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install dash-fn-form
42
+ ```
43
+
44
+ Most users should install [dash-interact](https://github.com/saemeon/dash-interact) instead, which includes this package and adds a convenience `page` API.
45
+
46
+ ## Usage
47
+
48
+ ```python
49
+ from dash import Dash, html
50
+ from dash_fn_form import build_fn_panel
51
+
52
+ def sine_wave(amplitude: float = 1.0, frequency: float = 2.0):
53
+ import numpy as np, plotly.graph_objects as go
54
+ x = np.linspace(0, 6 * np.pi, 600)
55
+ return go.Figure(go.Scatter(x=x, y=amplitude * np.sin(frequency * x)))
56
+
57
+ app = Dash(__name__)
58
+ app.layout = html.Div([build_fn_panel(sine_wave)])
59
+ app.run(debug=True)
60
+ ```
61
+
62
+ `build_fn_panel` inspects the function signature and builds a form with matching controls. The return value is rendered automatically.
63
+
64
+ ## Type mapping
65
+
66
+ | Python type | Control |
67
+ |---|---|
68
+ | `float` | Number input (or slider with `(min, max, step)`) |
69
+ | `int` | Number input (integer step) |
70
+ | `bool` | Checkbox |
71
+ | `Literal[A, B, C]` | Dropdown |
72
+ | `str` | Text input |
73
+ | `date` / `datetime` | Date picker |
74
+ | `list[T]` / `tuple[T, ...]` | Comma-separated input |
75
+ | `T \| None` | Same as `T`, submits `None` when empty |
76
+
77
+ ## Field customization
78
+
79
+ ```python
80
+ from dash_fn_form import Field
81
+
82
+ form = FnForm("my_form", my_fn, title=Field(label="Title", col_span=2))
83
+ ```
84
+
85
+ ## License
86
+
87
+ MIT
@@ -0,0 +1,63 @@
1
+ [![PyPI](https://img.shields.io/pypi/v/dash-fn-form)](https://pypi.org/project/dash-fn-form/)
2
+ [![Python](https://img.shields.io/pypi/pyversions/dash-fn-form)](https://pypi.org/project/dash-fn-form/)
3
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
+ [![Dash](https://img.shields.io/badge/Dash-008DE4?logo=plotly&logoColor=white)](https://dash.plotly.com/)
5
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
6
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
7
+ [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
8
+ [![prek](https://img.shields.io/badge/prek-checked-blue)](https://github.com/saemeon/prek)
9
+
10
+ # dash-fn-form
11
+
12
+ Introspection-based UI engine for Plotly Dash — transform type-hinted Python functions into reactive Dash forms.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install dash-fn-form
18
+ ```
19
+
20
+ Most users should install [dash-interact](https://github.com/saemeon/dash-interact) instead, which includes this package and adds a convenience `page` API.
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ from dash import Dash, html
26
+ from dash_fn_form import build_fn_panel
27
+
28
+ def sine_wave(amplitude: float = 1.0, frequency: float = 2.0):
29
+ import numpy as np, plotly.graph_objects as go
30
+ x = np.linspace(0, 6 * np.pi, 600)
31
+ return go.Figure(go.Scatter(x=x, y=amplitude * np.sin(frequency * x)))
32
+
33
+ app = Dash(__name__)
34
+ app.layout = html.Div([build_fn_panel(sine_wave)])
35
+ app.run(debug=True)
36
+ ```
37
+
38
+ `build_fn_panel` inspects the function signature and builds a form with matching controls. The return value is rendered automatically.
39
+
40
+ ## Type mapping
41
+
42
+ | Python type | Control |
43
+ |---|---|
44
+ | `float` | Number input (or slider with `(min, max, step)`) |
45
+ | `int` | Number input (integer step) |
46
+ | `bool` | Checkbox |
47
+ | `Literal[A, B, C]` | Dropdown |
48
+ | `str` | Text input |
49
+ | `date` / `datetime` | Date picker |
50
+ | `list[T]` / `tuple[T, ...]` | Comma-separated input |
51
+ | `T \| None` | Same as `T`, submits `None` when empty |
52
+
53
+ ## Field customization
54
+
55
+ ```python
56
+ from dash_fn_form import Field
57
+
58
+ form = FnForm("my_form", my_fn, title=Field(label="Title", col_span=2))
59
+ ```
60
+
61
+ ## License
62
+
63
+ MIT