pytypeinput 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.
Files changed (121) hide show
  1. pytypeinput-0.1.0/.gitignore +216 -0
  2. pytypeinput-0.1.0/LICENSE +21 -0
  3. pytypeinput-0.1.0/PKG-INFO +104 -0
  4. pytypeinput-0.1.0/README.md +90 -0
  5. pytypeinput-0.1.0/docs/api.md +851 -0
  6. pytypeinput-0.1.0/docs/basic-types.md +183 -0
  7. pytypeinput-0.1.0/docs/choices.md +214 -0
  8. pytypeinput-0.1.0/docs/constraints.md +291 -0
  9. pytypeinput-0.1.0/docs/demo_generator.py +62 -0
  10. pytypeinput-0.1.0/docs/demos/audio_file.html +1138 -0
  11. pytypeinput-0.1.0/docs/demos/bool_basic.html +1138 -0
  12. pytypeinput-0.1.0/docs/demos/choices_defaults.html +1160 -0
  13. pytypeinput-0.1.0/docs/demos/choices_lists.html +1184 -0
  14. pytypeinput-0.1.0/docs/demos/color_basic.html +1136 -0
  15. pytypeinput-0.1.0/docs/demos/combined_constraints.html +1153 -0
  16. pytypeinput-0.1.0/docs/demos/combined_ui.html +1154 -0
  17. pytypeinput-0.1.0/docs/demos/data_file.html +1138 -0
  18. pytypeinput-0.1.0/docs/demos/date_basic.html +1135 -0
  19. pytypeinput-0.1.0/docs/demos/defaults.html +1165 -0
  20. pytypeinput-0.1.0/docs/demos/description.html +1153 -0
  21. pytypeinput-0.1.0/docs/demos/document_file.html +1138 -0
  22. pytypeinput-0.1.0/docs/demos/dropdown_basic.html +1141 -0
  23. pytypeinput-0.1.0/docs/demos/dropdown_int.html +1141 -0
  24. pytypeinput-0.1.0/docs/demos/email_basic.html +1136 -0
  25. pytypeinput-0.1.0/docs/demos/enum_basic.html +1138 -0
  26. pytypeinput-0.1.0/docs/demos/enum_int.html +1140 -0
  27. pytypeinput-0.1.0/docs/demos/file_basic.html +1138 -0
  28. pytypeinput-0.1.0/docs/demos/float_basic.html +1144 -0
  29. pytypeinput-0.1.0/docs/demos/float_constraints.html +1162 -0
  30. pytypeinput-0.1.0/docs/demos/float_strict.html +1144 -0
  31. pytypeinput-0.1.0/docs/demos/image_file.html +1138 -0
  32. pytypeinput-0.1.0/docs/demos/int_basic.html +1143 -0
  33. pytypeinput-0.1.0/docs/demos/int_constraints.html +1160 -0
  34. pytypeinput-0.1.0/docs/demos/int_strict.html +1143 -0
  35. pytypeinput-0.1.0/docs/demos/label.html +1146 -0
  36. pytypeinput-0.1.0/docs/demos/list_bool.html +1145 -0
  37. pytypeinput-0.1.0/docs/demos/list_combined.html +1218 -0
  38. pytypeinput-0.1.0/docs/demos/list_constraints.html +1170 -0
  39. pytypeinput-0.1.0/docs/demos/list_date.html +1144 -0
  40. pytypeinput-0.1.0/docs/demos/list_defaults.html +1221 -0
  41. pytypeinput-0.1.0/docs/demos/list_email.html +1143 -0
  42. pytypeinput-0.1.0/docs/demos/list_float.html +1151 -0
  43. pytypeinput-0.1.0/docs/demos/list_image.html +1138 -0
  44. pytypeinput-0.1.0/docs/demos/list_int.html +1150 -0
  45. pytypeinput-0.1.0/docs/demos/list_item_constraints.html +1167 -0
  46. pytypeinput-0.1.0/docs/demos/list_str.html +1143 -0
  47. pytypeinput-0.1.0/docs/demos/list_time.html +1144 -0
  48. pytypeinput-0.1.0/docs/demos/literal_basic.html +1138 -0
  49. pytypeinput-0.1.0/docs/demos/literal_numbers.html +1154 -0
  50. pytypeinput-0.1.0/docs/demos/optional_basic.html +1154 -0
  51. pytypeinput-0.1.0/docs/demos/optional_default.html +1162 -0
  52. pytypeinput-0.1.0/docs/demos/optional_disabled.html +1154 -0
  53. pytypeinput-0.1.0/docs/demos/optional_enabled.html +1154 -0
  54. pytypeinput-0.1.0/docs/demos/optional_types.html +1216 -0
  55. pytypeinput-0.1.0/docs/demos/password.html +1146 -0
  56. pytypeinput-0.1.0/docs/demos/pattern_message.html +1136 -0
  57. pytypeinput-0.1.0/docs/demos/placeholder.html +1153 -0
  58. pytypeinput-0.1.0/docs/demos/renderer_basic.html +1163 -0
  59. pytypeinput-0.1.0/docs/demos/renderer_complete.html +1175 -0
  60. pytypeinput-0.1.0/docs/demos/renderer_individual.html +1153 -0
  61. pytypeinput-0.1.0/docs/demos/rows.html +1146 -0
  62. pytypeinput-0.1.0/docs/demos/slider.html +1149 -0
  63. pytypeinput-0.1.0/docs/demos/step.html +1161 -0
  64. pytypeinput-0.1.0/docs/demos/str_basic.html +1136 -0
  65. pytypeinput-0.1.0/docs/demos/str_constraints.html +1146 -0
  66. pytypeinput-0.1.0/docs/demos/str_pattern.html +1136 -0
  67. pytypeinput-0.1.0/docs/demos/text_file.html +1138 -0
  68. pytypeinput-0.1.0/docs/demos/time_basic.html +1135 -0
  69. pytypeinput-0.1.0/docs/demos/user_form.html +1171 -0
  70. pytypeinput-0.1.0/docs/demos/video_file.html +1138 -0
  71. pytypeinput-0.1.0/docs/generate_demos.py +488 -0
  72. pytypeinput-0.1.0/docs/html-renderer.md +168 -0
  73. pytypeinput-0.1.0/docs/index.md +123 -0
  74. pytypeinput-0.1.0/docs/lists.md +278 -0
  75. pytypeinput-0.1.0/docs/optionals.md +149 -0
  76. pytypeinput-0.1.0/docs/special-types.md +242 -0
  77. pytypeinput-0.1.0/docs/ui-metadata.md +262 -0
  78. pytypeinput-0.1.0/examples/class_to_gui.py +25 -0
  79. pytypeinput-0.1.0/examples/css_variables.py +18 -0
  80. pytypeinput-0.1.0/examples/dataclass_to_gui.py +19 -0
  81. pytypeinput-0.1.0/examples/function_to_gui.py +18 -0
  82. pytypeinput-0.1.0/examples/pydantic_to_gui.py +18 -0
  83. pytypeinput-0.1.0/examples/showcase/bool_showcase.py +88 -0
  84. pytypeinput-0.1.0/examples/showcase/color_showcase.py +132 -0
  85. pytypeinput-0.1.0/examples/showcase/date_showcase.py +132 -0
  86. pytypeinput-0.1.0/examples/showcase/dropdowns_showcase.py +263 -0
  87. pytypeinput-0.1.0/examples/showcase/email_showcase.py +119 -0
  88. pytypeinput-0.1.0/examples/showcase/file_showcase.py +81 -0
  89. pytypeinput-0.1.0/examples/showcase/int_float_showcase.py +152 -0
  90. pytypeinput-0.1.0/examples/showcase/str_showcase.py +160 -0
  91. pytypeinput-0.1.0/examples/showcase/time_showcase.py +132 -0
  92. pytypeinput-0.1.0/examples/showcase/visual_test_base.py +89 -0
  93. pytypeinput-0.1.0/examples/type_to_gui.py +16 -0
  94. pytypeinput-0.1.0/examples/visual_test_base.py +88 -0
  95. pytypeinput-0.1.0/mkdocs.yml +74 -0
  96. pytypeinput-0.1.0/pyproject.toml +28 -0
  97. pytypeinput-0.1.0/pytypeinput/__init__.py +13 -0
  98. pytypeinput-0.1.0/pytypeinput/analyzer.py +599 -0
  99. pytypeinput-0.1.0/pytypeinput/html/__init__.py +1 -0
  100. pytypeinput-0.1.0/pytypeinput/html/assets/__init__.py +7 -0
  101. pytypeinput-0.1.0/pytypeinput/html/assets/styles.css +632 -0
  102. pytypeinput-0.1.0/pytypeinput/html/assets/validation.js +476 -0
  103. pytypeinput-0.1.0/pytypeinput/html/renderer.py +396 -0
  104. pytypeinput-0.1.0/pytypeinput/html/templates.py +558 -0
  105. pytypeinput-0.1.0/pytypeinput/param.py +239 -0
  106. pytypeinput-0.1.0/pytypeinput/types.py +250 -0
  107. pytypeinput-0.1.0/readme.md +90 -0
  108. pytypeinput-0.1.0/tests/test_advanced_python_features.py +331 -0
  109. pytypeinput-0.1.0/tests/test_basic_types.py +286 -0
  110. pytypeinput-0.1.0/tests/test_dropdowns.py +1346 -0
  111. pytypeinput-0.1.0/tests/test_edge_cases.py +1987 -0
  112. pytypeinput-0.1.0/tests/test_error_recovery.py +49 -0
  113. pytypeinput-0.1.0/tests/test_field_constraints.py +448 -0
  114. pytypeinput-0.1.0/tests/test_functoweb_examples.py +710 -0
  115. pytypeinput-0.1.0/tests/test_lists.py +408 -0
  116. pytypeinput-0.1.0/tests/test_optional.py +413 -0
  117. pytypeinput-0.1.0/tests/test_real_world_scenarios.py +248 -0
  118. pytypeinput-0.1.0/tests/test_special_types.py +385 -0
  119. pytypeinput-0.1.0/tests/test_ui_metadata.py +630 -0
  120. pytypeinput-0.1.0/tests/test_ui_slider.py +292 -0
  121. pytypeinput-0.1.0/tests/tests/test_analyze_type.py +201 -0
