vcti-viewer-protocol 0.3.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.
- vcti_viewer_protocol-0.3.0/LICENSE +8 -0
- vcti_viewer_protocol-0.3.0/PKG-INFO +160 -0
- vcti_viewer_protocol-0.3.0/README.md +116 -0
- vcti_viewer_protocol-0.3.0/pyproject.toml +103 -0
- vcti_viewer_protocol-0.3.0/setup.cfg +4 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/__init__.py +258 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/array.py +132 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/base.py +28 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/bundle/__init__.py +24 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/bundle/__main__.py +7 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/bundle/build.py +405 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/bundle/cli.py +49 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/bundle/schema.py +87 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/error.py +27 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/__init__.py +86 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/__main__.py +7 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/actions/__init__.py +3 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/actions/reports.py +39 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/actions/sessions.py +88 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/actions/studies.py +58 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/api/__init__.py +3 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/api/v1/__init__.py +3 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/api/v1/dependencies.py +30 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/api/v1/endpoints/__init__.py +3 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/api/v1/endpoints/reports.py +67 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/api/v1/endpoints/sessions.py +149 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/api/v1/endpoints/studies.py +108 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/cli.py +55 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/main.py +149 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/__init__.py +3 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/catalog.py +313 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/reports.py +819 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/selection.py +179 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/__init__.py +3 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/_stage.py +90 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/arrays.py +121 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/bindings.py +169 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/fingerprint.py +97 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/navigator.py +162 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/projection.py +407 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/mock/services/stage/served.py +127 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/model.py +630 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/navigator.py +94 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/primitives.py +80 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/py.typed +0 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/report.py +66 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/scene.py +135 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/session.py +96 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/step.py +396 -0
- vcti_viewer_protocol-0.3.0/src/vcti/viewer/protocol/study.py +103 -0
- vcti_viewer_protocol-0.3.0/src/vcti_viewer_protocol.egg-info/PKG-INFO +160 -0
- vcti_viewer_protocol-0.3.0/src/vcti_viewer_protocol.egg-info/SOURCES.txt +80 -0
- vcti_viewer_protocol-0.3.0/src/vcti_viewer_protocol.egg-info/dependency_links.txt +1 -0
- vcti_viewer_protocol-0.3.0/src/vcti_viewer_protocol.egg-info/entry_points.txt +3 -0
- vcti_viewer_protocol-0.3.0/src/vcti_viewer_protocol.egg-info/requires.txt +31 -0
- vcti_viewer_protocol-0.3.0/src/vcti_viewer_protocol.egg-info/top_level.txt +1 -0
- vcti_viewer_protocol-0.3.0/tests/test_array.py +168 -0
- vcti_viewer_protocol-0.3.0/tests/test_base.py +93 -0
- vcti_viewer_protocol-0.3.0/tests/test_bundle.py +407 -0
- vcti_viewer_protocol-0.3.0/tests/test_docs.py +169 -0
- vcti_viewer_protocol-0.3.0/tests/test_error.py +26 -0
- vcti_viewer_protocol-0.3.0/tests/test_examples.py +268 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_api.py +482 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_arrays.py +144 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_bindings.py +198 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_catalog.py +295 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_cli.py +75 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_navigator.py +237 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_projection.py +344 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_reports.py +719 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_selection.py +220 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_served.py +189 -0
- vcti_viewer_protocol-0.3.0/tests/test_mock_stage.py +89 -0
- vcti_viewer_protocol-0.3.0/tests/test_model.py +429 -0
- vcti_viewer_protocol-0.3.0/tests/test_navigator.py +152 -0
- vcti_viewer_protocol-0.3.0/tests/test_primitives.py +137 -0
- vcti_viewer_protocol-0.3.0/tests/test_report.py +83 -0
- vcti_viewer_protocol-0.3.0/tests/test_scene.py +233 -0
- vcti_viewer_protocol-0.3.0/tests/test_session.py +153 -0
- vcti_viewer_protocol-0.3.0/tests/test_step.py +245 -0
- vcti_viewer_protocol-0.3.0/tests/test_study.py +148 -0
- vcti_viewer_protocol-0.3.0/tests/test_version.py +15 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Copyright (c) 2018-2026 Visual Collaboration Technologies Inc.
|
|
2
|
+
All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
This software is proprietary and confidential. Unauthorized copying,
|
|
5
|
+
distribution, or use of this software, via any medium, is strictly
|
|
6
|
+
prohibited. Access is granted only to authorized VCollab developers
|
|
7
|
+
and individuals explicitly authorized by Visual Collaboration
|
|
8
|
+
Technologies Inc.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vcti-viewer-protocol
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: The viewer's server–client protocol: Pydantic contract models, a transport-neutral message catalog (JSON Schema) with its protocol bindings, fixture scenarios, a mock server for client testing, and the versioned protocol bundle the TypeScript client is built from
|
|
5
|
+
Author: Visual Collaboration Technologies Inc.
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Repository, https://github.com/vcollab/vcti-python-viewer-protocol
|
|
8
|
+
Project-URL: Changelog, https://github.com/vcollab/vcti-python-viewer-protocol/blob/main/CHANGELOG.md
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Python: <3.15,>=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pydantic>=2.0
|
|
17
|
+
Requires-Dist: vcti-enum>=2.0.1
|
|
18
|
+
Provides-Extra: mock
|
|
19
|
+
Requires-Dist: vcti-usd-schema-core>=0.7.2; extra == "mock"
|
|
20
|
+
Requires-Dist: vcti-usd-schema-model>=0.8.0; extra == "mock"
|
|
21
|
+
Requires-Dist: vcti-usd-schema-model-navigator>=0.7.0; extra == "mock"
|
|
22
|
+
Requires-Dist: vcti-usd-schema-report>=0.4.0; extra == "mock"
|
|
23
|
+
Requires-Dist: vcti-lookup>=5.1.1; extra == "mock"
|
|
24
|
+
Requires-Dist: vcti-predicate>=4.0.0; extra == "mock"
|
|
25
|
+
Requires-Dist: fastapi>=0.115; extra == "mock"
|
|
26
|
+
Requires-Dist: uvicorn>=0.30; extra == "mock"
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest; extra == "test"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
30
|
+
Requires-Dist: vcti-usd-schema-core>=0.7.2; extra == "test"
|
|
31
|
+
Requires-Dist: vcti-usd-schema-model>=0.8.0; extra == "test"
|
|
32
|
+
Requires-Dist: vcti-usd-schema-model-navigator>=0.7.0; extra == "test"
|
|
33
|
+
Requires-Dist: vcti-usd-schema-report>=0.4.0; extra == "test"
|
|
34
|
+
Requires-Dist: vcti-lookup>=5.1.1; extra == "test"
|
|
35
|
+
Requires-Dist: vcti-predicate>=4.0.0; extra == "test"
|
|
36
|
+
Requires-Dist: fastapi>=0.115; extra == "test"
|
|
37
|
+
Requires-Dist: uvicorn>=0.30; extra == "test"
|
|
38
|
+
Requires-Dist: httpx2; extra == "test"
|
|
39
|
+
Provides-Extra: lint
|
|
40
|
+
Requires-Dist: ruff; extra == "lint"
|
|
41
|
+
Provides-Extra: typecheck
|
|
42
|
+
Requires-Dist: mypy; extra == "typecheck"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# Viewer Protocol
|
|
46
|
+
|
|
47
|
+
The viewer's server–client protocol: Pydantic contract models, a
|
|
48
|
+
transport-neutral message catalog (JSON Schema) with its protocol bindings,
|
|
49
|
+
fixture scenarios, a mock server for client testing, and the versioned
|
|
50
|
+
protocol bundle the TypeScript client is built from.
|
|
51
|
+
|
|
52
|
+
## Overview
|
|
53
|
+
|
|
54
|
+
The viewer talks to its server over several protocols, and this package
|
|
55
|
+
is the single definition of what is said over all of them. Every message
|
|
56
|
+
is a Pydantic model: unknown fields are rejected, validation is strict,
|
|
57
|
+
and the JSON Schema and OpenAPI documents are generated from the models,
|
|
58
|
+
so the Python server and the TypeScript client cannot disagree about a
|
|
59
|
+
message without a build noticing. With the `mock` extra, the package also
|
|
60
|
+
serves the protocol from USD stages built beforehand, so a client can be
|
|
61
|
+
developed and tested without the real server, and builds the versioned
|
|
62
|
+
bundle of schemas and recorded responses the client is built from.
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install vcti-viewer-protocol
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### In `requirements.txt`
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
vcti-viewer-protocol>=0.1.0
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### In `pyproject.toml` dependencies
|
|
77
|
+
|
|
78
|
+
```toml
|
|
79
|
+
dependencies = [
|
|
80
|
+
"vcti-viewer-protocol>=0.1.0",
|
|
81
|
+
]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Quick Start
|
|
87
|
+
|
|
88
|
+
Every message is a Pydantic model. Read a study definition received from
|
|
89
|
+
a backend — the field names are the same snake_case names on the wire:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from vcti.viewer.protocol import FilesStudy, StudyDefinitionAdapter
|
|
93
|
+
|
|
94
|
+
definition = StudyDefinitionAdapter.validate_json(
|
|
95
|
+
'{"type": "files", "sources": [{"locator": "bracket/bracket.h5"}]}'
|
|
96
|
+
)
|
|
97
|
+
assert isinstance(definition, FilesStudy)
|
|
98
|
+
print(definition.sources[0].locator)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A field the protocol does not define is rejected, never ignored:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from pydantic import ValidationError
|
|
105
|
+
|
|
106
|
+
try:
|
|
107
|
+
StudyDefinitionAdapter.validate_python(
|
|
108
|
+
{"type": "files", "sources": [{"locator": "a.h5", "format": "hdf5"}]}
|
|
109
|
+
)
|
|
110
|
+
except ValidationError as error:
|
|
111
|
+
print(error.errors()[0]["type"]) # extra_forbidden
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Describe a buffer before the client fetches it:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from vcti.viewer.protocol import ArrayDescriptor, ElementType
|
|
118
|
+
|
|
119
|
+
points = ArrayDescriptor(
|
|
120
|
+
path="arrays/points", element_type=ElementType.FLOAT32, width=3, count=1200
|
|
121
|
+
)
|
|
122
|
+
print(points.byte_length) # 14400
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Dependencies
|
|
128
|
+
|
|
129
|
+
- [pydantic](https://pypi.org/project/pydantic/) — the contract models.
|
|
130
|
+
- [vcti-enum](https://pypi.org/project/vcti-enum/) — enumerated fields: the
|
|
131
|
+
model holds the enum member, the wire its encoded string.
|
|
132
|
+
- [vcti-usd-schema-model](https://pypi.org/project/vcti-usd-schema-model/)
|
|
133
|
+
— with the `mock` extra only: the USD stages the mock serves, and
|
|
134
|
+
`usd-core`.
|
|
135
|
+
- [vcti-usd-schema-model-navigator](https://pypi.org/project/vcti-usd-schema-model-navigator/)
|
|
136
|
+
and [vcti-usd-schema-core](https://pypi.org/project/vcti-usd-schema-core/)
|
|
137
|
+
— with the `mock` extra only: each model's navigator, the study that
|
|
138
|
+
lists the models, and the model paths a visibility flag is stored on.
|
|
139
|
+
- [vcti-usd-schema-report](https://pypi.org/project/vcti-usd-schema-report/)
|
|
140
|
+
— with the `mock` extra only: the report's USD stage a workflow is run on,
|
|
141
|
+
which gives slides and sections their paths.
|
|
142
|
+
- [vcti-lookup](https://pypi.org/project/vcti-lookup/) — with the `mock`
|
|
143
|
+
extra only: resolves a selection's rules.
|
|
144
|
+
- [FastAPI](https://pypi.org/project/fastapi/) and
|
|
145
|
+
[uvicorn](https://pypi.org/project/uvicorn/) — with the `mock` extra only:
|
|
146
|
+
the mock server's REST binding, run with `vcti-viewer-mock`, and the
|
|
147
|
+
protocol bundle built from it with `vcti-viewer-bundle`.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Documentation
|
|
152
|
+
|
|
153
|
+
| If you want to… | Read |
|
|
154
|
+
|---|---|
|
|
155
|
+
| Understand the architecture and design decisions | [docs/design/overview.md](docs/design/overview.md) |
|
|
156
|
+
| Navigate and understand the source | [docs/source-guide.md](docs/source-guide.md) |
|
|
157
|
+
| See practical, real-world usage | [docs/patterns.md](docs/patterns.md) |
|
|
158
|
+
| Extend the library | [docs/extending.md](docs/extending.md) |
|
|
159
|
+
|
|
160
|
+
<!-- The section is required; drop rows for docs this package does not ship. -->
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Viewer Protocol
|
|
2
|
+
|
|
3
|
+
The viewer's server–client protocol: Pydantic contract models, a
|
|
4
|
+
transport-neutral message catalog (JSON Schema) with its protocol bindings,
|
|
5
|
+
fixture scenarios, a mock server for client testing, and the versioned
|
|
6
|
+
protocol bundle the TypeScript client is built from.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The viewer talks to its server over several protocols, and this package
|
|
11
|
+
is the single definition of what is said over all of them. Every message
|
|
12
|
+
is a Pydantic model: unknown fields are rejected, validation is strict,
|
|
13
|
+
and the JSON Schema and OpenAPI documents are generated from the models,
|
|
14
|
+
so the Python server and the TypeScript client cannot disagree about a
|
|
15
|
+
message without a build noticing. With the `mock` extra, the package also
|
|
16
|
+
serves the protocol from USD stages built beforehand, so a client can be
|
|
17
|
+
developed and tested without the real server, and builds the versioned
|
|
18
|
+
bundle of schemas and recorded responses the client is built from.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install vcti-viewer-protocol
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### In `requirements.txt`
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
vcti-viewer-protocol>=0.1.0
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### In `pyproject.toml` dependencies
|
|
33
|
+
|
|
34
|
+
```toml
|
|
35
|
+
dependencies = [
|
|
36
|
+
"vcti-viewer-protocol>=0.1.0",
|
|
37
|
+
]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
Every message is a Pydantic model. Read a study definition received from
|
|
45
|
+
a backend — the field names are the same snake_case names on the wire:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from vcti.viewer.protocol import FilesStudy, StudyDefinitionAdapter
|
|
49
|
+
|
|
50
|
+
definition = StudyDefinitionAdapter.validate_json(
|
|
51
|
+
'{"type": "files", "sources": [{"locator": "bracket/bracket.h5"}]}'
|
|
52
|
+
)
|
|
53
|
+
assert isinstance(definition, FilesStudy)
|
|
54
|
+
print(definition.sources[0].locator)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A field the protocol does not define is rejected, never ignored:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from pydantic import ValidationError
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
StudyDefinitionAdapter.validate_python(
|
|
64
|
+
{"type": "files", "sources": [{"locator": "a.h5", "format": "hdf5"}]}
|
|
65
|
+
)
|
|
66
|
+
except ValidationError as error:
|
|
67
|
+
print(error.errors()[0]["type"]) # extra_forbidden
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Describe a buffer before the client fetches it:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from vcti.viewer.protocol import ArrayDescriptor, ElementType
|
|
74
|
+
|
|
75
|
+
points = ArrayDescriptor(
|
|
76
|
+
path="arrays/points", element_type=ElementType.FLOAT32, width=3, count=1200
|
|
77
|
+
)
|
|
78
|
+
print(points.byte_length) # 14400
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Dependencies
|
|
84
|
+
|
|
85
|
+
- [pydantic](https://pypi.org/project/pydantic/) — the contract models.
|
|
86
|
+
- [vcti-enum](https://pypi.org/project/vcti-enum/) — enumerated fields: the
|
|
87
|
+
model holds the enum member, the wire its encoded string.
|
|
88
|
+
- [vcti-usd-schema-model](https://pypi.org/project/vcti-usd-schema-model/)
|
|
89
|
+
— with the `mock` extra only: the USD stages the mock serves, and
|
|
90
|
+
`usd-core`.
|
|
91
|
+
- [vcti-usd-schema-model-navigator](https://pypi.org/project/vcti-usd-schema-model-navigator/)
|
|
92
|
+
and [vcti-usd-schema-core](https://pypi.org/project/vcti-usd-schema-core/)
|
|
93
|
+
— with the `mock` extra only: each model's navigator, the study that
|
|
94
|
+
lists the models, and the model paths a visibility flag is stored on.
|
|
95
|
+
- [vcti-usd-schema-report](https://pypi.org/project/vcti-usd-schema-report/)
|
|
96
|
+
— with the `mock` extra only: the report's USD stage a workflow is run on,
|
|
97
|
+
which gives slides and sections their paths.
|
|
98
|
+
- [vcti-lookup](https://pypi.org/project/vcti-lookup/) — with the `mock`
|
|
99
|
+
extra only: resolves a selection's rules.
|
|
100
|
+
- [FastAPI](https://pypi.org/project/fastapi/) and
|
|
101
|
+
[uvicorn](https://pypi.org/project/uvicorn/) — with the `mock` extra only:
|
|
102
|
+
the mock server's REST binding, run with `vcti-viewer-mock`, and the
|
|
103
|
+
protocol bundle built from it with `vcti-viewer-bundle`.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Documentation
|
|
108
|
+
|
|
109
|
+
| If you want to… | Read |
|
|
110
|
+
|---|---|
|
|
111
|
+
| Understand the architecture and design decisions | [docs/design/overview.md](docs/design/overview.md) |
|
|
112
|
+
| Navigate and understand the source | [docs/source-guide.md](docs/source-guide.md) |
|
|
113
|
+
| See practical, real-world usage | [docs/patterns.md](docs/patterns.md) |
|
|
114
|
+
| Extend the library | [docs/extending.md](docs/extending.md) |
|
|
115
|
+
|
|
116
|
+
<!-- The section is required; drop rows for docs this package does not ship. -->
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vcti-viewer-protocol"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "The viewer's server–client protocol: Pydantic contract models, a transport-neutral message catalog (JSON Schema) with its protocol bindings, fixture scenarios, a mock server for client testing, and the versioned protocol bundle the TypeScript client is built from"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Visual Collaboration Technologies Inc."}
|
|
12
|
+
]
|
|
13
|
+
license = "LicenseRef-Proprietary"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.12,<3.15"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"pydantic>=2.0",
|
|
24
|
+
"vcti-enum>=2.0.1",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
vcti-viewer-mock = "vcti.viewer.protocol.mock.cli:main"
|
|
29
|
+
vcti-viewer-bundle = "vcti.viewer.protocol.bundle.cli:main"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Repository = "https://github.com/vcollab/vcti-python-viewer-protocol"
|
|
33
|
+
Changelog = "https://github.com/vcollab/vcti-python-viewer-protocol/blob/main/CHANGELOG.md"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
include = ["vcti.viewer.protocol", "vcti.viewer.protocol.*"]
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.package-data]
|
|
40
|
+
"vcti.viewer.protocol" = ["py.typed"]
|
|
41
|
+
|
|
42
|
+
[project.optional-dependencies]
|
|
43
|
+
mock = [
|
|
44
|
+
"vcti-usd-schema-core>=0.7.2",
|
|
45
|
+
"vcti-usd-schema-model>=0.8.0",
|
|
46
|
+
"vcti-usd-schema-model-navigator>=0.7.0",
|
|
47
|
+
"vcti-usd-schema-report>=0.4.0",
|
|
48
|
+
"vcti-lookup>=5.1.1",
|
|
49
|
+
"vcti-predicate>=4.0.0",
|
|
50
|
+
"fastapi>=0.115",
|
|
51
|
+
"uvicorn>=0.30",
|
|
52
|
+
]
|
|
53
|
+
# The mock's tests run in CI, which installs only the test extra.
|
|
54
|
+
test = [
|
|
55
|
+
"pytest",
|
|
56
|
+
"pytest-cov",
|
|
57
|
+
"vcti-usd-schema-core>=0.7.2",
|
|
58
|
+
"vcti-usd-schema-model>=0.8.0",
|
|
59
|
+
"vcti-usd-schema-model-navigator>=0.7.0",
|
|
60
|
+
"vcti-usd-schema-report>=0.4.0",
|
|
61
|
+
"vcti-lookup>=5.1.1",
|
|
62
|
+
"vcti-predicate>=4.0.0",
|
|
63
|
+
"fastapi>=0.115",
|
|
64
|
+
"uvicorn>=0.30",
|
|
65
|
+
"httpx2",
|
|
66
|
+
]
|
|
67
|
+
lint = ["ruff"]
|
|
68
|
+
typecheck = ["mypy"]
|
|
69
|
+
|
|
70
|
+
[tool.pytest.ini_options]
|
|
71
|
+
addopts = "--cov=vcti.viewer.protocol --cov-report=term-missing --cov-fail-under=95"
|
|
72
|
+
|
|
73
|
+
[tool.mypy]
|
|
74
|
+
python_version = "3.12"
|
|
75
|
+
strict = true
|
|
76
|
+
files = ["src"]
|
|
77
|
+
namespace_packages = true
|
|
78
|
+
explicit_package_bases = true
|
|
79
|
+
mypy_path = ["src"]
|
|
80
|
+
|
|
81
|
+
# usd-core ships no type information, so its modules are untyped here.
|
|
82
|
+
[[tool.mypy.overrides]]
|
|
83
|
+
module = ["pxr.*"]
|
|
84
|
+
ignore_missing_imports = true
|
|
85
|
+
|
|
86
|
+
[tool.coverage.run]
|
|
87
|
+
branch = true
|
|
88
|
+
|
|
89
|
+
[tool.coverage.report]
|
|
90
|
+
exclude_also = [
|
|
91
|
+
"raise NotImplementedError",
|
|
92
|
+
"if TYPE_CHECKING:",
|
|
93
|
+
"if __name__ == .__main__.:",
|
|
94
|
+
"@(abc\\.)?abstractmethod",
|
|
95
|
+
"^\\s*\\.\\.\\.\\s*$",
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[tool.ruff]
|
|
99
|
+
target-version = "py312"
|
|
100
|
+
line-length = 99
|
|
101
|
+
|
|
102
|
+
[tool.ruff.lint]
|
|
103
|
+
select = ["E", "F", "W", "I", "UP"]
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Copyright Visual Collaboration Technologies Inc. All Rights Reserved.
|
|
2
|
+
# See LICENSE for details.
|
|
3
|
+
"""vcti.viewer.protocol — the viewer's server–client protocol.
|
|
4
|
+
|
|
5
|
+
Pydantic contract models, a transport-neutral message catalog (JSON Schema)
|
|
6
|
+
with its protocol bindings, fixture scenarios, a mock server for client
|
|
7
|
+
testing, and the versioned protocol bundle the TypeScript client is built
|
|
8
|
+
from.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from importlib.metadata import version
|
|
12
|
+
|
|
13
|
+
from .array import (
|
|
14
|
+
ELEMENT_SIZES,
|
|
15
|
+
INTEGER_TYPES,
|
|
16
|
+
ArrayData,
|
|
17
|
+
ArrayDescriptor,
|
|
18
|
+
BufferArray,
|
|
19
|
+
ElementType,
|
|
20
|
+
InlineArray,
|
|
21
|
+
)
|
|
22
|
+
from .base import (
|
|
23
|
+
ProtocolModel,
|
|
24
|
+
)
|
|
25
|
+
from .error import (
|
|
26
|
+
ErrorBody,
|
|
27
|
+
)
|
|
28
|
+
from .model import (
|
|
29
|
+
Abscissa,
|
|
30
|
+
Assembly,
|
|
31
|
+
Component,
|
|
32
|
+
Death,
|
|
33
|
+
EdgesGeometry,
|
|
34
|
+
EntitySet,
|
|
35
|
+
Extent,
|
|
36
|
+
Fidelity,
|
|
37
|
+
FieldBinding,
|
|
38
|
+
FieldDefinition,
|
|
39
|
+
FieldFamily,
|
|
40
|
+
Frame,
|
|
41
|
+
FrameGroup,
|
|
42
|
+
GeometryBinding,
|
|
43
|
+
History,
|
|
44
|
+
Material,
|
|
45
|
+
MaterialProperty,
|
|
46
|
+
Membership,
|
|
47
|
+
Mesh,
|
|
48
|
+
MeshSequence,
|
|
49
|
+
ModelKind,
|
|
50
|
+
ModelStructure,
|
|
51
|
+
OutlineGeometry,
|
|
52
|
+
PointsGeometry,
|
|
53
|
+
Representation,
|
|
54
|
+
RepresentationKind,
|
|
55
|
+
Slab,
|
|
56
|
+
SourceAssociation,
|
|
57
|
+
SurfaceGeometry,
|
|
58
|
+
)
|
|
59
|
+
from .navigator import (
|
|
60
|
+
Entry,
|
|
61
|
+
EntryTree,
|
|
62
|
+
Model,
|
|
63
|
+
Navigator,
|
|
64
|
+
StudyModels,
|
|
65
|
+
)
|
|
66
|
+
from .primitives import (
|
|
67
|
+
PRIM_PATH_PATTERN,
|
|
68
|
+
RELATIVE_PATH_PATTERN,
|
|
69
|
+
Attributes,
|
|
70
|
+
AttributeValue,
|
|
71
|
+
EntryPath,
|
|
72
|
+
Matrix4,
|
|
73
|
+
ModelPath,
|
|
74
|
+
NonEmptyStr,
|
|
75
|
+
PrimPath,
|
|
76
|
+
Revision,
|
|
77
|
+
Vector3,
|
|
78
|
+
)
|
|
79
|
+
from .report import (
|
|
80
|
+
CreateReport,
|
|
81
|
+
Report,
|
|
82
|
+
ReportList,
|
|
83
|
+
ReportSummary,
|
|
84
|
+
)
|
|
85
|
+
from .scene import (
|
|
86
|
+
Flag,
|
|
87
|
+
Flags,
|
|
88
|
+
RecordedStep,
|
|
89
|
+
Resolved,
|
|
90
|
+
RowVisibility,
|
|
91
|
+
SceneDocument,
|
|
92
|
+
Visibility,
|
|
93
|
+
VisibilityState,
|
|
94
|
+
)
|
|
95
|
+
from .session import (
|
|
96
|
+
Evaluated,
|
|
97
|
+
EvaluateSelection,
|
|
98
|
+
OpenSession,
|
|
99
|
+
Recorded,
|
|
100
|
+
ReturnToRevision,
|
|
101
|
+
SendSteps,
|
|
102
|
+
Session,
|
|
103
|
+
)
|
|
104
|
+
from .step import (
|
|
105
|
+
IDENTIFIER_PATTERN,
|
|
106
|
+
Action,
|
|
107
|
+
AddSection,
|
|
108
|
+
AddSlide,
|
|
109
|
+
DuplicateSection,
|
|
110
|
+
DuplicateSlide,
|
|
111
|
+
FilterModels,
|
|
112
|
+
FilterParts,
|
|
113
|
+
FindModel,
|
|
114
|
+
FindPart,
|
|
115
|
+
Identifier,
|
|
116
|
+
ItemReference,
|
|
117
|
+
Match,
|
|
118
|
+
MoveSection,
|
|
119
|
+
MoveSlide,
|
|
120
|
+
RemoveSection,
|
|
121
|
+
RemoveSlide,
|
|
122
|
+
RenameSection,
|
|
123
|
+
RenameSlide,
|
|
124
|
+
Rule,
|
|
125
|
+
RuleValue,
|
|
126
|
+
Selection,
|
|
127
|
+
SetVisibility,
|
|
128
|
+
ShowSlide,
|
|
129
|
+
Step,
|
|
130
|
+
StepAdapter,
|
|
131
|
+
Title,
|
|
132
|
+
UpdateSlide,
|
|
133
|
+
Variable,
|
|
134
|
+
)
|
|
135
|
+
from .study import (
|
|
136
|
+
FilesStudy,
|
|
137
|
+
Source,
|
|
138
|
+
Study,
|
|
139
|
+
StudyDefinition,
|
|
140
|
+
StudyDefinitionAdapter,
|
|
141
|
+
StudyList,
|
|
142
|
+
StudySummary,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
__version__ = version("vcti-viewer-protocol")
|
|
146
|
+
|
|
147
|
+
__all__ = [
|
|
148
|
+
"__version__",
|
|
149
|
+
"ELEMENT_SIZES",
|
|
150
|
+
"IDENTIFIER_PATTERN",
|
|
151
|
+
"INTEGER_TYPES",
|
|
152
|
+
"PRIM_PATH_PATTERN",
|
|
153
|
+
"RELATIVE_PATH_PATTERN",
|
|
154
|
+
"Abscissa",
|
|
155
|
+
"Action",
|
|
156
|
+
"AddSection",
|
|
157
|
+
"AddSlide",
|
|
158
|
+
"ArrayData",
|
|
159
|
+
"ArrayDescriptor",
|
|
160
|
+
"Assembly",
|
|
161
|
+
"AttributeValue",
|
|
162
|
+
"Attributes",
|
|
163
|
+
"BufferArray",
|
|
164
|
+
"Component",
|
|
165
|
+
"CreateReport",
|
|
166
|
+
"Death",
|
|
167
|
+
"DuplicateSection",
|
|
168
|
+
"DuplicateSlide",
|
|
169
|
+
"EdgesGeometry",
|
|
170
|
+
"ElementType",
|
|
171
|
+
"EntitySet",
|
|
172
|
+
"Entry",
|
|
173
|
+
"EntryPath",
|
|
174
|
+
"EntryTree",
|
|
175
|
+
"ErrorBody",
|
|
176
|
+
"EvaluateSelection",
|
|
177
|
+
"Evaluated",
|
|
178
|
+
"Extent",
|
|
179
|
+
"Fidelity",
|
|
180
|
+
"FieldBinding",
|
|
181
|
+
"FieldDefinition",
|
|
182
|
+
"FieldFamily",
|
|
183
|
+
"FilesStudy",
|
|
184
|
+
"FilterModels",
|
|
185
|
+
"FilterParts",
|
|
186
|
+
"FindModel",
|
|
187
|
+
"FindPart",
|
|
188
|
+
"Flag",
|
|
189
|
+
"Flags",
|
|
190
|
+
"Frame",
|
|
191
|
+
"FrameGroup",
|
|
192
|
+
"GeometryBinding",
|
|
193
|
+
"History",
|
|
194
|
+
"Identifier",
|
|
195
|
+
"InlineArray",
|
|
196
|
+
"ItemReference",
|
|
197
|
+
"Match",
|
|
198
|
+
"Material",
|
|
199
|
+
"MaterialProperty",
|
|
200
|
+
"Matrix4",
|
|
201
|
+
"Membership",
|
|
202
|
+
"Mesh",
|
|
203
|
+
"MeshSequence",
|
|
204
|
+
"Model",
|
|
205
|
+
"ModelKind",
|
|
206
|
+
"ModelPath",
|
|
207
|
+
"ModelStructure",
|
|
208
|
+
"MoveSection",
|
|
209
|
+
"MoveSlide",
|
|
210
|
+
"Navigator",
|
|
211
|
+
"NonEmptyStr",
|
|
212
|
+
"OpenSession",
|
|
213
|
+
"OutlineGeometry",
|
|
214
|
+
"PointsGeometry",
|
|
215
|
+
"PrimPath",
|
|
216
|
+
"ProtocolModel",
|
|
217
|
+
"Recorded",
|
|
218
|
+
"RecordedStep",
|
|
219
|
+
"RemoveSection",
|
|
220
|
+
"RemoveSlide",
|
|
221
|
+
"RenameSection",
|
|
222
|
+
"RenameSlide",
|
|
223
|
+
"Report",
|
|
224
|
+
"ReportList",
|
|
225
|
+
"ReportSummary",
|
|
226
|
+
"Representation",
|
|
227
|
+
"RepresentationKind",
|
|
228
|
+
"Resolved",
|
|
229
|
+
"ReturnToRevision",
|
|
230
|
+
"Revision",
|
|
231
|
+
"RowVisibility",
|
|
232
|
+
"Rule",
|
|
233
|
+
"RuleValue",
|
|
234
|
+
"SceneDocument",
|
|
235
|
+
"Selection",
|
|
236
|
+
"SendSteps",
|
|
237
|
+
"Session",
|
|
238
|
+
"SetVisibility",
|
|
239
|
+
"ShowSlide",
|
|
240
|
+
"Slab",
|
|
241
|
+
"Source",
|
|
242
|
+
"SourceAssociation",
|
|
243
|
+
"Step",
|
|
244
|
+
"StepAdapter",
|
|
245
|
+
"Study",
|
|
246
|
+
"StudyDefinition",
|
|
247
|
+
"StudyDefinitionAdapter",
|
|
248
|
+
"StudyList",
|
|
249
|
+
"StudyModels",
|
|
250
|
+
"StudySummary",
|
|
251
|
+
"SurfaceGeometry",
|
|
252
|
+
"Title",
|
|
253
|
+
"UpdateSlide",
|
|
254
|
+
"Variable",
|
|
255
|
+
"Vector3",
|
|
256
|
+
"Visibility",
|
|
257
|
+
"VisibilityState",
|
|
258
|
+
]
|