jdg-keyforge-protocol 0.16.1__py3-none-any.whl

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 (35) hide show
  1. jdg_keyforge_protocol-0.16.1.dist-info/METADATA +76 -0
  2. jdg_keyforge_protocol-0.16.1.dist-info/RECORD +35 -0
  3. jdg_keyforge_protocol-0.16.1.dist-info/WHEEL +4 -0
  4. jdg_keyforge_protocol-0.16.1.dist-info/licenses/LICENSE +21 -0
  5. keyforge_protocol/__init__.py +281 -0
  6. keyforge_protocol/_json.py +5 -0
  7. keyforge_protocol/common_schema.py +507 -0
  8. keyforge_protocol/envelope_schema.py +96 -0
  9. keyforge_protocol/events/__init__.py +2 -0
  10. keyforge_protocol/events/action_invoked_schema.py +45 -0
  11. keyforge_protocol/events/active_profile_changed_schema.py +19 -0
  12. keyforge_protocol/events/input_schema.py +14 -0
  13. keyforge_protocol/methods/__init__.py +2 -0
  14. keyforge_protocol/methods/create_profile_schema.py +26 -0
  15. keyforge_protocol/methods/delete_profile_schema.py +27 -0
  16. keyforge_protocol/methods/duplicate_profile_schema.py +30 -0
  17. keyforge_protocol/methods/export_profile_schema.py +31 -0
  18. keyforge_protocol/methods/get_auto_switch_schema.py +30 -0
  19. keyforge_protocol/methods/hello_schema.py +44 -0
  20. keyforge_protocol/methods/import_profile_schema.py +26 -0
  21. keyforge_protocol/methods/inspect_plugin_schema.py +30 -0
  22. keyforge_protocol/methods/install_plugin_schema.py +30 -0
  23. keyforge_protocol/methods/list_actions_schema.py +49 -0
  24. keyforge_protocol/methods/list_bindings_schema.py +26 -0
  25. keyforge_protocol/methods/list_devices_schema.py +26 -0
  26. keyforge_protocol/methods/list_plugins_schema.py +26 -0
  27. keyforge_protocol/methods/list_profiles_schema.py +30 -0
  28. keyforge_protocol/methods/rename_profile_schema.py +29 -0
  29. keyforge_protocol/methods/set_active_profile_schema.py +27 -0
  30. keyforge_protocol/methods/set_auto_switch_schema.py +37 -0
  31. keyforge_protocol/methods/set_binding_schema.py +23 -0
  32. keyforge_protocol/methods/set_device_rotation_schema.py +24 -0
  33. keyforge_protocol/methods/set_input_color_schema.py +28 -0
  34. keyforge_protocol/methods/uninstall_plugin_schema.py +26 -0
  35. keyforge_protocol/py.typed +0 -0
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: jdg-keyforge-protocol
3
+ Version: 0.16.1
4
+ Summary: Python types for the KeyForge WebSocket protocol, generated from the canonical JSON Schema contracts.
5
+ Keywords: keyforge,protocol,types,json-schema,websocket
6
+ Author: Jonathan Daniel Gomez
7
+ Author-email: Jonathan Daniel Gomez <jonathan.d.gomez98@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.15
13
+ Classifier: Typing :: Typed
14
+ Requires-Python: >=3.15
15
+ Project-URL: Homepage, https://github.com/JoniDG/keyforge-protocol
16
+ Project-URL: Repository, https://github.com/JoniDG/keyforge-protocol
17
+ Project-URL: Issues, https://github.com/JoniDG/keyforge-protocol/issues
18
+ Description-Content-Type: text/markdown
19
+
20
+ # jdg-keyforge-protocol
21
+
22
+ > Python types for the [KeyForge](https://github.com/JoniDG/keyforge) WebSocket protocol, generated from the canonical JSON Schema contracts in this repository.
23
+
24
+ This package contains only `TypedDict`s and type aliases, with no runtime dependencies. It mirrors the TypeScript package [`@jdg-keyforge/protocol`](https://www.npmjs.com/package/@jdg-keyforge/protocol) and the Go submodule at `github.com/JoniDG/keyforge-protocol/go/protocol`.
25
+
26
+ Requires Python 3.15+ (it uses PEP 728 closed `TypedDict`s from the standard library).
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ uv add jdg-keyforge-protocol # or: pip install jdg-keyforge-protocol
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```python
37
+ import json
38
+
39
+ from keyforge_protocol import ActionInvokedData, HelloParams, PluginLaunchInfo
40
+
41
+ hello: HelloParams = {
42
+ "protocol_version": "1",
43
+ "client": {"name": "dev.example.counter", "version": "0.1.0"},
44
+ }
45
+
46
+ def on_action(data: ActionInvokedData) -> None:
47
+ print(data["action"]["id"], data["action"]["params"])
48
+ ```
49
+
50
+ The package root re-exports:
51
+
52
+ - every shared type from `common` and `envelope` (`InputEvent`, `PluginManifest`, `PluginLaunchInfo`, `Error`, ...);
53
+ - `Method<Name>` plus `<Name>Params` / `<Name>Result` for each method (e.g. `MethodHello`, `HelloParams`, `HelloResult`);
54
+ - `Event<Name>` plus `<Name>Data` for each event (e.g. `EventActionInvoked`, `ActionInvokedData`);
55
+ - types local to one method keep their schema name (`PeerInfo`, `ActionDescriptor`); other nested objects are prefixed with the method or event name (`ActionInvokedAction`);
56
+ - `JsonValue` / `JsonObject`, used for open objects such as `Action.params` and `Error.details`.
57
+
58
+ Types are static only: nothing is validated at runtime. Validate untrusted JSON against the schemas if you need to.
59
+
60
+ ## Versioning
61
+
62
+ Versioned together with the Go submodule and the TS package, with tags `py/vX.Y.Z`. A breaking schema change bumps the schema's `/v1/` path and the major version of every package.
63
+
64
+ ## Local regeneration
65
+
66
+ The contents of `src/keyforge_protocol/` are auto-generated. From the repository root:
67
+
68
+ ```bash
69
+ make generate-py # regenerate
70
+ make check-py # mypy --strict + contract tests
71
+ make build-py # sdist + wheel into py/dist/
72
+ ```
73
+
74
+ ## License
75
+
76
+ [Apache 2.0](./LICENSE) — Copyright (c) 2026 Jonathan Daniel Gomez.
@@ -0,0 +1,35 @@
1
+ keyforge_protocol/__init__.py,sha256=2OoVgWyxZynHH9BZ-8G4rotb-zntsIP9PWfBnCsRqxM,6910
2
+ keyforge_protocol/_json.py,sha256=Ac7rm3c9J8zs8YkatKk48AN4HQl1jLL1SKUo4jgl4Bw,281
3
+ keyforge_protocol/common_schema.py,sha256=6a2eSfSvxsZO_slrgxFFPjmRnUQ41CnjPxN46oZ0ves,20302
4
+ keyforge_protocol/envelope_schema.py,sha256=PKuR3fTUsL1DF1SQfbnnCJPJMyTMZu3Cud4m5r9lE5g,2251
5
+ keyforge_protocol/events/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
6
+ keyforge_protocol/events/action_invoked_schema.py,sha256=n05LRBzGFUrWLMNX7mCrFjrJP63qtcJvxscvc9e_Ygs,1616
7
+ keyforge_protocol/events/active_profile_changed_schema.py,sha256=QWFgRetfJ2NLIJoh43wNKYiTkNbyFHwjYblFXeYRL5o,610
8
+ keyforge_protocol/events/input_schema.py,sha256=KF8RNCAwRqgQ6uzDhR5arzKgqUk1Zs8lJJlVQsouPO0,367
9
+ keyforge_protocol/methods/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
10
+ keyforge_protocol/methods/create_profile_schema.py,sha256=_EK-4mJuesjE6KVrIZq4PzHMj_8b5CmH1-68n-3jczg,551
11
+ keyforge_protocol/methods/delete_profile_schema.py,sha256=eZdP4acGbaIV33hwlB5z_8iTwdzWgJDp8f5p2qUQkYs,866
12
+ keyforge_protocol/methods/duplicate_profile_schema.py,sha256=-KaXqKW53gwwOCPFsz_eqtF10umnyk9_GrVBqWJ_-mA,717
13
+ keyforge_protocol/methods/export_profile_schema.py,sha256=aATVa_osUb8BwWhw7tQpdhC_NxZ9j9EI95MekSkRVEQ,767
14
+ keyforge_protocol/methods/get_auto_switch_schema.py,sha256=hNmcB5gi0zYWZv_7e4PDyFRKNNNniwieKu76obvQ_N8,796
15
+ keyforge_protocol/methods/hello_schema.py,sha256=I0ZJI-rE5zPIC42MzdtQ1dBhBqBa6oLn-OkW2reD7rE,1325
16
+ keyforge_protocol/methods/import_profile_schema.py,sha256=BqbcEdM6bEGabaOQfi0QH-W7wpIoTpCSyF9eiT0j1Uw,729
17
+ keyforge_protocol/methods/inspect_plugin_schema.py,sha256=Otia71Rs9zb3rjzqVUaDz964V-p93ck9Vj5s8IJGGaE,1003
18
+ keyforge_protocol/methods/install_plugin_schema.py,sha256=em04gQ2_BxwA7tH8Vt-YmudCU-5pBNSbb-Hxgr_wDWE,1266
19
+ keyforge_protocol/methods/list_actions_schema.py,sha256=9tODH6x89yFDKh54XNkdSLtObVKsRa2YSv0zFGcQIqQ,1185
20
+ keyforge_protocol/methods/list_bindings_schema.py,sha256=LtEcpQR9DFhoZy3qLDl7F4xNFzwuLyrjdkrstGOlYfM,619
21
+ keyforge_protocol/methods/list_devices_schema.py,sha256=XdeIWvfnoEBnyYm5HisrIYWjc0IYCpYmMs_sH6B3T1Q,577
22
+ keyforge_protocol/methods/list_plugins_schema.py,sha256=H3DkJMCANy6jyKCv7wqq2BBC5WAI_1lKFGCJVPWo1nc,535
23
+ keyforge_protocol/methods/list_profiles_schema.py,sha256=odeCmONa4cS39nSENC1ievOW1Fnay5GKnFJjfL_0iGQ,769
24
+ keyforge_protocol/methods/rename_profile_schema.py,sha256=CRQ670PG-ZSatGCv4U6tdwN8XxfXzzZBcFsUKizpSHM,633
25
+ keyforge_protocol/methods/set_active_profile_schema.py,sha256=0rv4vel6SKPx_Gc2vX_xnTedDdDEMmvCyOUVDKh47Xg,643
26
+ keyforge_protocol/methods/set_auto_switch_schema.py,sha256=SAHZd3ur-2IyXSXamqBOHIi_5JtHvMR99o0x2erEzc0,1155
27
+ keyforge_protocol/methods/set_binding_schema.py,sha256=BVhprEF4_hAqbk1wf7OTW7LewhA4siIZ65DFiKzEfow,690
28
+ keyforge_protocol/methods/set_device_rotation_schema.py,sha256=oTxVJ8MTsFTRXZWwKoeZaJ5eJcVFZBtpXLF83ezYwxY,885
29
+ keyforge_protocol/methods/set_input_color_schema.py,sha256=pN6lUHbuwZf_WibWpqY3sPsn9ZhkhCg4Okqf2QIFUmc,992
30
+ keyforge_protocol/methods/uninstall_plugin_schema.py,sha256=hmHGb8oe5x2RwgABz0oUw2EEZ7zsF6W0fIKStaRMCzg,750
31
+ keyforge_protocol/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
+ jdg_keyforge_protocol-0.16.1.dist-info/licenses/LICENSE,sha256=ppL7g6LKqm71f6wOYrIARgKvzURdUsQvwE9QqTGWS08,864
33
+ jdg_keyforge_protocol-0.16.1.dist-info/WHEEL,sha256=xTCBFIZIIyRSxyowOv5Wqg_jFU6KsdIffuulBB09Ph8,80
34
+ jdg_keyforge_protocol-0.16.1.dist-info/METADATA,sha256=ztX_KUBWdNi_uWknfx0kEkuZOKcEa0anFLYDuaaczCs,3130
35
+ jdg_keyforge_protocol-0.16.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.13.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright (c) 2026 Jonathan Daniel Gomez <jonathan.d.gomez98@gmail.com>
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ---
20
+
21
+ Full license text: https://www.apache.org/licenses/LICENSE-2.0.txt
@@ -0,0 +1,281 @@
1
+ # AUTO-GENERATED by 'make generate-py'. DO NOT EDIT BY HAND.
2
+
3
+ """Types for the KeyForge WebSocket protocol, generated from its JSON Schemas."""
4
+
5
+ from ._json import JsonObject, JsonValue
6
+ from .common_schema import (
7
+ DeviceID,
8
+ InputKind,
9
+ InputAction,
10
+ InputEvent,
11
+ Action,
12
+ SendKeysActionParams,
13
+ LaunchAppActionParams,
14
+ DelayActionParams,
15
+ MacroActionParams,
16
+ ToggleActionParams,
17
+ Binding,
18
+ InputLayout,
19
+ DeviceRotation,
20
+ Color,
21
+ InputColor,
22
+ AutoSwitchRule,
23
+ InputFilter,
24
+ PluginID,
25
+ PluginLaunchInfo,
26
+ PluginCommand,
27
+ SetColorActionParams,
28
+ Profile,
29
+ ExportedProfile,
30
+ Input,
31
+ Device,
32
+ ParamSpec,
33
+ Entrypoint,
34
+ PluginAction,
35
+ PluginManifest,
36
+ InstalledPlugin,
37
+ )
38
+ from .envelope_schema import (
39
+ Request,
40
+ ResponseOk,
41
+ Error,
42
+ Event,
43
+ ResponseErr,
44
+ Response,
45
+ Envelope,
46
+ )
47
+ from .methods.create_profile_schema import (
48
+ MethodCreateProfile,
49
+ Params as CreateProfileParams,
50
+ Result as CreateProfileResult,
51
+ )
52
+ from .methods.delete_profile_schema import (
53
+ MethodDeleteProfile,
54
+ Params as DeleteProfileParams,
55
+ Result as DeleteProfileResult,
56
+ )
57
+ from .methods.duplicate_profile_schema import (
58
+ MethodDuplicateProfile,
59
+ Params as DuplicateProfileParams,
60
+ Result as DuplicateProfileResult,
61
+ )
62
+ from .methods.export_profile_schema import (
63
+ MethodExportProfile,
64
+ Params as ExportProfileParams,
65
+ Result as ExportProfileResult,
66
+ )
67
+ from .methods.get_auto_switch_schema import (
68
+ MethodGetAutoSwitch,
69
+ Result as GetAutoSwitchResult,
70
+ )
71
+ from .methods.hello_schema import (
72
+ MethodHello,
73
+ Params as HelloParams,
74
+ PeerInfo,
75
+ Result as HelloResult,
76
+ )
77
+ from .methods.import_profile_schema import (
78
+ MethodImportProfile,
79
+ Params as ImportProfileParams,
80
+ Result as ImportProfileResult,
81
+ )
82
+ from .methods.inspect_plugin_schema import (
83
+ MethodInspectPlugin,
84
+ Params as InspectPluginParams,
85
+ Result as InspectPluginResult,
86
+ )
87
+ from .methods.install_plugin_schema import (
88
+ MethodInstallPlugin,
89
+ Params as InstallPluginParams,
90
+ Result as InstallPluginResult,
91
+ )
92
+ from .methods.list_actions_schema import (
93
+ ActionDescriptor,
94
+ MethodListActions,
95
+ Result as ListActionsResult,
96
+ )
97
+ from .methods.list_bindings_schema import (
98
+ MethodListBindings,
99
+ Result as ListBindingsResult,
100
+ )
101
+ from .methods.list_devices_schema import (
102
+ MethodListDevices,
103
+ Result as ListDevicesResult,
104
+ )
105
+ from .methods.list_plugins_schema import (
106
+ MethodListPlugins,
107
+ Result as ListPluginsResult,
108
+ )
109
+ from .methods.list_profiles_schema import (
110
+ MethodListProfiles,
111
+ Result as ListProfilesResult,
112
+ )
113
+ from .methods.rename_profile_schema import (
114
+ MethodRenameProfile,
115
+ Params as RenameProfileParams,
116
+ )
117
+ from .methods.set_active_profile_schema import (
118
+ MethodSetActiveProfile,
119
+ Params as SetActiveProfileParams,
120
+ Result as SetActiveProfileResult,
121
+ )
122
+ from .methods.set_auto_switch_schema import (
123
+ MethodSetAutoSwitch,
124
+ Params as SetAutoSwitchParams,
125
+ Result as SetAutoSwitchResult,
126
+ )
127
+ from .methods.set_binding_schema import (
128
+ MethodSetBinding,
129
+ Params as SetBindingParams,
130
+ )
131
+ from .methods.set_device_rotation_schema import (
132
+ MethodSetDeviceRotation,
133
+ Params as SetDeviceRotationParams,
134
+ )
135
+ from .methods.set_input_color_schema import (
136
+ MethodSetInputColor,
137
+ Params as SetInputColorParams,
138
+ )
139
+ from .methods.uninstall_plugin_schema import (
140
+ MethodUninstallPlugin,
141
+ Params as UninstallPluginParams,
142
+ )
143
+ from .events.action_invoked_schema import (
144
+ Action as ActionInvokedAction,
145
+ Data as ActionInvokedData,
146
+ EventActionInvoked,
147
+ )
148
+ from .events.active_profile_changed_schema import (
149
+ Data as ActiveProfileChangedData,
150
+ EventActiveProfileChanged,
151
+ )
152
+ from .events.input_schema import (
153
+ EventInput,
154
+ )
155
+
156
+ type GetAutoSwitchParams = JsonObject
157
+ type ListActionsParams = JsonObject
158
+ type ListBindingsParams = JsonObject
159
+ type ListDevicesParams = JsonObject
160
+ type ListPluginsParams = JsonObject
161
+ type ListProfilesParams = JsonObject
162
+ type RenameProfileResult = JsonObject
163
+ type SetBindingResult = JsonObject
164
+ type SetDeviceRotationResult = JsonObject
165
+ type SetInputColorResult = JsonObject
166
+ type UninstallPluginResult = JsonObject
167
+ type InputData = InputEvent
168
+
169
+ __all__ = [
170
+ "Action",
171
+ "ActionDescriptor",
172
+ "ActionInvokedAction",
173
+ "ActionInvokedData",
174
+ "ActiveProfileChangedData",
175
+ "AutoSwitchRule",
176
+ "Binding",
177
+ "Color",
178
+ "CreateProfileParams",
179
+ "CreateProfileResult",
180
+ "DelayActionParams",
181
+ "DeleteProfileParams",
182
+ "DeleteProfileResult",
183
+ "Device",
184
+ "DeviceID",
185
+ "DeviceRotation",
186
+ "DuplicateProfileParams",
187
+ "DuplicateProfileResult",
188
+ "Entrypoint",
189
+ "Envelope",
190
+ "Error",
191
+ "Event",
192
+ "EventActionInvoked",
193
+ "EventActiveProfileChanged",
194
+ "EventInput",
195
+ "ExportProfileParams",
196
+ "ExportProfileResult",
197
+ "ExportedProfile",
198
+ "GetAutoSwitchParams",
199
+ "GetAutoSwitchResult",
200
+ "HelloParams",
201
+ "HelloResult",
202
+ "ImportProfileParams",
203
+ "ImportProfileResult",
204
+ "Input",
205
+ "InputAction",
206
+ "InputColor",
207
+ "InputData",
208
+ "InputEvent",
209
+ "InputFilter",
210
+ "InputKind",
211
+ "InputLayout",
212
+ "InspectPluginParams",
213
+ "InspectPluginResult",
214
+ "InstallPluginParams",
215
+ "InstallPluginResult",
216
+ "InstalledPlugin",
217
+ "JsonObject",
218
+ "JsonValue",
219
+ "LaunchAppActionParams",
220
+ "ListActionsParams",
221
+ "ListActionsResult",
222
+ "ListBindingsParams",
223
+ "ListBindingsResult",
224
+ "ListDevicesParams",
225
+ "ListDevicesResult",
226
+ "ListPluginsParams",
227
+ "ListPluginsResult",
228
+ "ListProfilesParams",
229
+ "ListProfilesResult",
230
+ "MacroActionParams",
231
+ "MethodCreateProfile",
232
+ "MethodDeleteProfile",
233
+ "MethodDuplicateProfile",
234
+ "MethodExportProfile",
235
+ "MethodGetAutoSwitch",
236
+ "MethodHello",
237
+ "MethodImportProfile",
238
+ "MethodInspectPlugin",
239
+ "MethodInstallPlugin",
240
+ "MethodListActions",
241
+ "MethodListBindings",
242
+ "MethodListDevices",
243
+ "MethodListPlugins",
244
+ "MethodListProfiles",
245
+ "MethodRenameProfile",
246
+ "MethodSetActiveProfile",
247
+ "MethodSetAutoSwitch",
248
+ "MethodSetBinding",
249
+ "MethodSetDeviceRotation",
250
+ "MethodSetInputColor",
251
+ "MethodUninstallPlugin",
252
+ "ParamSpec",
253
+ "PeerInfo",
254
+ "PluginAction",
255
+ "PluginCommand",
256
+ "PluginID",
257
+ "PluginLaunchInfo",
258
+ "PluginManifest",
259
+ "Profile",
260
+ "RenameProfileParams",
261
+ "RenameProfileResult",
262
+ "Request",
263
+ "Response",
264
+ "ResponseErr",
265
+ "ResponseOk",
266
+ "SendKeysActionParams",
267
+ "SetActiveProfileParams",
268
+ "SetActiveProfileResult",
269
+ "SetAutoSwitchParams",
270
+ "SetAutoSwitchResult",
271
+ "SetBindingParams",
272
+ "SetBindingResult",
273
+ "SetColorActionParams",
274
+ "SetDeviceRotationParams",
275
+ "SetDeviceRotationResult",
276
+ "SetInputColorParams",
277
+ "SetInputColorResult",
278
+ "ToggleActionParams",
279
+ "UninstallPluginParams",
280
+ "UninstallPluginResult",
281
+ ]
@@ -0,0 +1,5 @@
1
+ # AUTO-GENERATED by 'make generate-py'. DO NOT EDIT BY HAND.
2
+ """JSON values for the open objects of the schema (Action.params, Error.details, ...)."""
3
+
4
+ type JsonValue = str | int | float | bool | None | list[JsonValue] | dict[str, JsonValue]
5
+ type JsonObject = dict[str, JsonValue]