quizzy 0.3.1__tar.gz → 0.4.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {quizzy-0.3.1 → quizzy-0.4.0}/CHANGELOG.md +4 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/PKG-INFO +3 -2
- {quizzy-0.3.1 → quizzy-0.4.0}/README.md +1 -1
- {quizzy-0.3.1 → quizzy-0.4.0}/pyproject.toml +7 -2
- quizzy-0.4.0/quizzy/__main__.py +3 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/quizzy/app.py +36 -13
- {quizzy-0.3.1 → quizzy-0.4.0}/uv.lock +3 -1
- quizzy-0.3.1/quizzy/__main__.py +0 -9
- {quizzy-0.3.1 → quizzy-0.4.0}/.github/workflows/ci.yaml +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/.github/workflows/publish-to-pypi.yaml +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/.gitignore +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/.pre-commit-config.yaml +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/LICENSE +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/assets/question-board.png +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/examples/quizzy.yaml +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/quizzy/__init__.py +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/quizzy/models.py +0 -0
- {quizzy-0.3.1 → quizzy-0.4.0}/quizzy/quizzy.tcss +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: quizzy
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
4
4
|
Summary: A Python TUI quiz app
|
5
5
|
Author-email: Jonas Ehrlich <jonas.ehrlich@gmail.com>
|
6
6
|
License-Expression: MIT
|
@@ -8,6 +8,7 @@ License-File: LICENSE
|
|
8
8
|
Requires-Python: >=3.10
|
9
9
|
Requires-Dist: pydantic>=2.10.3
|
10
10
|
Requires-Dist: pyyaml>=6.0.2
|
11
|
+
Requires-Dist: textual-serve>=1.1.1
|
11
12
|
Requires-Dist: textual>=1.0.0
|
12
13
|
Description-Content-Type: text/markdown
|
13
14
|
|
@@ -63,7 +64,7 @@ uv run quizzy examples/quizzy.yaml
|
|
63
64
|
Serve on a webserver using textual:
|
64
65
|
|
65
66
|
``` sh
|
66
|
-
|
67
|
+
uvx quizzy --serve examples/quizzy.yaml
|
67
68
|
```
|
68
69
|
|
69
70
|
Run in development mode:
|
@@ -1,12 +1,17 @@
|
|
1
1
|
|
2
2
|
[project]
|
3
3
|
name = "quizzy"
|
4
|
-
version = "0.
|
4
|
+
version = "0.4.0"
|
5
5
|
description = "A Python TUI quiz app"
|
6
6
|
authors = [{ name = "Jonas Ehrlich", email = "jonas.ehrlich@gmail.com" }]
|
7
7
|
readme = "README.md"
|
8
8
|
requires-python = ">=3.10"
|
9
|
-
dependencies = [
|
9
|
+
dependencies = [
|
10
|
+
"pydantic>=2.10.3",
|
11
|
+
"pyyaml>=6.0.2",
|
12
|
+
"textual-serve>=1.1.1",
|
13
|
+
"textual>=1.0.0",
|
14
|
+
]
|
10
15
|
license = "MIT"
|
11
16
|
|
12
17
|
[project.scripts]
|
@@ -2,22 +2,18 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import argparse
|
4
4
|
import pathlib
|
5
|
+
import shlex
|
6
|
+
import sys
|
7
|
+
from typing import NoReturn
|
5
8
|
|
6
9
|
from textual import app, binding, containers, log, message, reactive, screen, widgets
|
10
|
+
from textual_serve import server
|
7
11
|
|
8
12
|
from quizzy import __version__, models
|
9
13
|
|
10
14
|
NoCorrectAnswerType = type("NoCorrectAnswerType", (object,), {})
|
11
15
|
NoCorrectAnswer = NoCorrectAnswerType()
|
12
16
|
|
13
|
-
|
14
|
-
def get_arg_parser() -> argparse.ArgumentParser:
|
15
|
-
parser = argparse.ArgumentParser(prog=__name__.split(".")[0], description="A terminal quiz app")
|
16
|
-
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
17
|
-
parser.add_argument("quizfile", type=pathlib.Path, help="Quiz file")
|
18
|
-
return parser
|
19
|
-
|
20
|
-
|
21
17
|
QuestionScreenResult = models.Team | NoCorrectAnswerType | None
|
22
18
|
|
23
19
|
|
@@ -230,12 +226,9 @@ class QuestionBoard(containers.HorizontalGroup):
|
|
230
226
|
class QuizzyApp(app.App[None]):
|
231
227
|
CSS_PATH = "quizzy.tcss"
|
232
228
|
|
233
|
-
def __init__(self) -> None:
|
229
|
+
def __init__(self, config: models.Config) -> None:
|
234
230
|
super().__init__()
|
235
|
-
|
236
|
-
namespace = parser.parse_args()
|
237
|
-
|
238
|
-
self.config = models.load_config(namespace.quizfile)
|
231
|
+
self.config = config
|
239
232
|
self.scoreboard_widget = Scoreboard(self.config.teams)
|
240
233
|
|
241
234
|
def compose(self) -> app.ComposeResult:
|
@@ -248,3 +241,33 @@ class QuizzyApp(app.App[None]):
|
|
248
241
|
|
249
242
|
def on_mount(self) -> None:
|
250
243
|
self.theme = "textual-light"
|
244
|
+
|
245
|
+
|
246
|
+
def get_arg_parser() -> argparse.ArgumentParser:
|
247
|
+
parser = argparse.ArgumentParser(prog=__name__.split(".")[0], description="A terminal quiz app")
|
248
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
249
|
+
|
250
|
+
serve_group = parser.add_argument_group("Serve options")
|
251
|
+
serve_group.add_argument("--serve", action="store_true", help="Serve the app through the browser")
|
252
|
+
serve_group.add_argument("--host", default="localhost", help="Host to serve the app on")
|
253
|
+
serve_group.add_argument("--port", type=int, default=8000, help="Port to serve the app on")
|
254
|
+
|
255
|
+
parser.add_argument("quizfile", type=pathlib.Path, help="Quiz file")
|
256
|
+
return parser
|
257
|
+
|
258
|
+
|
259
|
+
def main() -> NoReturn:
|
260
|
+
parser = get_arg_parser()
|
261
|
+
namespace = parser.parse_args()
|
262
|
+
|
263
|
+
if namespace.serve:
|
264
|
+
# The --serve flag is set, drop it from the args and serve the app instead through textual-serve
|
265
|
+
args = list(sys.argv)
|
266
|
+
args.remove("--serve")
|
267
|
+
|
268
|
+
server.Server(shlex.join(args), host=namespace.host, port=namespace.port).serve()
|
269
|
+
else:
|
270
|
+
config = models.load_config(namespace.quizfile)
|
271
|
+
app = QuizzyApp(config)
|
272
|
+
app.run()
|
273
|
+
sys.exit(0)
|
@@ -840,12 +840,13 @@ wheels = [
|
|
840
840
|
|
841
841
|
[[package]]
|
842
842
|
name = "quizzy"
|
843
|
-
version = "0.
|
843
|
+
version = "0.4.0"
|
844
844
|
source = { editable = "." }
|
845
845
|
dependencies = [
|
846
846
|
{ name = "pydantic" },
|
847
847
|
{ name = "pyyaml" },
|
848
848
|
{ name = "textual" },
|
849
|
+
{ name = "textual-serve" },
|
849
850
|
]
|
850
851
|
|
851
852
|
[package.dev-dependencies]
|
@@ -863,6 +864,7 @@ requires-dist = [
|
|
863
864
|
{ name = "pydantic", specifier = ">=2.10.3" },
|
864
865
|
{ name = "pyyaml", specifier = ">=6.0.2" },
|
865
866
|
{ name = "textual", specifier = ">=1.0.0" },
|
867
|
+
{ name = "textual-serve", specifier = ">=1.1.1" },
|
866
868
|
]
|
867
869
|
|
868
870
|
[package.metadata.requires-dev]
|
quizzy-0.3.1/quizzy/__main__.py
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|