wizard-ui-bridge 1.2__tar.gz → 1.4__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.2/wizard_ui_bridge.egg-info → wizard_ui_bridge-1.4}/PKG-INFO +26 -32
  2. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/README_pypi.md +24 -30
  3. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/setup.py +2 -2
  4. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/_textual_widgets.py +2 -6
  5. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/bridge_helpers.py +17 -5
  6. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/factory.py +4 -3
  7. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/textual_bridge.py +4 -9
  8. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4/wizard_ui_bridge.egg-info}/PKG-INFO +26 -32
  9. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/wizard_ui_bridge.egg-info/requires.txt +1 -1
  10. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/LICENSE.txt +0 -0
  11. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/pyproject.toml +0 -0
  12. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/setup.cfg +0 -0
  13. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/__init__.py +0 -0
  14. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/_calendar.py +0 -0
  15. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/_fake.py +0 -0
  16. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/_form_prefill.py +0 -0
  17. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/_parse.py +0 -0
  18. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/_path.py +0 -0
  19. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/_table.py +0 -0
  20. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/arg_types.py +0 -0
  21. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/bridge.py +0 -0
  22. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/console.py +0 -0
  23. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/form_defs.py +0 -0
  24. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/form_helpers.py +0 -0
  25. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/src/wizard_ui_bridge/py.typed +0 -0
  26. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/wizard_ui_bridge.egg-info/SOURCES.txt +0 -0
  27. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/wizard_ui_bridge.egg-info/dependency_links.txt +0 -0
  28. {wizard_ui_bridge-1.2 → wizard_ui_bridge-1.4}/wizard_ui_bridge.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizard-ui-bridge
3
- Version: 1.2
3
+ Version: 1.4
4
4
  Summary: User interface bridge for wizards asking a user questions.
5
5
  Author: Tom Björkholm
6
6
  Author-email: Tom Björkholm <klausuler_linnet0q@icloud.com>
@@ -19,7 +19,7 @@ Classifier: Typing :: Typed
19
19
  Requires-Python: >=3.12
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
- Requires-Dist: config-as-json>=1.4
22
+ Requires-Dist: config-as-json>=1.7
23
23
  Provides-Extra: textual
24
24
  Requires-Dist: textual>=8.2.8; extra == "textual"
25
25
  Dynamic: author
@@ -36,9 +36,17 @@ ask a user questions.
36
36
  A wizard asks a series of questions and turns the answers into something,
37
37
  often a configuration file. `WizardUiBridge` is the interface it asks
