promptukit 0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joseph Kasprzyk
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,317 @@
1
+ Metadata-Version: 2.4
2
+ Name: promptukit
3
+ Version: 0.1.1
4
+ Summary: Utilities for building question banks and generating exam documents.
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: questions,exams,education,pdf,question-bank
8
+ Author: Joseph Kasprzyk
9
+ Author-email: jkasprzyk@gmail.com
10
+ Requires-Python: >=3.10,<4.0
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Education
22
+ Requires-Dist: build (>=1.4.3,<2.0.0)
23
+ Requires-Dist: reportlab (>=4.4.10,<5.0.0)
24
+ Requires-Dist: twine (>=6.2.0,<7.0.0)
25
+ Project-URL: Homepage, https://github.com/jrkasprzyk/promptukit
26
+ Project-URL: Repository, https://github.com/jrkasprzyk/promptukit
27
+ Description-Content-Type: text/markdown
28
+
29
+ PromptuKit
30
+ =========
31
+
32
+ Small utilities for working with trivia question banks.
33
+
34
+ Getting started (Poetry)
35
+ ------------------------
36
+
37
+ 1. Install Poetry (if you don't have it).
38
+
39
+ ```bash
40
+ pip install --user poetry
41
+ ```
42
+
43
+ 2. Create the virtual environment and install dependencies:
44
+
45
+ ```bash
46
+ poetry install
47
+ ```
48
+
49
+ 3. Run the CLI tools via Poetry:
50
+
51
+ ```bash
52
+ poetry run promptukit-add-trivia
53
+ poetry run promptukit-extract-trivia --help
54
+ poetry run promptukit-validate-trivia
55
+ ```
56
+
57
+ Activating the virtualenv
58
+ -------------------------
59
+
60
+ If Poetry is configured to create an in-project virtualenv, it will be placed in a `.venv` folder at the repository root. Activate that environment from the project root using the command for your shell:
61
+
62
+ PowerShell (Windows):
63
+
64
+ ```powershell
65
+ Update README to reflect new CLI names and module paths.
66
+
67
+ PromptuKit
68
+ ==========
69
+
70
+ Utilities for building and managing multiple-choice question banks and
71
+ generating exam PDFs.
72
+
73
+ Getting started (Poetry)
74
+ ------------------------
75
+
76
+ 1. Install Poetry (if you don't have it):
77
+
78
+ ```bash
79
+ pip install --user poetry
80
+ ```
81
+
82
+ 2. Create the virtual environment and install dependencies:
83
+
84
+ ```bash
85
+ poetry install
86
+ ```
87
+
88
+ 3. Run the CLI tools via Poetry (console scripts / entry points):
89
+
90
+ ```bash
91
+ poetry run add-question
92
+ poetry run extract-question --help
93
+ poetry run validate-question
94
+ poetry run question-bank --help
95
+ ```
96
+
97
+ Activating the virtualenv
98
+ -------------------------
99
+
100
+ If Poetry is configured to create an in-project virtualenv, it will be
101
+ placed in a `.venv` folder at the repository root. Activate that
102
+ environment from the project root using the command for your shell.
103
+
104
+ PowerShell (Windows):
105
+
106
+ ```powershell
107
+ .\.venv\Scripts\Activate.ps1
108
+ ```
109
+
110
+ If script execution is blocked, temporarily allow it then activate:
111
+
112
+ ```powershell
113
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
114
+ .\.venv\Scripts\Activate.ps1
115
+ ```
116
+
117
+ Command Prompt (cmd.exe):
118
+
119
+ ```cmd
120
+ .\.venv\Scripts\activate.bat
121
+ ```
122
+
123
+ Git Bash / MSYS (Windows):
124
+
125
+ ```bash
126
+ source .venv/Scripts/activate
127
+ ```
128
+
129
+ macOS / Linux (POSIX):
130
+
131
+ ```bash
132
+ source .venv/bin/activate
133
+ ```
134
+
135
+ Alternatives (no manual activation required):
136
+
137
+ ```bash
138
+ # Run a single command inside the virtualenv without activating it
139
+ poetry run <cmd> # e.g. poetry run pytest
140
+ ```
141
+
142
+ Poetry 2.x note:
143
+
144
+ - The `poetry shell` command (which previously spawned a new shell) is not
145
+ installed by default in Poetry 2.0+. You can either use
146
+ `poetry env activate` (then evaluate the printed activation command in
147
+ your shell) or install the shell plugin to restore `poetry shell`.
148
+
149
+ Notes
150
+ -----
151
+ - The package entry points are defined in `pyproject.toml` under
152
+ `[tool.poetry.scripts]` and map console script names to the
153
+ `main()` functions in the modules under the `promptukit` package.
154
+
155
+ Usage Examples
156
+ --------------
157
+
158
+ Quick (Poetry):
159
+
160
+ ```bash
161
+ poetry run add-question
162
+ poetry run extract-question --list-categories
163
+ poetry run validate-question
164
+ poetry run question-bank extract --help
165
+ ```
166
+
167
+ Extracting data:
168
+
169
+ ```bash
170
+ # List categories and available fields
171
+ poetry run extract-question --list-categories
172
+
173
+ # Print prompt and answer fields for the 'music' category
174
+ poetry run extract-question --file content/question_banks/block-doku-questions.json --category music --fields prompt,answer
175
+
176
+ # Interactive picker
177
+ poetry run extract-question -i
178
+ ```
179
+
180
+ Add questions:
181
+
182
+ ```bash
183
+ # Interactive add
184
+ poetry run add-question
185
+
186
+ # Batch mode
187
+ poetry run add-question --batch new_questions.json content/question_banks/mybank.json
188
+ ```
189
+
190
+ Validate a trivia file:
191
+
192
+ ```bash
193
+ # Validate the default question bank
194
+ poetry run validate-question
195
+
196
+ # Validate a specific file
197
+ poetry run validate-question content/question_banks/block-doku-questions.json
198
+ ```
199
+
200
+ Manage files with `question-bank` (create/copy/extract):
201
+
202
+ ```bash
203
+ # Create a new template JSON file
204
+ poetry run question-bank create --dest content/question_banks/new.json --categories music,film-and-tv
205
+
206
+ # Copy an existing file
207
+ poetry run question-bank copy --src content/question_banks/block-doku-questions.json --dest content/question_banks/backup.json
208
+
209
+ # Extract a subset (easy music questions)
210
+ poetry run question-bank extract --src content/question_banks/block-doku-questions.json --dest content/question_banks/music_easy.json --categories music --difficulty easy
211
+
212
+ # Interactive extract
213
+ poetry run question-bank extract -i --src content/question_banks/block-doku-questions.json --dest content/question_banks/pick.json
214
+ ```
215
+
216
+ Alternative: run modules with `python -m` when not using Poetry:
217
+
218
+ ```bash
219
+ python -m promptukit.questions.add_question
220
+ python -m promptukit.questions.extract_question --help
221
+ python -m promptukit.questions.question_bank create --dest content/question_banks/new.json
222
+ ```
223
+
224
+ Create exam PDF
225
+ ---------------
226
+
227
+ The `create_exam.py` script can generate a printable exam PDF. It accepts
228
+ an external JSON question bank so you can build exams from your existing
229
+ `content/question_banks/` files.
230
+
231
+ Usage (from the repository root):
232
+
233
+ ```bash
234
+ # Use the built-in hard-coded exam
235
+ python -m promptukit.exams.create_exam
236
+
237
+ # Load questions from a JSON bank and write a PDF
238
+ python -m promptukit.exams.create_exam -q content/question_banks/block-doku-questions.json -o cven4333_from_json.pdf
239
+
240
+ # With Poetry (runs the module inside the virtualenv)
241
+ poetry run python -m promptukit.exams.create_exam -q content/question_banks/block-doku-questions.json -o cven4333_from_json.pdf
242
+ ```
243
+
244
+ Supported JSON formats
245
+ ----------------------
246
+
247
+ - Top-level `sections` (preferred):
248
+
249
+ ```json
250
+ {
251
+ "sections": [
252
+ {
253
+ "title": "Section title",
254
+ "questions": [ { "prompt": "...", "choices": ["...", "..."] }, ... ]
255
+ }
256
+ ]
257
+ }
258
+ ```
259
+
260
+ - `categories` is an alias for `sections` and is also accepted.
261
+
262
+ - Flat list of questions (top-level array) or top-level object with `questions` array:
263
+
264
+ ```json
265
+ {
266
+ "questions": [ { "prompt": "...", "choices": ["...", "..."], "category": "Section title" }, ... ]
267
+ }
268
+ ```
269
+
270
+ - Question objects support multiple common field names: `prompt`, `q`, `question`, or `text` for the question text; `choices` or `answers` for the answer options; optional `category` to group flat lists into sections.
271
+
272
+ - If choices are not already labeled (for example "Oceans" instead of "A) Oceans"), the script will prefix them with `A)`, `B)`, etc. Prompts without a leading number will be auto-numbered sequentially.
273
+
274
+ Example files
275
+ -------------
276
+
277
+ - Example section-based bank: [content/question_banks/example_sections.json](content/question_banks/example_sections.json)
278
+ - JSON Schema describing accepted layouts: [content/question_banks/question_schema.json](content/question_banks/question_schema.json)
279
+
280
+ Behavior notes
281
+ --------------
282
+
283
+ - If no `-q/--questions` file is provided to the exam generator, the script
284
+ falls back to the built-in hard-coded 60-question exam and preserves its
285
+ original 8-section breakdown.
286
+ - When you provide a section-based JSON file the PDF's section headings will
287
+ be taken from each section's `title` (or `name` / `label` if present). When
288
+ you provide a flat list with `category` fields, the loader will group
289
+ questions by category to build sections automatically.
290
+
291
+ Running Tests
292
+ -------------
293
+
294
+ The test suite lives under `dev/checks`. The file
295
+ `dev/checks/test_question_tool.py` contains unit tests that exercise the
296
+ question-bank helpers and CLI-style interfaces.
297
+
298
+ Run the tests:
299
+
300
+ Using Poetry (recommended):
301
+
302
+ ```bash
303
+ poetry install
304
+ poetry run pytest -q
305
+ ```
306
+
307
+ Or run a single file directly:
308
+
309
+ ```bash
310
+ poetry run pytest dev/checks/test_question_tool.py -q
311
+ ```
312
+
313
+ Notes:
314
+
315
+ - Tests use pytest's `tmp_path` fixture and do not modify your repository files.
316
+
317
+
@@ -0,0 +1,288 @@
1
+ PromptuKit
2
+ =========
3
+
4
+ Small utilities for working with trivia question banks.
5
+
6
+ Getting started (Poetry)
7
+ ------------------------
8
+
9
+ 1. Install Poetry (if you don't have it).
10
+
11
+ ```bash
12
+ pip install --user poetry
13
+ ```
14
+
15
+ 2. Create the virtual environment and install dependencies:
16
+
17
+ ```bash
18
+ poetry install
19
+ ```
20
+
21
+ 3. Run the CLI tools via Poetry:
22
+
23
+ ```bash
24
+ poetry run promptukit-add-trivia
25
+ poetry run promptukit-extract-trivia --help
26
+ poetry run promptukit-validate-trivia
27
+ ```
28
+
29
+ Activating the virtualenv
30
+ -------------------------
31
+
32
+ If Poetry is configured to create an in-project virtualenv, it will be placed in a `.venv` folder at the repository root. Activate that environment from the project root using the command for your shell:
33
+
34
+ PowerShell (Windows):
35
+
36
+ ```powershell
37
+ Update README to reflect new CLI names and module paths.
38
+
39
+ PromptuKit
40
+ ==========
41
+
42
+ Utilities for building and managing multiple-choice question banks and
43
+ generating exam PDFs.
44
+
45
+ Getting started (Poetry)
46
+ ------------------------
47
+
48
+ 1. Install Poetry (if you don't have it):
49
+
50
+ ```bash
51
+ pip install --user poetry
52
+ ```
53
+
54
+ 2. Create the virtual environment and install dependencies:
55
+
56
+ ```bash
57
+ poetry install
58
+ ```
59
+
60
+ 3. Run the CLI tools via Poetry (console scripts / entry points):
61
+
62
+ ```bash
63
+ poetry run add-question
64
+ poetry run extract-question --help
65
+ poetry run validate-question
66
+ poetry run question-bank --help
67
+ ```
68
+
69
+ Activating the virtualenv
70
+ -------------------------
71
+
72
+ If Poetry is configured to create an in-project virtualenv, it will be
73
+ placed in a `.venv` folder at the repository root. Activate that
74
+ environment from the project root using the command for your shell.
75
+
76
+ PowerShell (Windows):
77
+
78
+ ```powershell
79
+ .\.venv\Scripts\Activate.ps1
80
+ ```
81
+
82
+ If script execution is blocked, temporarily allow it then activate:
83
+
84
+ ```powershell
85
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
86
+ .\.venv\Scripts\Activate.ps1
87
+ ```
88
+
89
+ Command Prompt (cmd.exe):
90
+
91
+ ```cmd
92
+ .\.venv\Scripts\activate.bat
93
+ ```
94
+
95
+ Git Bash / MSYS (Windows):
96
+
97
+ ```bash
98
+ source .venv/Scripts/activate
99
+ ```
100
+
101
+ macOS / Linux (POSIX):
102
+
103
+ ```bash
104
+ source .venv/bin/activate
105
+ ```
106
+
107
+ Alternatives (no manual activation required):
108
+
109
+ ```bash
110
+ # Run a single command inside the virtualenv without activating it
111
+ poetry run <cmd> # e.g. poetry run pytest
112
+ ```
113
+
114
+ Poetry 2.x note:
115
+
116
+ - The `poetry shell` command (which previously spawned a new shell) is not
117
+ installed by default in Poetry 2.0+. You can either use
118
+ `poetry env activate` (then evaluate the printed activation command in
119
+ your shell) or install the shell plugin to restore `poetry shell`.
120
+
121
+ Notes
122
+ -----
123
+ - The package entry points are defined in `pyproject.toml` under
124
+ `[tool.poetry.scripts]` and map console script names to the
125
+ `main()` functions in the modules under the `promptukit` package.
126
+
127
+ Usage Examples
128
+ --------------
129
+
130
+ Quick (Poetry):
131
+
132
+ ```bash
133
+ poetry run add-question
134
+ poetry run extract-question --list-categories
135
+ poetry run validate-question
136
+ poetry run question-bank extract --help
137
+ ```
138
+
139
+ Extracting data:
140
+
141
+ ```bash
142
+ # List categories and available fields
143
+ poetry run extract-question --list-categories
144
+
145
+ # Print prompt and answer fields for the 'music' category
146
+ poetry run extract-question --file content/question_banks/block-doku-questions.json --category music --fields prompt,answer
147
+
148
+ # Interactive picker
149
+ poetry run extract-question -i
150
+ ```
151
+
152
+ Add questions:
153
+
154
+ ```bash
155
+ # Interactive add
156
+ poetry run add-question
157
+
158
+ # Batch mode
159
+ poetry run add-question --batch new_questions.json content/question_banks/mybank.json
160
+ ```
161
+
162
+ Validate a trivia file:
163
+
164
+ ```bash
165
+ # Validate the default question bank
166
+ poetry run validate-question
167
+
168
+ # Validate a specific file
169
+ poetry run validate-question content/question_banks/block-doku-questions.json
170
+ ```
171
+
172
+ Manage files with `question-bank` (create/copy/extract):
173
+
174
+ ```bash
175
+ # Create a new template JSON file
176
+ poetry run question-bank create --dest content/question_banks/new.json --categories music,film-and-tv
177
+
178
+ # Copy an existing file
179
+ poetry run question-bank copy --src content/question_banks/block-doku-questions.json --dest content/question_banks/backup.json
180
+
181
+ # Extract a subset (easy music questions)
182
+ poetry run question-bank extract --src content/question_banks/block-doku-questions.json --dest content/question_banks/music_easy.json --categories music --difficulty easy
183
+
184
+ # Interactive extract
185
+ poetry run question-bank extract -i --src content/question_banks/block-doku-questions.json --dest content/question_banks/pick.json
186
+ ```
187
+
188
+ Alternative: run modules with `python -m` when not using Poetry:
189
+
190
+ ```bash
191
+ python -m promptukit.questions.add_question
192
+ python -m promptukit.questions.extract_question --help
193
+ python -m promptukit.questions.question_bank create --dest content/question_banks/new.json
194
+ ```
195
+
196
+ Create exam PDF
197
+ ---------------
198
+
199
+ The `create_exam.py` script can generate a printable exam PDF. It accepts
200
+ an external JSON question bank so you can build exams from your existing
201
+ `content/question_banks/` files.
202
+
203
+ Usage (from the repository root):
204
+
205
+ ```bash
206
+ # Use the built-in hard-coded exam
207
+ python -m promptukit.exams.create_exam
208
+
209
+ # Load questions from a JSON bank and write a PDF
210
+ python -m promptukit.exams.create_exam -q content/question_banks/block-doku-questions.json -o cven4333_from_json.pdf
211
+
212
+ # With Poetry (runs the module inside the virtualenv)
213
+ poetry run python -m promptukit.exams.create_exam -q content/question_banks/block-doku-questions.json -o cven4333_from_json.pdf
214
+ ```
215
+
216
+ Supported JSON formats
217
+ ----------------------
218
+
219
+ - Top-level `sections` (preferred):
220
+
221
+ ```json
222
+ {
223
+ "sections": [
224
+ {
225
+ "title": "Section title",
226
+ "questions": [ { "prompt": "...", "choices": ["...", "..."] }, ... ]
227
+ }
228
+ ]
229
+ }
230
+ ```
231
+
232
+ - `categories` is an alias for `sections` and is also accepted.
233
+
234
+ - Flat list of questions (top-level array) or top-level object with `questions` array:
235
+
236
+ ```json
237
+ {
238
+ "questions": [ { "prompt": "...", "choices": ["...", "..."], "category": "Section title" }, ... ]
239
+ }
240
+ ```
241
+
242
+ - Question objects support multiple common field names: `prompt`, `q`, `question`, or `text` for the question text; `choices` or `answers` for the answer options; optional `category` to group flat lists into sections.
243
+
244
+ - If choices are not already labeled (for example "Oceans" instead of "A) Oceans"), the script will prefix them with `A)`, `B)`, etc. Prompts without a leading number will be auto-numbered sequentially.
245
+
246
+ Example files
247
+ -------------
248
+
249
+ - Example section-based bank: [content/question_banks/example_sections.json](content/question_banks/example_sections.json)
250
+ - JSON Schema describing accepted layouts: [content/question_banks/question_schema.json](content/question_banks/question_schema.json)
251
+
252
+ Behavior notes
253
+ --------------
254
+
255
+ - If no `-q/--questions` file is provided to the exam generator, the script
256
+ falls back to the built-in hard-coded 60-question exam and preserves its
257
+ original 8-section breakdown.
258
+ - When you provide a section-based JSON file the PDF's section headings will
259
+ be taken from each section's `title` (or `name` / `label` if present). When
260
+ you provide a flat list with `category` fields, the loader will group
261
+ questions by category to build sections automatically.
262
+
263
+ Running Tests
264
+ -------------
265
+
266
+ The test suite lives under `dev/checks`. The file
267
+ `dev/checks/test_question_tool.py` contains unit tests that exercise the
268
+ question-bank helpers and CLI-style interfaces.
269
+
270
+ Run the tests:
271
+
272
+ Using Poetry (recommended):
273
+
274
+ ```bash
275
+ poetry install
276
+ poetry run pytest -q
277
+ ```
278
+
279
+ Or run a single file directly:
280
+
281
+ ```bash
282
+ poetry run pytest dev/checks/test_question_tool.py -q
283
+ ```
284
+
285
+ Notes:
286
+
287
+ - Tests use pytest's `tmp_path` fixture and do not modify your repository files.
288
+
@@ -0,0 +1,18 @@
1
+ """promptukit — utilities for building question banks and exam documents."""
2
+
3
+ from promptukit.utils.cli_helpers import load, save, pick, confirm
4
+ from promptukit import questions, exams, utils
5
+
6
+ __all__ = [
7
+ # subpackages
8
+ "questions",
9
+ "exams",
10
+ "utils",
11
+ # flat re-exports from utils
12
+ "load",
13
+ "save",
14
+ "pick",
15
+ "confirm",
16
+ ]
17
+
18
+ __version__ = "0.1.0"
@@ -0,0 +1,7 @@
1
+ """Tools for generating exam documents."""
2
+
3
+ from promptukit.exams import create_exam
4
+
5
+ __all__ = [
6
+ "create_exam",
7
+ ]