tableio-cfg-json 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.
@@ -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,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: tableio-cfg-json
3
+ Version: 0.1
4
+ Summary: config-as-json configuration encapsulation for tableio.
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://bitbucket.org/tom-bjorkholm/tableio_cfg_json
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE.txt
14
+ Requires-Dist: setuptools>=82.0.1
15
+ Requires-Dist: build>=1.4.2
16
+ Requires-Dist: wheel>=0.46.3
17
+ Requires-Dist: tableio>=0.9
18
+ Requires-Dist: config-as-json>=0.9
19
+ Dynamic: author
20
+ Dynamic: license-file
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+
24
+ # tableio-cfg-json
25
+
26
+ `tableio-cfg-json` stores
27
+ [TableIO](https://pypi.org/project/tableio/) configuration as validated JSON
28
+ by using [config-as-json](https://pypi.org/project/config-as-json/).
29
+
30
+ Use it when an application uses TableIO for table-like files and wants
31
+ persistent, user-editable configuration for formats, implementations and
32
+ format-specific options. The configuration objects are both TableIO
33
+ `ConfigData` objects and config-as-json `Config` objects, so the same object
34
+ can be written as configuration file (as JSON), read back later, validated,
35
+ and passed to TableIO.
36
+
37
+ ## Is this package for you?
38
+
39
+ This package is a good fit when one or more of these apply:
40
+
41
+ - Your application uses TableIO.
42
+ - You already use config-as-json, or can accept using it for persistent
43
+ configuration.
44
+ - You want one configuration file to describe one TableIO input or output
45
+ endpoint.
46
+ - You want to nest one or more TableIO endpoint configurations inside a
47
+ larger application configuration file.
48
+ - You want validation and generated user documentation for the TableIO
49
+ options that are relevant to your application's capabilities.
50
+
51
+ This package is probably not the right one when:
52
+
53
+ - You are looking for the table reader or writer itself. Use
54
+ [TableIO](https://pypi.org/project/tableio/) directly.
55
+ - Your program always uses one hard-coded table format and has no persistent
56
+ configuration.
57
+ - You do not want to use config-as-json for configuration files.
58
+
59
+ ## Installation
60
+
61
+ `tableio-cfg-json` requires Python 3.12 or newer.
62
+
63
+ ```sh
64
+ pip install --upgrade tableio-cfg-json
65
+ ```
66
+
67
+ ## Quick start
68
+
69
+ Create a compact JSON configuration file for one TableIO endpoint:
70
+
71
+ ```python
72
+ from pathlib import Path
73
+ import sys
74
+
75
+ from tableio import FileAccess, access_capabilities
76
+ from tableio_cfg_json import tio_json_config_default
77
+
78
+ config_file = Path('tableio.cfg')
79
+ file_access = FileAccess.CREATE
80
+ capabilities = access_capabilities(file_access, error_file=sys.stderr)
81
+ config = tio_json_config_default(capabilities=capabilities,
82
+ file_access=file_access,
83
+ format_name='CSV')
84
+ config.write(to_json_filename=config_file)
85
+ ```
86
+
87
+ For CSV this writes a small file like:
88
+
89
+ ```json
90
+ {
91
+ "format_name": "CSV"
92
+ }
93
+ ```
94
+
95
+ Read the configuration back and use it with TableIO:
96
+
97
+ ```python
98
+ from pathlib import Path
99
+ import sys
100
+
101
+ from tableio import FileAccess, access_capabilities, tio_config_create
102
+ from tableio_cfg_json import TioJsonConfig
103
+
104
+ config_file = Path('tableio.cfg')
105
+ table_file = Path('capitals.csv')
106
+ file_access = FileAccess.CREATE
107
+ capabilities = access_capabilities(file_access, error_file=sys.stderr)
108
+ config = TioJsonConfig(capabilities=capabilities,
109
+ file_access=file_access,
110
+ from_json_filename=config_file)
111
+ with tio_config_create(config=config, file_name=table_file,
112
+ file_access=file_access,
113
+ capabilities=capabilities) as table_io:
114
+ table_io.write_table_listdata([
115
+ ['Capital', 'Country'],
116
+ ['Copenhagen', 'Denmark']
117
+ ])
118
+ ```
119
+
120
+ If `implementation` is omitted, TableIO chooses a matching implementation at
121
+ runtime. If the user wants to lock down a specific implementation, it can be
122
+ stored explicitly in JSON.
123
+
124
+ Optional settings can be added at the top level or in format-specific nested
125
+ sections such as `csv`, `html` and `latex`. Compact output omits unset
126
+ optional values, while template-style output can include all current default
127
+ options.
128
+
129
+ Please see the [teaching examples](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/example/src/example/README.md) for a more
130
+ thorough introduction.
131
+
132
+ ## Main entry points
133
+
134
+ - `TioJsonConfig`
135
+ Complete JSON-backed TableIO configuration for one endpoint. It can read
136
+ JSON, write JSON and be passed to TableIO as normal configuration data.
137
+
138
+ - `tio_config_create()` create a TableIO object from a `TioJsonConfig`
139
+ object.
140
+
141
+ ### Helpers and details
142
+
143
+ - `tio_json_config_default()`
144
+ Create a validated default `TioJsonConfig` using TableIO's recommended
145
+ choices for the requested capabilities and file access.
146
+
147
+ - `TioJsonCsvConfig`, `TioJsonHtmlConfig`, `TioJsonLatexConfig`
148
+ Optional nested configuration sections for format-specific settings.
149
+
150
+ - `describe_config()`, `describe_config_members()`,
151
+ `describe_config_reference()`, `describe_config_example()`,
152
+ `get_config_member_names()` and `get_general_cfg_info()`
153
+ Helpers for generating plain text syntax guides for configuration files.
154
+
155
+ - `tio_json_config_wizard()`
156
+ Interactive helper for creating one TableIO endpoint configuration through
157
+ a user interface bridge.
158
+
159
+ - `WizardUiBridge` and `WizardUiBridgeConsole`
160
+ Interfaces for connecting the wizard to a console, GUI or scripted UI.
161
+
162
+ ## Validation model
163
+
164
+ The configuration file (in JSON) stores durable TableIO choices such
165
+ as `format_name`, `implementation`, character encoding, presentation
166
+ options and format-specific settings. Runtime values such as the actual
167
+ file name are not stored in this configuration.
168
+
169
+ Validation happens in two layers:
170
+
171
+ - config-as-json validates JSON structure, member names and member value
172
+ types.
173
+ - TableIO validates whether the selected format, implementation,
174
+ capabilities and file access can work together.
175
+
176
+ Choice values are matched case-insensitively where TableIO defines a finite
177
+ set of choices. For example, configuration file may use `excel` and the
178
+ config object will store TableIO's normal `Excel` spelling after validation.
179
+
180
+ ## Nested application configs
181
+
182
+ `TioJsonConfig` can be used as the whole configuration file for a small
183
+ program, or as a nested member inside a larger config-as-json application
184
+ configuration. This is useful when one application has several TableIO
185
+ endpoints, for example one input table and two independently configured
186
+ output tables.
187
+
188
+ For larger configs, create each nested `TioJsonConfig` with the capabilities
189
+ and file access for that endpoint. A read endpoint and a create endpoint may
190
+ need different defaults and may validate different implementations.
191
+
192
+ The teaching examples show both styles.
193
+
194
+ ## Documentation
195
+
196
+ - Teaching examples and walkthroughs: [example/src/example/README.md](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/example/src/example/README.md)
197
+
198
+ - Public API notes: [doc/api.md](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/doc/api.md)
199
+
200
+ - Protected/internal API notes: [doc/protected_api.md](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/doc/protected_api.md)
201
+
202
+ - Source repository: [tableio_cfg_json](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/)
203
+
204
+ ## License
205
+
206
+ MIT
207
+
208
+ ## Test summary
209
+
210
+ - Test result: 380 passed in 14s
211
+ - No flake8 warnings.
212
+ - No mypy errors found.
213
+ - No python layout warnings.
214
+ - Built version(s): 0.1
215
+ - Build and test using Python 3.14.4
@@ -0,0 +1,86 @@
1
+ # tableio-cfg-json
2
+
3
+ > Looking for installation and user-facing package information?
4
+ > See [README_pypi.md](README_pypi.md) or the
5
+ > [PyPI project page](https://pypi.org/project/tableio-cfg-json).
6
+
7
+ ## Repository purpose
8
+
9
+ This is a small package that stores
10
+ [TableIO](https://pypi.org/project/tableio/) configuration as validated JSON
11
+ by using [config-as-json](https://pypi.org/project/config-as-json/).
12
+
13
+ ## Related documentation
14
+
15
+ - User-facing package overview: [README_pypi.md](README_pypi.md)
16
+ - Public API notes: [doc/api.md](doc/api.md)
17
+ - Protected/internal API notes: [doc/protected_api.md](doc/protected_api.md)
18
+ - Build system design: [common_build_tools/README.md](common_build_tools/README.md)
19
+
20
+ The example directory contains worked examples for new users and is also
21
+ useful for maintainers who want to see intended API usage in context.
22
+
23
+ ## Cloning
24
+
25
+ This repository uses submodules. Clone it with:
26
+
27
+ ```sh
28
+ git clone --recurse-submodules \
29
+ git@bitbucket.org:tom-bjorkholm/tableio_cfg_json
30
+ ```
31
+
32
+ If you already cloned without submodules, initialize them with:
33
+
34
+ ```sh
35
+ git submodule update --init --recursive
36
+ ```
37
+
38
+ To update the checked-out submodule revisions:
39
+
40
+ ```sh
41
+ git submodule update --remote --merge
42
+ ```
43
+
44
+ ## Supported Python versions
45
+
46
+ - Package runtime baseline: Python 3.12 or newer
47
+ - Maintainer validation target: Python 3.12, 3.13, and 3.14
48
+ - Main day-to-day development: usually the newest supported Python version
49
+
50
+ ## Development workflow
51
+
52
+ On macOS and Linux, the normal workflow is:
53
+
54
+ 1. Run `./run_setup_build_environment.py` once after cloning or when the
55
+ build environment needs to be recreated.
56
+ 2. Run `./run_build.py` for the normal build-and-test cycle.
57
+ 3. Run `./run_clean_build.py` before review or release work that needs a
58
+ completely fresh build.
59
+
60
+ The helper scripts are:
61
+
62
+ - `run_setup_build_environment.py`
63
+ Create or refresh the build environment.
64
+ - `run_build.py`
65
+ Build the package and run the configured checks in the project virtual
66
+ environment.
67
+ - `run_clean.py`
68
+ Remove files generated by the build system.
69
+ - `run_clean_build.py`
70
+ Perform a clean build from scratch. This is especially useful because some
71
+ duplicate-code diagnostics only appear on a clean build.
72
+ - `run_pypi_build.py`
73
+ Create the distribution artifacts intended for PyPI publishing.
74
+
75
+ The standard verification suite includes pytest, pylint, flake8, and mypy.
76
+ After a build, the generated reports can be browsed through
77
+ `reports/index.html`.
78
+
79
+ ## Test summary
80
+
81
+ - Test result: 380 passed in 14s
82
+ - No flake8 warnings.
83
+ - No mypy errors found.
84
+ - No python layout warnings.
85
+ - Built version(s): 0.1
86
+ - Build and test using Python 3.14.4
@@ -0,0 +1,192 @@
1
+ # tableio-cfg-json
2
+
3
+ `tableio-cfg-json` stores
4
+ [TableIO](https://pypi.org/project/tableio/) configuration as validated JSON
5
+ by using [config-as-json](https://pypi.org/project/config-as-json/).
6
+
7
+ Use it when an application uses TableIO for table-like files and wants
8
+ persistent, user-editable configuration for formats, implementations and
9
+ format-specific options. The configuration objects are both TableIO
10
+ `ConfigData` objects and config-as-json `Config` objects, so the same object
11
+ can be written as configuration file (as JSON), read back later, validated,
12
+ and passed to TableIO.
13
+
14
+ ## Is this package for you?
15
+
16
+ This package is a good fit when one or more of these apply:
17
+
18
+ - Your application uses TableIO.
19
+ - You already use config-as-json, or can accept using it for persistent
20
+ configuration.
21
+ - You want one configuration file to describe one TableIO input or output
22
+ endpoint.
23
+ - You want to nest one or more TableIO endpoint configurations inside a
24
+ larger application configuration file.
25
+ - You want validation and generated user documentation for the TableIO
26
+ options that are relevant to your application's capabilities.
27
+
28
+ This package is probably not the right one when:
29
+
30
+ - You are looking for the table reader or writer itself. Use
31
+ [TableIO](https://pypi.org/project/tableio/) directly.
32
+ - Your program always uses one hard-coded table format and has no persistent
33
+ configuration.
34
+ - You do not want to use config-as-json for configuration files.
35
+
36
+ ## Installation
37
+
38
+ `tableio-cfg-json` requires Python 3.12 or newer.
39
+
40
+ ```sh
41
+ pip install --upgrade tableio-cfg-json
42
+ ```
43
+
44
+ ## Quick start
45
+
46
+ Create a compact JSON configuration file for one TableIO endpoint:
47
+
48
+ ```python
49
+ from pathlib import Path
50
+ import sys
51
+
52
+ from tableio import FileAccess, access_capabilities
53
+ from tableio_cfg_json import tio_json_config_default
54
+
55
+ config_file = Path('tableio.cfg')
56
+ file_access = FileAccess.CREATE
57
+ capabilities = access_capabilities(file_access, error_file=sys.stderr)
58
+ config = tio_json_config_default(capabilities=capabilities,
59
+ file_access=file_access,
60
+ format_name='CSV')
61
+ config.write(to_json_filename=config_file)
62
+ ```
63
+
64
+ For CSV this writes a small file like:
65
+
66
+ ```json
67
+ {
68
+ "format_name": "CSV"
69
+ }
70
+ ```
71
+
72
+ Read the configuration back and use it with TableIO:
73
+
74
+ ```python
75
+ from pathlib import Path
76
+ import sys
77
+
78
+ from tableio import FileAccess, access_capabilities, tio_config_create
79
+ from tableio_cfg_json import TioJsonConfig
80
+
81
+ config_file = Path('tableio.cfg')
82
+ table_file = Path('capitals.csv')
83
+ file_access = FileAccess.CREATE
84
+ capabilities = access_capabilities(file_access, error_file=sys.stderr)
85
+ config = TioJsonConfig(capabilities=capabilities,
86
+ file_access=file_access,
87
+ from_json_filename=config_file)
88
+ with tio_config_create(config=config, file_name=table_file,
89
+ file_access=file_access,
90
+ capabilities=capabilities) as table_io:
91
+ table_io.write_table_listdata([
92
+ ['Capital', 'Country'],
93
+ ['Copenhagen', 'Denmark']
94
+ ])
95
+ ```
96
+
97
+ If `implementation` is omitted, TableIO chooses a matching implementation at
98
+ runtime. If the user wants to lock down a specific implementation, it can be
99
+ stored explicitly in JSON.
100
+
101
+ Optional settings can be added at the top level or in format-specific nested
102
+ sections such as `csv`, `html` and `latex`. Compact output omits unset
103
+ optional values, while template-style output can include all current default
104
+ options.
105
+
106
+ Please see the [teaching examples](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/example/src/example/README.md) for a more
107
+ thorough introduction.
108
+
109
+ ## Main entry points
110
+
111
+ - `TioJsonConfig`
112
+ Complete JSON-backed TableIO configuration for one endpoint. It can read
113
+ JSON, write JSON and be passed to TableIO as normal configuration data.
114
+
115
+ - `tio_config_create()` create a TableIO object from a `TioJsonConfig`
116
+ object.
117
+
118
+ ### Helpers and details
119
+
120
+ - `tio_json_config_default()`
121
+ Create a validated default `TioJsonConfig` using TableIO's recommended
122
+ choices for the requested capabilities and file access.
123
+
124
+ - `TioJsonCsvConfig`, `TioJsonHtmlConfig`, `TioJsonLatexConfig`
125
+ Optional nested configuration sections for format-specific settings.
126
+
127
+ - `describe_config()`, `describe_config_members()`,
128
+ `describe_config_reference()`, `describe_config_example()`,
129
+ `get_config_member_names()` and `get_general_cfg_info()`
130
+ Helpers for generating plain text syntax guides for configuration files.
131
+
132
+ - `tio_json_config_wizard()`
133
+ Interactive helper for creating one TableIO endpoint configuration through
134
+ a user interface bridge.
135
+
136
+ - `WizardUiBridge` and `WizardUiBridgeConsole`
137
+ Interfaces for connecting the wizard to a console, GUI or scripted UI.
138
+
139
+ ## Validation model
140
+
141
+ The configuration file (in JSON) stores durable TableIO choices such
142
+ as `format_name`, `implementation`, character encoding, presentation
143
+ options and format-specific settings. Runtime values such as the actual
144
+ file name are not stored in this configuration.
145
+
146
+ Validation happens in two layers:
147
+
148
+ - config-as-json validates JSON structure, member names and member value
149
+ types.
150
+ - TableIO validates whether the selected format, implementation,
151
+ capabilities and file access can work together.
152
+
153
+ Choice values are matched case-insensitively where TableIO defines a finite
154
+ set of choices. For example, configuration file may use `excel` and the
155
+ config object will store TableIO's normal `Excel` spelling after validation.
156
+
157
+ ## Nested application configs
158
+
159
+ `TioJsonConfig` can be used as the whole configuration file for a small
160
+ program, or as a nested member inside a larger config-as-json application
161
+ configuration. This is useful when one application has several TableIO
162
+ endpoints, for example one input table and two independently configured
163
+ output tables.
164
+
165
+ For larger configs, create each nested `TioJsonConfig` with the capabilities
166
+ and file access for that endpoint. A read endpoint and a create endpoint may
167
+ need different defaults and may validate different implementations.
168
+
169
+ The teaching examples show both styles.
170
+
171
+ ## Documentation
172
+
173
+ - Teaching examples and walkthroughs: [example/src/example/README.md](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/example/src/example/README.md)
174
+
175
+ - Public API notes: [doc/api.md](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/doc/api.md)
176
+
177
+ - Protected/internal API notes: [doc/protected_api.md](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/src/master/doc/protected_api.md)
178
+
179
+ - Source repository: [tableio_cfg_json](https://bitbucket.org/tom-bjorkholm/tableio_cfg_json/)
180
+
181
+ ## License
182
+
183
+ MIT
184
+
185
+ ## Test summary
186
+
187
+ - Test result: 380 passed in 14s
188
+ - No flake8 warnings.
189
+ - No mypy errors found.
190
+ - No python layout warnings.
191
+ - Built version(s): 0.1
192
+ - Build and test using Python 3.14.4
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tableio-cfg-json"
7
+ version = "0.1"
8
+ authors = [
9
+ { name="Tom Björkholm", email="klausuler_linnet0q@icloud.com" },
10
+ ]
11
+ description = "config-as-json configuration encapsulation for tableio."
12
+ readme = "README_pypi.md"
13
+ requires-python = ">=3.12"
14
+ license = "MIT"
15
+ license-files = ["LICENSE.txt"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Operating System :: OS Independent"
19
+ ]
20
+ dynamic = ["dependencies"]
21
+
22
+ [project.urls]
23
+ "Source code" = "https://bitbucket.org/tom-bjorkholm/tableio_cfg_json"
24
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,19 @@
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='tableio-cfg-json', version='0.1',
8
+ description='config-as-json configuration encapsulation for tableio.',
9
+ author='Tom Björkholm', author_email='klausuler_linnet0q@icloud.com',
10
+ python_requires='>=3.12', packages=['tableio_cfg_json'],
11
+ package_dir={'tableio_cfg_json': 'src/tableio_cfg_json'},
12
+ package_data={'tableio_cfg_json': ['py.typed']},
13
+ install_requires=[
14
+ 'setuptools >= 82.0.1',
15
+ 'build >= 1.4.2',
16
+ 'wheel >= 0.46.3',
17
+ 'tableio >= 0.9',
18
+ 'config-as-json >= 0.9',
19
+ ])
@@ -0,0 +1,21 @@
1
+ #! /usr/local/bin/python3
2
+ """Public API for the tableio config-as-json bridge."""
3
+
4
+ # Copyright (c) 2026 Tom Björkholm
5
+ # MIT License
6
+
7
+ from tableio_cfg_json.config import TioJsonConfig, TioJsonCsvConfig, \
8
+ TioJsonHtmlConfig, TioJsonLatexConfig, tio_json_config_default
9
+ from tableio_cfg_json.describe import describe_config, \
10
+ describe_config_example, describe_config_members, \
11
+ describe_config_reference, get_config_member_names, get_general_cfg_info
12
+ from tableio_cfg_json.wizard import WizardUiBridge, WizardUiBridgeConsole, \
13
+ tio_json_config_wizard
14
+
15
+ __all__ = ['TioJsonConfig', 'TioJsonCsvConfig', 'TioJsonHtmlConfig',
16
+ 'TioJsonLatexConfig', 'describe_config',
17
+ 'describe_config_example', 'describe_config_members',
18
+ 'describe_config_reference', 'get_config_member_names',
19
+ 'get_general_cfg_info', 'tio_json_config_default',
20
+ 'tio_json_config_wizard', 'WizardUiBridge',
21
+ 'WizardUiBridgeConsole']