38
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.
39
+ [Textual](https://pypi.org/project/textual/) user interface, in a
40
+ graphical user interface (Tkinter through the companion package below,
41
+ or a toolkit you write a bridge for yourself), or on a scripted bridge
42
+ in your tests.
43
+
44
+ ## Tk companion
45
+
46
+ `wizard-ui-bridge` has a companion
47
+ [wizard-tk-bridge](https://pypi.org/project/wizard-tk-bridge/) that
48
+ implements the same user-interface-independent way for a wizard to
49
+ ask a user questions using a Tkinter GUI.
42
50
 
43
51
  ## Is this package for you?
44
52
 
@@ -157,40 +165,26 @@ asking methods. The modules `wizard_ui_bridge.bridge_helpers` and
157
165
  to interpret raw answers and to build form answers, so that a bridge of
158
166
  your own behaves the same way.
159
167
 
160
- ## Removed: `WizardUiBridge.ask()`
161
-
162
- The low-level `WizardUiBridge.ask()` method is **removed**, and with it:
163
-
164
- - calling `WizardUiBridge.ask()` from a wizard, and
165
- - the backward-compatibility fallbacks that let a bridge which only
166
- overrode `ask()` keep working by rerouting the typed `ask_*()` calls
167
- through it.
168
+ ## History
168
169
 
169
- Version 1.1 was the last version that supported `ask()`, where every use
170
- warned loudly that it was about to be removed. A bridge that still calls
171
- or overrides `ask()` no longer works.
170
+ The low-level `WizardUiBridge.ask()` method was **removed** in version
171
+ 1.2, together with the fallbacks that let a bridge which only overrode
172
+ `ask()` keep working by rerouting the typed `ask_*()` calls through it.
173
+ Version 1.1 was the last version that supported it. A bridge implements
174
+ the typed methods directly: `ask_text()`, `ask_choice()`, `ask_multi()`,
175
+ `ask_yes_no()` and `ask_table()`, together with `show()`. A typed method
176
+ a bridge does not implement raises `NotImplementedError`. See *Writing
177
+ your own bridge* above.
172
178
 
173
- Implement the typed methods directly instead of `ask()`: `ask_text()`,
174
- `ask_choice()`, `ask_multi()`, `ask_yes_no()` and `ask_table()`, together
175
- with `show()`. A typed method a bridge does not implement raises
176
- `NotImplementedError`. See *Writing your own bridge* above.
177
-
178
- ## Relation to tableio-cfg-json
179
+ ### Relation to tableio-cfg-json
179
180
 
180
181
  This package used to be part of
181
182
  [tableio-cfg-json](https://pypi.org/project/tableio-cfg-json/). It was
182
183
  split out so that a wizard that has nothing to do with TableIO does not
183
184
  have to install TableIO and everything TableIO depends on.
184
185
 
185
- Applications that import the bridge from `tableio_cfg_json` keep working,
186
- with a deprecation warning per name, and should change the imports as
187
- described in the `tableio-cfg-json` documentation.
188
-
189
186
  ### Source code repo history
190
187
 
191
- The wizard UI bridge `wizard-ui-bridge` code used to be part of
192
- `tableio-cfg-json` git repo, but has been split out.
193
-
194
188
  The two git repos
195
189
  [https://github.com/tom-bjorkholm/wizard-ui-bridge](https://github.com/tom-bjorkholm/wizard-ui-bridge)
196
190
  and
@@ -215,10 +209,10 @@ MIT
215
209
 
216
210
  ## Test summary
217
211
 
218
- - Test result: 713 passed in 30s
212
+ - Test result: 1084 passed, 9 deselected in 45s
219
213
  - No flake8 warnings.
220
214
  - No mypy errors found.
221
215
  - No pylint warnings.
222
216
  - No python layout warnings.
223
- - Built version(s): 1.2
224
- - Build and test using Python 3.14.6
217
+ - Built version(s): 1.4
218
+ - Build and test using Python 3.14.7
@@ -6,9 +6,17 @@ ask a user questions.
6
6
  A wizard asks a series of questions and turns the answers into something,
7
7
  often a configuration file. `WizardUiBridge` is the interface it asks
8
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.
9
+ [Textual](https://pypi.org/project/textual/) user interface, in a
10
+ graphical user interface (Tkinter through the companion package below,
11
+ or a toolkit you write a bridge for yourself), or on a scripted bridge
12
+ in your tests.
13
+
14
+ ## Tk companion
15
+
16
+ `wizard-ui-bridge` has a companion
17
+ [wizard-tk-bridge](https://pypi.org/project/wizard-tk-bridge/) that
18
+ implements the same user-interface-independent way for a wizard to
19
+ ask a user questions using a Tkinter GUI.
12
20
 
13
21
  ## Is this package for you?
14
22
 
@@ -127,40 +135,26 @@ asking methods. The modules `wizard_ui_bridge.bridge_helpers` and
127
135
  to interpret raw answers and to build form answers, so that a bridge of
128
136
  your own behaves the same way.
129
137
 
130
- ## Removed: `WizardUiBridge.ask()`
131
-
132
- The low-level `WizardUiBridge.ask()` method is **removed**, and with it:
133
-
134
- - calling `WizardUiBridge.ask()` from a wizard, and
135
- - the backward-compatibility fallbacks that let a bridge which only
136
- overrode `ask()` keep working by rerouting the typed `ask_*()` calls
137
- through it.
138
+ ## History
138
139
 
139
- Version 1.1 was the last version that supported `ask()`, where every use
140
- warned loudly that it was about to be removed. A bridge that still calls
141
- or overrides `ask()` no longer works.
140
+ The low-level `WizardUiBridge.ask()` method was **removed** in version
141
+ 1.2, together with the fallbacks that let a bridge which only overrode
142
+ `ask()` keep working by rerouting the typed `ask_*()` calls through it.
143
+ Version 1.1 was the last version that supported it. A bridge implements
144
+ the typed methods directly: `ask_text()`, `ask_choice()`, `ask_multi()`,
145
+ `ask_yes_no()` and `ask_table()`, together with `show()`. A typed method
146
+ a bridge does not implement raises `NotImplementedError`. See *Writing
147
+ your own bridge* above.
142
148
 
143
- Implement the typed methods directly instead of `ask()`: `ask_text()`,
144
- `ask_choice()`, `ask_multi()`, `ask_yes_no()` and `ask_table()`, together
145
- with `show()`. A typed method a bridge does not implement raises
146
- `NotImplementedError`. See *Writing your own bridge* above.
147
-
148
- ## Relation to tableio-cfg-json
149
+ ### Relation to tableio-cfg-json
149
150
 
150
151
  This package used to be part of
151
152
  [tableio-cfg-json](https://pypi.org/project/tableio-cfg-json/). It was
152
153
  split out so that a wizard that has nothing to do with TableIO does not
153
154
  have to install TableIO and everything TableIO depends on.
154
155
 
155
- Applications that import the bridge from `tableio_cfg_json` keep working,
156
- with a deprecation warning per name, and should change the imports as
157
- described in the `tableio-cfg-json` documentation.
158
-
159
156
  ### Source code repo history
160
157
 
161
- The wizard UI bridge `wizard-ui-bridge` code used to be part of
162
- `tableio-cfg-json` git repo, but has been split out.
163
-
164
158
  The two git repos
165
159
  [https://github.com/tom-bjorkholm/wizard-ui-bridge](https://github.com/tom-bjorkholm/wizard-ui-bridge)
166
160
  and
@@ -185,10 +179,10 @@ MIT
185
179
 
186
180
  ## Test summary
187
181
 
188
- - Test result: 713 passed in 30s
182
+ - Test result: 1084 passed, 9 deselected in 45s
189
183
  - No flake8 warnings.
190
184
  - No mypy errors found.
191
185
  - No pylint warnings.
192
186
  - No python layout warnings.
193
- - Built version(s): 1.2
194
- - Build and test using Python 3.14.6
187
+ - Built version(s): 1.4
188
+ - Build and test using Python 3.14.7
@@ -4,13 +4,13 @@
4
4
  from setuptools import setup # type: ignore[import-untyped]
5
5
 
6
6
  setup(
7
- name='wizard-ui-bridge', version='1.2',
7
+ name='wizard-ui-bridge', version='1.4',
8
8
  description='User interface bridge for wizards asking a user questions.',
9
9
  author='Tom Björkholm', author_email='klausuler_linnet0q@icloud.com',
10
10
  python_requires='>=3.12', packages=['wizard_ui_bridge'],
11
11
  package_dir={'wizard_ui_bridge': 'src/wizard_ui_bridge'},
12
12
  package_data={'wizard_ui_bridge': ['py.typed']},
13
13
  install_requires=[
14
- 'config-as-json >= 1.4',
14
+ 'config-as-json >= 1.7',
15
15
  ],
16
16
  extras_require={'textual': ['textual >= 8.2.8']})
@@ -23,7 +23,7 @@ from textual.widget import Widget
23
23
  from textual.widgets import Button, Checkbox, Input, Select, SelectionList, \
24
24
  Static
25
25
  from textual.widgets.selection_list import Selection
26
- from wizard_ui_bridge.bridge_helpers import multi_count_error
26
+ from wizard_ui_bridge.bridge_helpers import multi_count_message
27
27
  from wizard_ui_bridge._parse import format_new_value, \
28
28
  parse_date, parse_datetime
29
29
  from wizard_ui_bridge.arg_types import TableCell
@@ -189,11 +189,7 @@ def _pick_index(widget_id: Optional[str]) -> Optional[int]:
189
189
 
190
190
  def _multi_error(count: int, field: AskMultiChoiceField) -> Optional[str]:
191
191
  """Return the multi-choice count error, or None when acceptable."""
192
- too_few = count < field.min_select
193
- too_many = field.max_select is not None and count > field.max_select
194
- if too_few or too_many:
195
- return multi_count_error(field.min_select, field.max_select)
196
- return None
192
+ return multi_count_message(count, field.min_select, field.max_select)
197
193
 
198
194
 
199
195
  def _field_message(field: AskField, message: str) -> str:
@@ -405,11 +405,8 @@ def _resolve_multi(answer: str | int, choices: Sequence[str],
405
405
  if labels is None:
406
406
  return (None, CHOICE_ERROR)
407
407
  chosen = [choice for choice in choices if choice in set(labels)]
408
- too_few = len(chosen) < min_select
409
- too_many = max_select is not None and len(chosen) > max_select
410
- if too_few or too_many:
411
- return (None, multi_count_error(min_select, max_select))
412
- return (chosen, '')
408
+ error = multi_count_message(len(chosen), min_select, max_select)
409
+ return (chosen, '') if error is None else (None, error)
413
410
 
414
411
 
415
412
  def _multi_labels(answer: str | int, choices: Sequence[str],
@@ -472,3 +469,18 @@ def multi_count_error(min_select: int, max_select: Optional[int]) -> str:
472
469
  if min_select == max_select:
473
470
  return f'Please select exactly {min_select}.'
474
471
  return f'Please select between {min_select} and {max_select}.'
472
+
473
+
474
+ def multi_count_message(count: int, min_select: int,
475
+ max_select: Optional[int]) -> Optional[str]:
476
+ """Return why count is not an allowed selection size, or None.
477
+
478
+ Every bridge accepts the same selection counts and explains a
479
+ rejected count with the same message, so each of them asks here
480
+ instead of repeating the bounds check and the wording.
481
+ """
482
+ too_few = count < min_select
483
+ too_many = max_select is not None and count > max_select
484
+ if too_few or too_many:
485
+ return multi_count_error(min_select, max_select)
486
+ return None
@@ -13,9 +13,10 @@ Textual is an optional dependency, installed with the extra
13
13
  only when it is about to be used, and asking for it without Textual
14
14
  installed raises ImportError instead of degrading silently.
15
15
 
16
- This factory chooses between text-mode bridges only. An application
17
- with a graphical user interface should provide and use its own
18
- graphical bridge instead.
16
+ This factory chooses between text-mode bridges only. An application with
17
+ a graphical user interface constructs a graphical bridge itself instead:
18
+ WizardUiBridgeTk from the companion package wizard-tk-bridge for Tkinter,
19
+ or a bridge of its own for another toolkit.
19
20
  """
20
21
 
21
22
  # Copyright (c) 2026 Tom Björkholm
@@ -35,7 +35,7 @@ from textual.widgets import Button, Checkbox, Footer, Input, \
35
35
  from textual.widgets.selection_list import Selection
36
36
  from wizard_ui_bridge.bridge import WizardUiBridge
37
37
  from wizard_ui_bridge.bridge_helpers import check_text_args, INT_ERROR, \
38
- int_text, multi_count_error, out_of_range, path_answer, range_error, \
38
+ int_text, multi_count_message, out_of_range, path_answer, range_error, \
39
39
  text_answer
40
40
  from wizard_ui_bridge.form_helpers import initial_answer
41
41
  from wizard_ui_bridge._form_prefill import apply_prefills
@@ -228,18 +228,13 @@ class _MultiApp(_NavApp[list[int]]):
228
228
  def action_submit(self) -> None:
229
229
  """Exit with the selection, or show why the count is wrong."""
230
230
  chosen = list(self._list.selected)
231
- if self._count_ok(len(chosen)):
231
+ message = multi_count_message(len(chosen), self._min_select,
232
+ self._max_select)
233
+ if message is None:
232
234
  self.exit(chosen)
233
235
  return
234
- message = multi_count_error(self._min_select, self._max_select)
235
236
  self.query_one('#multi_error', Static).update(message)
236
237
 
237
- def _count_ok(self, count: int) -> bool:
238
- """Return whether count is within the allowed selection range."""
239
- if count < self._min_select:
240
- return False
241
- return self._max_select is None or count <= self._max_select
242
-
243
238
 
244
239
  # pylint: disable-next=too-many-instance-attributes
245
240
  class _TableApp(_NavApp[list[list[Optional[str]]]]):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizard-ui-bridge
3
- Version: 1.2
3
+ Version: 1.4
4
4
  Summary: User interface bridge for wizards asking a user questions.
5
5
  Author: Tom Björkholm
6
6
  Author-email: Tom Björkholm <klausuler_linnet0q@icloud.com>
@@ -19,7 +19,7 @@ Classifier: Typing :: Typed
19
19
  Requires-Python: >=3.12
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
- Requires-Dist: config-as-json>=1.4
22
+ Requires-Dist: config-as-json>=1.7
23
23
  Provides-Extra: textual
24
24
  Requires-Dist: textual>=8.2.8; extra == "textual"
25
25
  Dynamic: author
@@ -36,9 +36,17 @@ ask a user questions.
36
36
  A wizard asks a series of questions and turns the answers into something,
37
37
  often a configuration file. `WizardUiBridge` is the interface it asks
38
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.
39
+ [Textual](https://pypi.org/project/textual/) user interface, in a
40
+ graphical user interface (Tkinter through the companion package below,
41
+ or a toolkit you write a bridge for yourself), or on a scripted bridge
42
+ in your tests.
43
+
44
+ ## Tk companion
45
+
46
+ `wizard-ui-bridge` has a companion
47
+ [wizard-tk-bridge](https://pypi.org/project/wizard-tk-bridge/) that
48
+ implements the same user-interface-independent way for a wizard to
49
+ ask a user questions using a Tkinter GUI.
42
50
 
43
51
  ## Is this package for you?
44
52
 
@@ -157,40 +165,26 @@ asking methods. The modules `wizard_ui_bridge.bridge_helpers` and
157
165
  to interpret raw answers and to build form answers, so that a bridge of
158
166
  your own behaves the same way.
159
167
 
160
- ## Removed: `WizardUiBridge.ask()`
161
-
162
- The low-level `WizardUiBridge.ask()` method is **removed**, and with it:
163
-
164
- - calling `WizardUiBridge.ask()` from a wizard, and
165
- - the backward-compatibility fallbacks that let a bridge which only
166
- overrode `ask()` keep working by rerouting the typed `ask_*()` calls
167
- through it.
168
+ ## History
168
169
 
169
- Version 1.1 was the last version that supported `ask()`, where every use
170
- warned loudly that it was about to be removed. A bridge that still calls
171
- or overrides `ask()` no longer works.
170
+ The low-level `WizardUiBridge.ask()` method was **removed** in version
171
+ 1.2, together with the fallbacks that let a bridge which only overrode
172
+ `ask()` keep working by rerouting the typed `ask_*()` calls through it.
173
+ Version 1.1 was the last version that supported it. A bridge implements
174
+ the typed methods directly: `ask_text()`, `ask_choice()`, `ask_multi()`,
175
+ `ask_yes_no()` and `ask_table()`, together with `show()`. A typed method
176
+ a bridge does not implement raises `NotImplementedError`. See *Writing
177
+ your own bridge* above.
172
178
 
173
- Implement the typed methods directly instead of `ask()`: `ask_text()`,
174
- `ask_choice()`, `ask_multi()`, `ask_yes_no()` and `ask_table()`, together
175
- with `show()`. A typed method a bridge does not implement raises
176
- `NotImplementedError`. See *Writing your own bridge* above.
177
-
178
- ## Relation to tableio-cfg-json
179
+ ### Relation to tableio-cfg-json
179
180
 
180
181
  This package used to be part of
181
182
  [tableio-cfg-json](https://pypi.org/project/tableio-cfg-json/). It was
182
183
  split out so that a wizard that has nothing to do with TableIO does not
183
184
  have to install TableIO and everything TableIO depends on.
184
185
 
185
- Applications that import the bridge from `tableio_cfg_json` keep working,
186
- with a deprecation warning per name, and should change the imports as
187
- described in the `tableio-cfg-json` documentation.
188
-
189
186
  ### Source code repo history
190
187
 
191
- The wizard UI bridge `wizard-ui-bridge` code used to be part of
192
- `tableio-cfg-json` git repo, but has been split out.
193
-
194
188
  The two git repos
195
189
  [https://github.com/tom-bjorkholm/wizard-ui-bridge](https://github.com/tom-bjorkholm/wizard-ui-bridge)
196
190
  and
@@ -215,10 +209,10 @@ MIT
215
209
 
216
210
  ## Test summary
217
211
 
218
- - Test result: 713 passed in 30s
212
+ - Test result: 1084 passed, 9 deselected in 45s
219
213
  - No flake8 warnings.
220
214
  - No mypy errors found.
221
215
  - No pylint warnings.
222
216
  - No python layout warnings.
223
- - Built version(s): 1.2
224
- - Build and test using Python 3.14.6
217
+ - Built version(s): 1.4
218
+ - Build and test using Python 3.14.7
@@ -1,4 +1,4 @@
1
- config-as-json>=1.4
1
+ config-as-json>=1.7
2
2
 
3
3
  [textual]
4
4
  textual>=8.2.8
File without changes