wizard-ui-bridge 1.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 (28) hide show
  1. wizard_ui_bridge-1.1/LICENSE.txt +21 -0
  2. wizard_ui_bridge-1.1/PKG-INFO +222 -0
  3. wizard_ui_bridge-1.1/README_pypi.md +192 -0
  4. wizard_ui_bridge-1.1/pyproject.toml +32 -0
  5. wizard_ui_bridge-1.1/setup.cfg +4 -0
  6. wizard_ui_bridge-1.1/setup.py +16 -0
  7. wizard_ui_bridge-1.1/src/wizard_ui_bridge/__init__.py +71 -0
  8. wizard_ui_bridge-1.1/src/wizard_ui_bridge/_calendar.py +183 -0
  9. wizard_ui_bridge-1.1/src/wizard_ui_bridge/_fake.py +140 -0
  10. wizard_ui_bridge-1.1/src/wizard_ui_bridge/_form_prefill.py +78 -0
  11. wizard_ui_bridge-1.1/src/wizard_ui_bridge/_parse.py +303 -0
  12. wizard_ui_bridge-1.1/src/wizard_ui_bridge/_path.py +170 -0
  13. wizard_ui_bridge-1.1/src/wizard_ui_bridge/_table.py +215 -0
  14. wizard_ui_bridge-1.1/src/wizard_ui_bridge/_textual_widgets.py +227 -0
  15. wizard_ui_bridge-1.1/src/wizard_ui_bridge/arg_types.py +149 -0
  16. wizard_ui_bridge-1.1/src/wizard_ui_bridge/bridge.py +740 -0
  17. wizard_ui_bridge-1.1/src/wizard_ui_bridge/bridge_helpers.py +436 -0
  18. wizard_ui_bridge-1.1/src/wizard_ui_bridge/console.py +208 -0
  19. wizard_ui_bridge-1.1/src/wizard_ui_bridge/factory.py +109 -0
  20. wizard_ui_bridge-1.1/src/wizard_ui_bridge/form_defs.py +663 -0
  21. wizard_ui_bridge-1.1/src/wizard_ui_bridge/form_helpers.py +235 -0
  22. wizard_ui_bridge-1.1/src/wizard_ui_bridge/py.typed +1 -0
  23. wizard_ui_bridge-1.1/src/wizard_ui_bridge/textual_bridge.py +917 -0
  24. wizard_ui_bridge-1.1/wizard_ui_bridge.egg-info/PKG-INFO +222 -0
  25. wizard_ui_bridge-1.1/wizard_ui_bridge.egg-info/SOURCES.txt +26 -0
  26. wizard_ui_bridge-1.1/wizard_ui_bridge.egg-info/dependency_links.txt +1 -0
  27. wizard_ui_bridge-1.1/wizard_ui_bridge.egg-info/requires.txt +4 -0
  28. wizard_ui_bridge-1.1/wizard_ui_bridge.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tom Björkholm
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,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: wizard-ui-bridge
3
+ Version: 1.1
4
+ Summary: User interface bridge for wizards asking a user questions.
5
+ Author: Tom Björkholm
6
+ Author-email: Tom Björkholm <klausuler_linnet0q@icloud.com>
7
+ License-Expression: MIT
8
+ Project-URL: Source code, https://github.com/tom-bjorkholm/tableio_cfg_json
9
+ Project-URL: Documentation, https://github.com/tom-bjorkholm/tableio_cfg_json/tree/master/doc
10
+ Keywords: wizard,user interface,console,textual,form
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Environment :: Console
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE.txt
22
+ Requires-Dist: config-as-json>=1.4
23
+ Provides-Extra: textual
24
+ Requires-Dist: textual>=8.2.8; extra == "textual"
25
+ Dynamic: author
26
+ Dynamic: license-file
27
+ Dynamic: provides-extra
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+
31
+ # wizard-ui-bridge
32
+
33
+ `wizard-ui-bridge` is the user-interface-independent way for a wizard to
34
+ ask a user questions.
35
+
36
+ A wizard asks a series of questions and turns the answers into something,
37
+ often a configuration file. `WizardUiBridge` is the interface it asks
38
+ through, so the same wizard runs on a plain console, on a full-screen
39
+ [Textual](https://pypi.org/project/textual/) user interface, on a
40
+ graphical user interface you write yourself, or on a scripted bridge in
41
+ your tests.
42
+
43
+ ## Is this package for you?
44
+
45
+ This package is a good fit when one or more of these apply:
46
+
47
+ - You have a wizard, or a program that asks a user a series of questions,
48
+ and you do not want the questions to be tied to one user interface.
49
+ - You want typed questions: text, integer, float, path, yes/no, choice,
50
+ multi-choice, date, time, date and time, and duration, each with
51
+ validation and re-asking.
52
+ - You want to ask a whole form at once where the user interface can show
53
+ one, and fall back to one question at a time where it cannot.
54
+ - You want the user to be able to go back a step or cancel, without every
55
+ question having to handle that.
56
+ - You want a full-screen text user interface for free when the program
57
+ runs in a terminal, and a plain console fallback when it does not.
58
+ - You want your wizard to be testable without a terminal.
59
+
60
+ This package is probably not the right one when:
61
+
62
+ - You want a general widget toolkit. Use
63
+ [Textual](https://pypi.org/project/textual/) or a GUI toolkit directly.
64
+ - You only need one `input()` call.
65
+
66
+ ## Installation
67
+
68
+ `wizard-ui-bridge` requires Python 3.12 or newer.
69
+
70
+ ```sh
71
+ pip install --upgrade wizard-ui-bridge
72
+ ```
73
+
74
+ Textual is optional. Install it with the extra when you want the
75
+ full-screen text user interface:
76
+
77
+ ```sh
78
+ pip install --upgrade 'wizard-ui-bridge[textual]'
79
+ ```
80
+
81
+ Without the extra, everything except the Textual bridge works, and
82
+ `make_text_ui_bridge()` returns the console bridge. Importing
83
+ `wizard_ui_bridge` never imports Textual; it is imported the first time a
84
+ Textual bridge is actually used. Asking for the Textual bridge without
85
+ Textual installed raises `ImportError` naming the extra to install.
86
+
87
+ ## Quick start
88
+
89
+ Ask a small form, on the best user interface the terminal allows:
90
+
91
+ ```python
92
+ import sys
93
+
94
+ from wizard_ui_bridge import AskTextField, AskIntField, AskYesNoField, \
95
+ make_text_ui_bridge
96
+
97
+ bridge = make_text_ui_bridge(sys.stdout, sys.stdin, sys.stderr)
98
+ answers = bridge.ask_form('Describe the export', [
99
+ AskTextField('Report name', 'Shown as the title of the report'),
100
+ AskIntField('Rows', 'How many rows to export', min_value=1),
101
+ AskYesNoField('Headings', 'Write a heading row', True)])
102
+ for answer in answers:
103
+ print(f'{answer.asking.short_question}: {answer.value}')
104
+ ```
105
+
106
+ The same code runs as a full-screen form when Textual is installed and
107
+ the program runs in a terminal, and as one console question at a time
108
+ when it does not.
109
+
110
+ Ask one question at a time instead:
111
+
112
+ ```python
113
+ name = bridge.ask_text('Report name', default='report')
114
+ rows = bridge.ask_int('Rows', min_value=1)
115
+ ```
116
+
117
+ ## Main entry points
118
+
119
+ - `WizardUiBridge`
120
+ The bridge a wizard asks through. Subclass it to connect a wizard to a
121
+ user interface of your own; the base class turns the typed questions and
122
+ whole-form questions into the few methods your subclass implements.
123
+
124
+ - `make_text_ui_bridge()` and `UiBridgeType`
125
+ Return the Textual bridge when Textual is installed and both streams are
126
+ a terminal, and the console bridge otherwise. `UiBridgeType` forces one
127
+ or the other.
128
+
129
+ - `WizardUiBridgeConsole`
130
+ Asks one question at a time on plain text streams.
131
+
132
+ - `WizardUiBridgeTextual`
133
+ Full-screen text user interface, needs the `textual` extra.
134
+
135
+ - `AskTextField`, `AskIntField`, `AskFloatField`, `AskPathField`,
136
+ `AskYesNoField`, `AskChoiceField`, `AskMultiChoiceField`,
137
+ `AskDateField`, `AskTimeField`, `AskDateTimeField`, `AskDurationField`
138
+ The typed fields a form is built from, each with a matching
139
+ `Answer...Field`.
140
+
141
+ - `WizardBack`, `WizardAbort`, `WizardCancelLevel`, `WizardNavigation`
142
+ How a user asks to go back a step or to give up, without every question
143
+ having to handle it.
144
+
145
+ - `TableColumn`, `TableCell` and `ask_table()`
146
+ Ask for a small table of values, with a fixed or variable number of rows.
147
+
148
+ - `textual_installed()` and `load_textual_bridge()`
149
+ Ask whether the optional Textual bridge can be used, and get the class
150
+ when it can.
151
+
152
+ ### Writing your own bridge
153
+
154
+ A bridge of your own subclasses `WizardUiBridge` and implements the few
155
+ asking methods. The modules `wizard_ui_bridge.bridge_helpers` and
156
+ `wizard_ui_bridge.form_helpers` hold the helpers the bundled bridges use
157
+ to interpret raw answers and to build form answers, so that a bridge of
158
+ your own behaves the same way.
159
+
160
+ ## Deprecation: `WizardUiBridge.ask()` is removed next release
161
+
162
+ This is the **last release** that supports the low-level
163
+ `WizardUiBridge.ask()` method. The **next release removes it entirely**,
164
+ dropping both:
165
+
166
+ - calling `WizardUiBridge.ask()` from a wizard, and
167
+ - the backward-compatibility fallbacks that let a bridge which only
168
+ overrides `ask()` keep working by rerouting the typed `ask_*()` calls
169
+ through it.
170
+
171
+ After the next release, any bridge that still calls or overrides
172
+ `ask()` **will stop working**. Every use now warns loudly, so the
173
+ change is impossible to miss: it raises a `DeprecationWarning` (shown by
174
+ pytest and other tools), an additional `UserWarning` that Python shows
175
+ to end users by default, and it prints the message to standard error.
176
+
177
+ To keep your bridge working, implement the typed methods directly
178
+ instead of `ask()`: `ask_text()`, `ask_choice()`, `ask_multi()`,
179
+ `ask_yes_no()` and `ask_table()`. See *Writing your own bridge* above.
180
+
181
+ ## Relation to tableio-cfg-json
182
+
183
+ This package used to be part of
184
+ [tableio-cfg-json](https://pypi.org/project/tableio-cfg-json/). It was
185
+ split out so that a wizard that has nothing to do with TableIO does not
186
+ have to install TableIO and everything TableIO depends on.
187
+
188
+ Applications that import the bridge from `tableio_cfg_json` keep working,
189
+ with a deprecation warning per name, and should change the imports as
190
+ described in the `tableio-cfg-json` documentation.
191
+
192
+ ### Planned source code repo change
193
+
194
+ Currently both `tableio_cfg_json` and `wizard-ui-bridge` source code
195
+ are in the same repo in GitHub. This will change very soon.
196
+ The change will break some old URLs to the source code, to documentation,
197
+ and to examples. When the change happens a new release with new URLs will
198
+ be made.
199
+
200
+ ## Documentation
201
+
202
+ - Teaching examples and walkthroughs: [wizard_ui_bridge/example/src/wizard_ui_example](https://github.com/tom-bjorkholm/tableio_cfg_json/blob/master/wizard_ui_bridge/example/src/wizard_ui_example)
203
+
204
+ - Public API notes: [doc/wizard_ui_bridge_api.md](https://github.com/tom-bjorkholm/tableio_cfg_json/blob/master/doc/wizard_ui_bridge_api.md)
205
+
206
+ - Protected/internal API notes: [doc/wizard_ui_bridge_protected_api.md](https://github.com/tom-bjorkholm/tableio_cfg_json/blob/master/doc/wizard_ui_bridge_protected_api.md)
207
+
208
+ - Source repository: [tableio_cfg_json](https://github.com/tom-bjorkholm/tableio_cfg_json/)
209
+
210
+ ## License
211
+
212
+ MIT
213
+
214
+ ## Test summary
215
+
216
+ - Test result: 1049 passed in 49s
217
+ - No flake8 warnings.
218
+ - No mypy errors found.
219
+ - No pylint warnings.
220
+ - No python layout warnings.
221
+ - Built version(s): 1.1
222
+ - Build and test using Python 3.14.6
@@ -0,0 +1,192 @@
1
+ # wizard-ui-bridge
2
+
3
+ `wizard-ui-bridge` is the user-interface-independent way for a wizard to
4
+ ask a user questions.
5
+
6
+ A wizard asks a series of questions and turns the answers into something,
7
+ often a configuration file. `WizardUiBridge` is the interface it asks
8
+ through, so the same wizard runs on a plain console, on a full-screen
9
+ [Textual](https://pypi.org/project/textual/) user interface, on a
10
+ graphical user interface you write yourself, or on a scripted bridge in
11
+ your tests.
12
+
13
+ ## Is this package for you?
14
+
15
+ This package is a good fit when one or more of these apply:
16
+
17
+ - You have a wizard, or a program that asks a user a series of questions,
18
+ and you do not want the questions to be tied to one user interface.
19
+ - You want typed questions: text, integer, float, path, yes/no, choice,
20
+ multi-choice, date, time, date and time, and duration, each with
21
+ validation and re-asking.
22
+ - You want to ask a whole form at once where the user interface can show
23
+ one, and fall back to one question at a time where it cannot.
24
+ - You want the user to be able to go back a step or cancel, without every
25
+ question having to handle that.
26
+ - You want a full-screen text user interface for free when the program
27
+ runs in a terminal, and a plain console fallback when it does not.
28
+ - You want your wizard to be testable without a terminal.
29
+
30
+ This package is probably not the right one when:
31
+
32
+ - You want a general widget toolkit. Use
33
+ [Textual](https://pypi.org/project/textual/) or a GUI toolkit directly.
34
+ - You only need one `input()` call.
35
+
36
+ ## Installation
37
+
38
+ `wizard-ui-bridge` requires Python 3.12 or newer.
39
+
40
+ ```sh
41
+ pip install --upgrade wizard-ui-bridge
42
+ ```
43
+
44
+ Textual is optional. Install it with the extra when you want the
45
+ full-screen text user interface:
46
+
47
+ ```sh
48
+ pip install --upgrade 'wizard-ui-bridge[textual]'
49
+ ```
50
+
51
+ Without the extra, everything except the Textual bridge works, and
52
+ `make_text_ui_bridge()` returns the console bridge. Importing
53
+ `wizard_ui_bridge` never imports Textual; it is imported the first time a
54
+ Textual bridge is actually used. Asking for the Textual bridge without
55
+ Textual installed raises `ImportError` naming the extra to install.
56
+
57
+ ## Quick start
58
+
59
+ Ask a small form, on the best user interface the terminal allows:
60
+
61
+ ```python
62
+ import sys
63
+
64
+ from wizard_ui_bridge import AskTextField, AskIntField, AskYesNoField, \
65
+ make_text_ui_bridge
66
+
67
+ bridge = make_text_ui_bridge(sys.stdout, sys.stdin, sys.stderr)
68
+ answers = bridge.ask_form('Describe the export', [
69
+ AskTextField('Report name', 'Shown as the title of the report'),
70
+ AskIntField('Rows', 'How many rows to export', min_value=1),
71
+ AskYesNoField('Headings', 'Write a heading row', True)])
72
+ for answer in answers:
73
+ print(f'{answer.asking.short_question}: {answer.value}')
74
+ ```
75
+
76
+ The same code runs as a full-screen form when Textual is installed and
77
+ the program runs in a terminal, and as one console question at a time
78
+ when it does not.
79
+
80
+ Ask one question at a time instead:
81
+
82
+ ```python
83
+ name = bridge.ask_text('Report name', default='report')
84
+ rows = bridge.ask_int('Rows', min_value=1)
85
+ ```
86
+
87
+ ## Main entry points
88
+
89
+ - `WizardUiBridge`
90
+ The bridge a wizard asks through. Subclass it to connect a wizard to a
91
+ user interface of your own; the base class turns the typed questions and
92
+ whole-form questions into the few methods your subclass implements.
93
+
94
+ - `make_text_ui_bridge()` and `UiBridgeType`
95
+ Return the Textual bridge when Textual is installed and both streams are
96
+ a terminal, and the console bridge otherwise. `UiBridgeType` forces one
97
+ or the other.
98
+
99
+ - `WizardUiBridgeConsole`
100
+ Asks one question at a time on plain text streams.
101
+
102
+ - `WizardUiBridgeTextual`
103
+ Full-screen text user interface, needs the `textual` extra.
104
+
105
+ - `AskTextField`, `AskIntField`, `AskFloatField`, `AskPathField`,
106
+ `AskYesNoField`, `AskChoiceField`, `AskMultiChoiceField`,
107
+ `AskDateField`, `AskTimeField`, `AskDateTimeField`, `AskDurationField`
108
+ The typed fields a form is built from, each with a matching
109
+ `Answer...Field`.
110
+
111
+ - `WizardBack`, `WizardAbort`, `WizardCancelLevel`, `WizardNavigation`
112
+ How a user asks to go back a step or to give up, without every question
113
+ having to handle it.
114
+
115
+ - `TableColumn`, `TableCell` and `ask_table()`
116
+ Ask for a small table of values, with a fixed or variable number of rows.
117
+
118
+ - `textual_installed()` and `load_textual_bridge()`
119
+ Ask whether the optional Textual bridge can be used, and get the class
120
+ when it can.
121
+
122
+ ### Writing your own bridge
123
+
124
+ A bridge of your own subclasses `WizardUiBridge` and implements the few
125
+ asking methods. The modules `wizard_ui_bridge.bridge_helpers` and
126
+ `wizard_ui_bridge.form_helpers` hold the helpers the bundled bridges use
127
+ to interpret raw answers and to build form answers, so that a bridge of
128
+ your own behaves the same way.
129
+
130
+ ## Deprecation: `WizardUiBridge.ask()` is removed next release
131
+
132
+ This is the **last release** that supports the low-level
133
+ `WizardUiBridge.ask()` method. The **next release removes it entirely**,
134
+ dropping both:
135
+
136
+ - calling `WizardUiBridge.ask()` from a wizard, and
137
+ - the backward-compatibility fallbacks that let a bridge which only
138
+ overrides `ask()` keep working by rerouting the typed `ask_*()` calls
139
+ through it.
140
+
141
+ After the next release, any bridge that still calls or overrides
142
+ `ask()` **will stop working**. Every use now warns loudly, so the
143
+ change is impossible to miss: it raises a `DeprecationWarning` (shown by
144
+ pytest and other tools), an additional `UserWarning` that Python shows
145
+ to end users by default, and it prints the message to standard error.
146
+
147
+ To keep your bridge working, implement the typed methods directly
148
+ instead of `ask()`: `ask_text()`, `ask_choice()`, `ask_multi()`,
149
+ `ask_yes_no()` and `ask_table()`. See *Writing your own bridge* above.
150
+
151
+ ## Relation to tableio-cfg-json
152
+
153
+ This package used to be part of
154
+ [tableio-cfg-json](https://pypi.org/project/tableio-cfg-json/). It was
155
+ split out so that a wizard that has nothing to do with TableIO does not
156
+ have to install TableIO and everything TableIO depends on.
157
+
158
+ Applications that import the bridge from `tableio_cfg_json` keep working,
159
+ with a deprecation warning per name, and should change the imports as
160
+ described in the `tableio-cfg-json` documentation.
161
+
162
+ ### Planned source code repo change
163
+
164
+ Currently both `tableio_cfg_json` and `wizard-ui-bridge` source code
165
+ are in the same repo in GitHub. This will change very soon.
166
+ The change will break some old URLs to the source code, to documentation,
167
+ and to examples. When the change happens a new release with new URLs will
168
+ be made.
169
+
170
+ ## Documentation
171
+
172
+ - Teaching examples and walkthroughs: [wizard_ui_bridge/example/src/wizard_ui_example](https://github.com/tom-bjorkholm/tableio_cfg_json/blob/master/wizard_ui_bridge/example/src/wizard_ui_example)
173
+
174
+ - Public API notes: [doc/wizard_ui_bridge_api.md](https://github.com/tom-bjorkholm/tableio_cfg_json/blob/master/doc/wizard_ui_bridge_api.md)
175
+
176
+ - Protected/internal API notes: [doc/wizard_ui_bridge_protected_api.md](https://github.com/tom-bjorkholm/tableio_cfg_json/blob/master/doc/wizard_ui_bridge_protected_api.md)
177
+
178
+ - Source repository: [tableio_cfg_json](https://github.com/tom-bjorkholm/tableio_cfg_json/)
179
+
180
+ ## License
181
+
182
+ MIT
183
+
184
+ ## Test summary
185
+
186
+ - Test result: 1049 passed in 49s
187
+ - No flake8 warnings.
188
+ - No mypy errors found.
189
+ - No pylint warnings.
190
+ - No python layout warnings.
191
+ - Built version(s): 1.1
192
+ - Build and test using Python 3.14.6
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=83.0.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "wizard-ui-bridge"
7
+ authors = [
8
+ { name="Tom Björkholm", email="klausuler_linnet0q@icloud.com" },
9
+ ]
10
+ description = "User interface bridge for wizards asking a user questions."
11
+ readme = "README_pypi.md"
12
+ requires-python = ">=3.12"
13
+ license = "MIT"
14
+ license-files = ["LICENSE.txt"]
15
+ keywords = [
16
+ "wizard", "user interface", "console", "textual", "form"
17
+ ]
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Operating System :: OS Independent",
24
+ "Intended Audience :: Developers",
25
+ "Environment :: Console",
26
+ "Typing :: Typed"
27
+ ]
28
+ dynamic = ["dependencies", "optional-dependencies", "version"]
29
+
30
+ [project.urls]
31
+ "Source code" = "https://github.com/tom-bjorkholm/tableio_cfg_json"
32
+ "Documentation" = "https://github.com/tom-bjorkholm/tableio_cfg_json/tree/master/doc"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,16 @@
1
+ #! /usr/local/bin/python3
2
+ """Setup file specifying build of .whl."""
3
+
4
+ from setuptools import setup # type: ignore[import-untyped]
5
+
6
+ setup(
7
+ name='wizard-ui-bridge', version='1.1',
8
+ description='User interface bridge for wizards asking a user questions.',
9
+ author='Tom Björkholm', author_email='klausuler_linnet0q@icloud.com',
10
+ python_requires='>=3.12', packages=['wizard_ui_bridge'],
11
+ package_dir={'wizard_ui_bridge': 'src/wizard_ui_bridge'},
12
+ package_data={'wizard_ui_bridge': ['py.typed']},
13
+ install_requires=[
14
+ 'config-as-json >= 1.4',
15
+ ],
16
+ extras_require={'textual': ['textual >= 8.2.8']})
@@ -0,0 +1,71 @@
1
+ #! /usr/local/bin/python3
2
+ """Public API for the wizard user interface bridge.
3
+
4
+ A wizard asks a user a series of questions. WizardUiBridge is the
5
+ user-interface-independent way to ask them, so that one wizard can run
6
+ on a plain console, on a full-screen Textual user interface, or on any
7
+ other bridge an application implements.
8
+
9
+ The Textual bridge needs the optional textual package, installed with
10
+ the extra `wizard-ui-bridge[textual]`. Textual is imported only when
11
+ the Textual bridge is actually used, so importing this package, or
12
+ asking for WizardUiBridgeConsole, never imports Textual. Asking for
13
+ WizardUiBridgeTextual without textual installed raises ImportError
14
+ naming the extra to install.
15
+
16
+ Helpers for implementing a bridge of your own are in the modules
17
+ wizard_ui_bridge.bridge_helpers and wizard_ui_bridge.form_helpers.
18
+ """
19
+
20
+ # Copyright (c) 2026 Tom Björkholm
21
+ # MIT License
22
+
23
+ from typing import TYPE_CHECKING
24
+ from wizard_ui_bridge.bridge import WizardUiBridge
25
+ from wizard_ui_bridge.arg_types import PartialCheck, TableCell, \
26
+ PathAskOptions, TableColumn, WizardAbort, WizardBack, WizardCancelLevel, \
27
+ WizardNavigation, WizardPathKind
28
+ from wizard_ui_bridge.console import WizardUiBridgeConsole
29
+ from wizard_ui_bridge.form_defs import AskField, AskFields, AnswerField, \
30
+ AnswerFields, PartialFormValidator, PartFormValidationResult, \
31
+ PrefillValues, PrefillValueType, AskTextField, AskIntField, \
32
+ AskPathField, AskYesNoField, AskChoiceField, AskMultiChoiceField, \
33
+ AskFloatField, AskDateField, AskTimeField, AskDateTimeField, \
34
+ AskDurationField, AnswerTextField, AnswerIntField, AnswerPathField, \
35
+ AnswerYesNoField, AnswerChoiceField, AnswerMultiChoiceField, \
36
+ AnswerFloatField, AnswerDateField, AnswerTimeField, AnswerDateTimeField, \
37
+ AnswerDurationField
38
+ from wizard_ui_bridge.factory import make_text_ui_bridge, UiBridgeType, \
39
+ textual_installed, load_textual_bridge
40
+ if TYPE_CHECKING:
41
+ from wizard_ui_bridge.textual_bridge import WizardUiBridgeTextual
42
+
43
+
44
+ def __getattr__(name: str) -> object:
45
+ """Return the Textual bridge class, imported on first use.
46
+
47
+ Textual is an optional dependency, so the Textual bridge is not
48
+ imported when this package is imported. Asking for it without
49
+ textual installed raises ImportError naming the extra to install.
50
+ """
51
+ if name == 'WizardUiBridgeTextual':
52
+ return load_textual_bridge()
53
+ raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
54
+
55
+
56
+ __all__ = ['WizardUiBridge', 'WizardUiBridgeConsole', 'WizardUiBridgeTextual',
57
+ 'WizardNavigation', 'WizardBack', 'WizardCancelLevel',
58
+ 'WizardAbort', 'TableColumn', 'TableCell', 'PartialCheck',
59
+ 'make_text_ui_bridge', 'UiBridgeType', 'textual_installed',
60
+ 'load_textual_bridge', 'PathAskOptions', 'WizardPathKind',
61
+ 'AskField', 'AskFields', 'AnswerField', 'AnswerFields',
62
+ 'PartialFormValidator', 'PartFormValidationResult',
63
+ 'PrefillValues', 'PrefillValueType',
64
+ 'AskTextField', 'AskIntField', 'AskPathField', 'AskYesNoField',
65
+ 'AskChoiceField', 'AskMultiChoiceField', 'AskFloatField',
66
+ 'AskDateField', 'AskTimeField', 'AskDateTimeField',
67
+ 'AskDurationField', 'AnswerTextField',
68
+ 'AnswerIntField', 'AnswerPathField', 'AnswerYesNoField',
69
+ 'AnswerChoiceField', 'AnswerMultiChoiceField', 'AnswerFloatField',
70
+ 'AnswerDateField', 'AnswerTimeField', 'AnswerDateTimeField',
71
+ 'AnswerDurationField']