@@ -0,0 +1,216 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
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
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2011-2025 The Bootstrap Authors
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,104 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytypeinput
3
+ Version: 0.1.0
4
+ Summary: Type hints → UI metadata. Build forms from Python function signatures.
5
+ Project-URL: Repository, https://github.com/offerrall/pytypeinput
6
+ Author: Beltrán Offerrall
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: pydantic>=2.0.0
11
+ Provides-Extra: html
12
+ Requires-Dist: jinja2>=3.0.0; extra == 'html'
13
+ Description-Content-Type: text/markdown
14
+
15
+ # pytypeinput 0.1.0
16
+
17
+ <div align="center">
18
+
19
+ [![PyPI version](https://img.shields.io/pypi/v/pytypeinput.svg)](https://pypi.org/project/pytypeinput/)
20
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
21
+ [![Tests](https://img.shields.io/badge/tests-661%20passed-brightgreen.svg)](tests/)
22
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
23
+
24
+ **Extract structured metadata from Python type hints.**
25
+
26
+ </div>
27
+
28
+ ---
29
+
30
+ pytypeinput analyzes Python type hints and extracts structured metadata. Use this metadata to build UIs, CLIs, config editors, or anything that needs input specifications.
31
+ ```python
32
+ from dataclasses import dataclass
33
+ from pytypeinput import Field, Annotated, analyze_dataclass
34
+
35
+ @dataclass
36
+ class User:
37
+ username: Annotated[str, Field(min_length=3, max_length=20)]
38
+ age: Annotated[int, Field(ge=18, le=120)]
39
+ bio: str | None = None
40
+
41
+ # Extract metadata
42
+ params = analyze_dataclass(User)
43
+ # Use it to build: HTML forms, CLIs, GUIs, validators...
44
+ ```
45
+
46
+ ## Design Goals
47
+
48
+ - **Single source of truth** - Define once with type hints, use everywhere (forms, CLIs, validation)
49
+ - **Minimal code** - Maximum features with minimum boilerplate
50
+ - **Type-safe** - Full IDE autocomplete and type checking
51
+ - **Pure Python** - Build UIs with Python code, not templates or DSLs
52
+
53
+ ## Installation
54
+ Core only:
55
+ ```bash
56
+ pip install pytypeinput
57
+ ```
58
+ With HTML renderer:
59
+ ```bash
60
+ pip install pytypeinput[html]
61
+ ```
62
+
63
+ **Requirements:** Python 3.10+ • Pydantic 2.0+
64
+
65
+ ## Documentation
66
+
67
+ **[Complete Documentation](https://offerrall.github.io/pytypeinput)** with interactive examples
68
+
69
+ **Type System:**
70
+ - **[Basic Types](https://offerrall.github.io/pytypeinput/basic-types/)**: `int`, `float`, `str`, `bool`, `date`, `time`
71
+ - **[Special Types](https://offerrall.github.io/pytypeinput/special-types/)**: `Email`, `Color`, `File`, `ImageFile`, etc.
72
+ - **[Lists](https://offerrall.github.io/pytypeinput/lists/)**: `list[Type]` with item and list-level validation
73
+ - **[Optionals](https://offerrall.github.io/pytypeinput/optionals/)**: `Type | None` with toggle switches
74
+ - **[Choices](https://offerrall.github.io/pytypeinput/choices/)**: `Literal`, `Enum`, `Dropdown(func)`
75
+ - **[Constraints](https://offerrall.github.io/pytypeinput/constraints/)**: `Field(min=, max=, pattern=)` for validation
76
+ - **[UI Metadata](https://offerrall.github.io/pytypeinput/ui-metadata/)**: Custom labels, descriptions, placeholders, sliders, etc.
77
+
78
+ **Renderers:**
79
+ - **[HTML Renderer](https://offerrall.github.io/pytypeinput/html-renderer/)** - Generate forms with client-side validation
80
+
81
+ **Reference:**
82
+ - **[API Reference](https://offerrall.github.io/pytypeinput/api/)** - Complete API documentation
83
+
84
+ ## What pytypeinput does
85
+
86
+ ✅ Extracts metadata from type hints
87
+ ✅ Works with functions, dataclasses, Pydantic models, classes
88
+ ✅ Optional HTML renderer with client-side validation
89
+ ✅ Framework-agnostic
90
+
91
+ ❌ No server-side validation
92
+ ❌ No form submission handling
93
+
94
+ **pytypeinput is a building block, not a complete solution.**
95
+
96
+ > **Validation:** Type hints validated when extracting metadata. HTML forms validate client-side. Server-side is your responsibility (use Pydantic with same type hints).
97
+
98
+ ## Contributing
99
+
100
+ Found a bug or have a suggestion? [Open an issue](https://github.com/offerrall/pytypeinput/issues)
101
+
102
+ ## License
103
+
104
+ MIT • [Beltrán Offerrall](https://github.com/offerrall)
@@ -0,0 +1,90 @@
1
+ # pytypeinput 0.1.0
2
+
3
+ <div align="center">
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/pytypeinput.svg)](https://pypi.org/project/pytypeinput/)
6
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
7
+ [![Tests](https://img.shields.io/badge/tests-661%20passed-brightgreen.svg)](tests/)
8
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+
10
+ **Extract structured metadata from Python type hints.**
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ pytypeinput analyzes Python type hints and extracts structured metadata. Use this metadata to build UIs, CLIs, config editors, or anything that needs input specifications.
17
+ ```python
18
+ from dataclasses import dataclass
19
+ from pytypeinput import Field, Annotated, analyze_dataclass
20
+
21
+ @dataclass
22
+ class User:
23
+ username: Annotated[str, Field(min_length=3, max_length=20)]
24
+ age: Annotated[int, Field(ge=18, le=120)]
25
+ bio: str | None = None
26
+
27
+ # Extract metadata
28
+ params = analyze_dataclass(User)
29
+ # Use it to build: HTML forms, CLIs, GUIs, validators...
30
+ ```
31
+
32
+ ## Design Goals
33
+
34
+ - **Single source of truth** - Define once with type hints, use everywhere (forms, CLIs, validation)
35
+ - **Minimal code** - Maximum features with minimum boilerplate
36
+ - **Type-safe** - Full IDE autocomplete and type checking
37
+ - **Pure Python** - Build UIs with Python code, not templates or DSLs
38
+
39
+ ## Installation
40
+ Core only:
41
+ ```bash
42
+ pip install pytypeinput
43
+ ```
44
+ With HTML renderer:
45
+ ```bash
46
+ pip install pytypeinput[html]
47
+ ```
48
+
49
+ **Requirements:** Python 3.10+ • Pydantic 2.0+
50
+
51
+ ## Documentation
52
+
53
+ **[Complete Documentation](https://offerrall.github.io/pytypeinput)** with interactive examples
54
+
55
+ **Type System:**
56
+ - **[Basic Types](https://offerrall.github.io/pytypeinput/basic-types/)**: `int`, `float`, `str`, `bool`, `date`, `time`
57
+ - **[Special Types](https://offerrall.github.io/pytypeinput/special-types/)**: `Email`, `Color`, `File`, `ImageFile`, etc.
58
+ - **[Lists](https://offerrall.github.io/pytypeinput/lists/)**: `list[Type]` with item and list-level validation
59
+ - **[Optionals](https://offerrall.github.io/pytypeinput/optionals/)**: `Type | None` with toggle switches
60
+ - **[Choices](https://offerrall.github.io/pytypeinput/choices/)**: `Literal`, `Enum`, `Dropdown(func)`
61
+ - **[Constraints](https://offerrall.github.io/pytypeinput/constraints/)**: `Field(min=, max=, pattern=)` for validation
62
+ - **[UI Metadata](https://offerrall.github.io/pytypeinput/ui-metadata/)**: Custom labels, descriptions, placeholders, sliders, etc.
63
+
64
+ **Renderers:**
65
+ - **[HTML Renderer](https://offerrall.github.io/pytypeinput/html-renderer/)** - Generate forms with client-side validation
66
+
67
+ **Reference:**
68
+ - **[API Reference](https://offerrall.github.io/pytypeinput/api/)** - Complete API documentation
69
+
70
+ ## What pytypeinput does
71
+
72
+ ✅ Extracts metadata from type hints
73
+ ✅ Works with functions, dataclasses, Pydantic models, classes
74
+ ✅ Optional HTML renderer with client-side validation
75
+ ✅ Framework-agnostic
76
+
77
+ ❌ No server-side validation
78
+ ❌ No form submission handling
79
+
80
+ **pytypeinput is a building block, not a complete solution.**
81
+
82
+ > **Validation:** Type hints validated when extracting metadata. HTML forms validate client-side. Server-side is your responsibility (use Pydantic with same type hints).
83
+
84
+ ## Contributing
85
+
86
+ Found a bug or have a suggestion? [Open an issue](https://github.com/offerrall/pytypeinput/issues)
87
+
88
+ ## License
89
+
90
+ MIT • [Beltrán Offerrall](https://github.com/offerrall)