squoredata 0.1.0__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.
- squoredata-0.1.0/.gitignore +8 -0
- squoredata-0.1.0/LICENSE +21 -0
- squoredata-0.1.0/PKG-INFO +92 -0
- squoredata-0.1.0/README.md +70 -0
- squoredata-0.1.0/golden/squore-match-livedata.json +573 -0
- squoredata-0.1.0/golden/squore-match.json +34 -0
- squoredata-0.1.0/golden_data.py +133 -0
- squoredata-0.1.0/hatch_build.py +31 -0
- squoredata-0.1.0/pyproject.toml +111 -0
- squoredata-0.1.0/scripts/generate_ts.py +89 -0
- squoredata-0.1.0/scripts/make_golden.py +39 -0
- squoredata-0.1.0/src/squoredata/__init__.py +72 -0
- squoredata-0.1.0/src/squoredata/devinfo.py +68 -0
- squoredata-0.1.0/src/squoredata/game.py +39 -0
- squoredata-0.1.0/src/squoredata/livedata.py +233 -0
- squoredata-0.1.0/src/squoredata/livestatus.py +63 -0
- squoredata-0.1.0/src/squoredata/match.py +84 -0
- squoredata-0.1.0/src/squoredata/point.py +109 -0
- squoredata-0.1.0/src/squoredata/py.typed +0 -0
- squoredata-0.1.0/typescript/SquoreMatch.d.ts +111 -0
- squoredata-0.1.0/typescript/SquoreMatch.schema.json +407 -0
- squoredata-0.1.0/typescript/SquoreMatchLiveData.d.ts +238 -0
- squoredata-0.1.0/typescript/SquoreMatchLiveData.schema.json +968 -0
- squoredata-0.1.0/typescript/index.d.ts +3 -0
- squoredata-0.1.0/typescript/package.json +11 -0
- squoredata-0.1.0/typescript/tests/golden.ts +21 -0
squoredata-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 martin f. krafft
|
|
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,92 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: squoredata
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Self-contained Pydantic data structures used by Squore tablets
|
|
5
|
+
Author-email: "martin f. krafft" <squoredata@pobox.madduck.net>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Requires-Python: >=3.13
|
|
11
|
+
Requires-Dist: pydantic
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: coverage; extra == 'dev'
|
|
14
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
15
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
16
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
17
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
18
|
+
Requires-Dist: pytest-mock; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest-ruff; extra == 'dev'
|
|
20
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# squoredata
|
|
24
|
+
|
|
25
|
+
Self-contained [Pydantic](https://docs.pydantic.dev) v2 data structures used by
|
|
26
|
+
[Squore](https://github.com/obbimi/Squore) scoreboard tablets.
|
|
27
|
+
|
|
28
|
+
The package was extracted from [`tcboard`](https://github.com/madduck/tcboard).
|
|
29
|
+
It contains only the data models, not the surrounding server logic. TypeScript
|
|
30
|
+
bindings are generated from the models so that a JavaScript or TypeScript
|
|
31
|
+
project can consume the same shape.
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
- `SquoreMatch` — a match as used by Squore, without any live information.
|
|
36
|
+
- `SquoreMatchLiveData` — a `SquoreMatch` together with the live data a tablet
|
|
37
|
+
reports. It adds the `court` and `timestamp` fields.
|
|
38
|
+
|
|
39
|
+
Supporting models: `Players`, `Colors`, `Countries`, `Clubs`, `Event`, `Format`,
|
|
40
|
+
`Wifi`, `Metadata`, `SquoreDeviceInfo`, `TimerInfo`, `Timing`, `When`, `Point`,
|
|
41
|
+
`Game`, and the `LiveStatus` enum.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
pip install squoredata
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## TypeScript bindings
|
|
50
|
+
|
|
51
|
+
`scripts/generate_ts.py` renders the JSON Schema of each model and converts it
|
|
52
|
+
to TypeScript with
|
|
53
|
+
[`json-schema-to-typescript`](https://www.npmjs.com/package/json-schema-to-typescript).
|
|
54
|
+
The output lives in `typescript/` and is committed:
|
|
55
|
+
|
|
56
|
+
- `SquoreMatch.d.ts`, `SquoreMatchLiveData.d.ts` — the interfaces
|
|
57
|
+
- `SquoreMatch.schema.json`, `SquoreMatchLiveData.schema.json` — the schemata
|
|
58
|
+
- `index.d.ts` — re-exports
|
|
59
|
+
|
|
60
|
+
The Hatch build hook (`hatch_build.py`) runs the generator before a wheel is
|
|
61
|
+
built, so a release can never carry stale bindings.
|
|
62
|
+
|
|
63
|
+
Install the generated bindings into another project from the `typescript/`
|
|
64
|
+
directory, or from a published `squoredata-types` package:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npm install /path/to/squoredata/typescript
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Golden tests
|
|
71
|
+
|
|
72
|
+
The files in `golden/` are the shared contract between the two sides:
|
|
73
|
+
|
|
74
|
+
- `tests/test_golden.py` serialises and re-validates the models against the
|
|
75
|
+
golden JSON.
|
|
76
|
+
- `typescript/tests/golden.ts` assigns the same JSON to the generated
|
|
77
|
+
interfaces, so `tsc --noEmit` fails when the two sides diverge.
|
|
78
|
+
|
|
79
|
+
Regenerate the golden files with `python scripts/make_golden.py` after a model
|
|
80
|
+
change.
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
pip install -e .[dev]
|
|
86
|
+
ruff check .
|
|
87
|
+
pytest
|
|
88
|
+
mypy --strict .
|
|
89
|
+
|
|
90
|
+
npm install
|
|
91
|
+
node_modules/.bin/tsc --noEmit -p tsconfig.json
|
|
92
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# squoredata
|
|
2
|
+
|
|
3
|
+
Self-contained [Pydantic](https://docs.pydantic.dev) v2 data structures used by
|
|
4
|
+
[Squore](https://github.com/obbimi/Squore) scoreboard tablets.
|
|
5
|
+
|
|
6
|
+
The package was extracted from [`tcboard`](https://github.com/madduck/tcboard).
|
|
7
|
+
It contains only the data models, not the surrounding server logic. TypeScript
|
|
8
|
+
bindings are generated from the models so that a JavaScript or TypeScript
|
|
9
|
+
project can consume the same shape.
|
|
10
|
+
|
|
11
|
+
## Models
|
|
12
|
+
|
|
13
|
+
- `SquoreMatch` — a match as used by Squore, without any live information.
|
|
14
|
+
- `SquoreMatchLiveData` — a `SquoreMatch` together with the live data a tablet
|
|
15
|
+
reports. It adds the `court` and `timestamp` fields.
|
|
16
|
+
|
|
17
|
+
Supporting models: `Players`, `Colors`, `Countries`, `Clubs`, `Event`, `Format`,
|
|
18
|
+
`Wifi`, `Metadata`, `SquoreDeviceInfo`, `TimerInfo`, `Timing`, `When`, `Point`,
|
|
19
|
+
`Game`, and the `LiveStatus` enum.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
pip install squoredata
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## TypeScript bindings
|
|
28
|
+
|
|
29
|
+
`scripts/generate_ts.py` renders the JSON Schema of each model and converts it
|
|
30
|
+
to TypeScript with
|
|
31
|
+
[`json-schema-to-typescript`](https://www.npmjs.com/package/json-schema-to-typescript).
|
|
32
|
+
The output lives in `typescript/` and is committed:
|
|
33
|
+
|
|
34
|
+
- `SquoreMatch.d.ts`, `SquoreMatchLiveData.d.ts` — the interfaces
|
|
35
|
+
- `SquoreMatch.schema.json`, `SquoreMatchLiveData.schema.json` — the schemata
|
|
36
|
+
- `index.d.ts` — re-exports
|
|
37
|
+
|
|
38
|
+
The Hatch build hook (`hatch_build.py`) runs the generator before a wheel is
|
|
39
|
+
built, so a release can never carry stale bindings.
|
|
40
|
+
|
|
41
|
+
Install the generated bindings into another project from the `typescript/`
|
|
42
|
+
directory, or from a published `squoredata-types` package:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm install /path/to/squoredata/typescript
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Golden tests
|
|
49
|
+
|
|
50
|
+
The files in `golden/` are the shared contract between the two sides:
|
|
51
|
+
|
|
52
|
+
- `tests/test_golden.py` serialises and re-validates the models against the
|
|
53
|
+
golden JSON.
|
|
54
|
+
- `typescript/tests/golden.ts` assigns the same JSON to the generated
|
|
55
|
+
interfaces, so `tsc --noEmit` fails when the two sides diverge.
|
|
56
|
+
|
|
57
|
+
Regenerate the golden files with `python scripts/make_golden.py` after a model
|
|
58
|
+
change.
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
pip install -e .[dev]
|
|
64
|
+
ruff check .
|
|
65
|
+
pytest
|
|
66
|
+
mypy --strict .
|
|
67
|
+
|
|
68
|
+
npm install
|
|
69
|
+
node_modules/.bin/tsc --noEmit -p tsconfig.json
|
|
70
|
+
```
|