spatialdds 0.0.1__tar.gz → 0.2.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.
- spatialdds-0.2.0/PKG-INFO +294 -0
- spatialdds-0.2.0/README.md +270 -0
- spatialdds-0.2.0/pyproject.toml +68 -0
- spatialdds-0.2.0/spatialdds/__init__.py +88 -0
- spatialdds-0.2.0/spatialdds/artifacts/idl/core.idl +340 -0
- spatialdds-0.2.0/spatialdds/artifacts/idl/discovery.idl +238 -0
- spatialdds-0.2.0/spatialdds/artifacts/idl/types.idl +156 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/builtin_Time.json +22 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_anchors_AnchorDelta.json +235 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_anchors_AnchorEntry.json +197 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_anchors_AnchorSet.json +314 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_anchors_AnchorSetRequest.json +20 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_anchors_AnchorSetResponse.json +335 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_argeo_NodeGeo.json +306 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_argeo_QualityRequirements.json +19 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_argeo_VpsRequest.json +298 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_argeo_VpsResponse.json +355 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_common_AssetRef.json +73 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_common_FrameRef.json +56 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_common_KV.json +19 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_common_MetaKV.json +45 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_common_Vec2.json +19 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_Aabb3.json +29 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_BlobChunk.json +38 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_BlobRef.json +23 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_ComponentRef.json +19 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_Edge.json +113 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_EntityBinding.json +283 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_FrameTransform.json +231 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_FramedPose.json +223 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_GeoAnchor.json +254 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_GeoPose.json +157 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_NavSatStatus.json +113 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_Node.json +245 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_PlannedTrajectory.json +214 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_PlannedWaypoint.json +95 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_PoseSE3.json +29 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_SnapshotRequest.json +54 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_SnapshotResponse.json +66 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_TileKey.json +35 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_TileMeta.json +133 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_core_TilePatch.json +122 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_Announce.json +488 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_Capabilities.json +67 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_ContentAnnounce.json +343 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_CoverageElement.json +181 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_CoverageFilter.json +35 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_CoverageHint.json +307 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_CoverageQuery.json +267 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_CoverageResponse.json +264 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_Depart.json +40 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_KV.json +19 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_ProfileSupport.json +33 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_ServiceSummary.json +240 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_TopicMeta.json +41 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_Transform.json +153 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_disco_ValidityWindow.json +42 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_events_CrossingLine.json +235 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_events_SpatialEvent.json +349 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_events_SpatialZone.json +425 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_events_ZoneState.json +132 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_mapping_Edge.json +173 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_mapping_MapAlignment.json +248 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_mapping_MapEvent.json +97 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_mapping_MapMeta.json +471 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_mapping_MapQuality.json +65 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_owm_Entity.json +250 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_owm_ModelCommand.json +124 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_owm_ModelPose.json +74 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_Detection2D.json +77 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_Detection2DSet.json +113 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_Detection3D.json +493 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_Detection3DSet.json +533 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_FusedTrack.json +215 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_FusedTrackSet.json +328 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_Keypoint3D.json +32 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_semantics_KeypointLink.json +23 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_Axis.json +85 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_FrameHeader.json +111 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_FrameQuality.json +36 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_Linspace.json +25 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_ROI.json +91 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_ROIReply.json +136 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_ROIRequest.json +200 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_common_StreamMeta.json +112 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_lidar_LidarDetection.json +34 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_lidar_LidarDetectionSet.json +141 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_lidar_LidarFrame.json +237 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_lidar_LidarMeta.json +235 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rad_RadDetection.json +147 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rad_RadDetectionSet.json +308 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rad_RadSensorMeta.json +202 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rad_RadTensorFrame.json +222 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rad_RadTensorMeta.json +357 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_radio_RadioObservation.json +149 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_radio_RadioScan.json +327 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_radio_RadioSensorMeta.json +214 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rf_beam_RfBeamArraySet.json +285 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rf_beam_RfBeamFrame.json +236 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_rf_beam_RfBeamMeta.json +212 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_vision_CamIntrinsics.json +103 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_vision_Keypoint2D.json +23 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_vision_Track2D.json +46 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_vision_VisionDetections.json +102 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_vision_VisionFrame.json +229 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_sensing_vision_VisionMeta.json +302 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_CameraInfo.json +143 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_Feature2D.json +31 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_FeatureMatch.json +35 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_KeyframeFeatures.json +108 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_Landmark.json +84 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_MatchSet.json +84 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_TrackObs.json +23 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_slam_frontend_Tracklet.json +80 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_vio_FusedState.json +231 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_vio_ImuInfo.json +113 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_vio_ImuSample.json +179 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_vio_MagnetometerSample.json +115 -0
- spatialdds-0.2.0/spatialdds/artifacts/schemas/spatial_vio_SensorFusionSample.json +133 -0
- spatialdds-0.2.0/spatialdds/artifacts/serializer_tables.json +8233 -0
- spatialdds-0.2.0/spatialdds/canonical.py +123 -0
- spatialdds-0.2.0/spatialdds/canonjson.py +74 -0
- spatialdds-0.2.0/spatialdds/client.py +714 -0
- spatialdds-0.2.0/spatialdds/demo/assets/duck.gltf +66 -0
- spatialdds-0.2.0/spatialdds/demo/assets/fountain-label.txt +9 -0
- spatialdds-0.2.0/spatialdds/demo/assets/fountain-marker.gltf +64 -0
- spatialdds-0.2.0/spatialdds/demo/fountain-anchors.mcap +0 -0
- spatialdds-0.2.0/spatialdds/demo/manifests/content-fountain-label.json +59 -0
- spatialdds-0.2.0/spatialdds/demo/manifests/content-fountain-marker.json +59 -0
- spatialdds-0.2.0/spatialdds/errors.py +87 -0
- spatialdds-0.2.0/spatialdds/records.py +608 -0
- spatialdds-0.2.0/spatialdds/serve.py +311 -0
- spatialdds-0.2.0/spatialdds/server/__init__.py +21 -0
- spatialdds-0.2.0/spatialdds/server/gateway.py +695 -0
- spatialdds-0.2.0/spatialdds/server/gw_http.py +741 -0
- spatialdds-0.2.0/spatialdds/server/idlmodel.py +439 -0
- spatialdds-0.2.0/spatialdds/server/pin.py +146 -0
- spatialdds-0.2.0/spatialdds/server/publish.py +374 -0
- spatialdds-0.2.0/spatialdds/server/webjson.py +302 -0
- spatialdds-0.2.0/spatialdds/server/xcdr2.py +442 -0
- spatialdds-0.2.0/spatialdds.egg-info/PKG-INFO +294 -0
- spatialdds-0.2.0/spatialdds.egg-info/SOURCES.txt +145 -0
- spatialdds-0.2.0/spatialdds.egg-info/entry_points.txt +2 -0
- spatialdds-0.2.0/spatialdds.egg-info/requires.txt +7 -0
- spatialdds-0.0.1/PKG-INFO +0 -21
- spatialdds-0.0.1/README.md +0 -9
- spatialdds-0.0.1/pyproject.toml +0 -17
- spatialdds-0.0.1/spatialdds/__init__.py +0 -2
- spatialdds-0.0.1/spatialdds.egg-info/PKG-INFO +0 -21
- spatialdds-0.0.1/spatialdds.egg-info/SOURCES.txt +0 -7
- {spatialdds-0.0.1 → spatialdds-0.2.0}/setup.cfg +0 -0
- {spatialdds-0.0.1 → spatialdds-0.2.0}/spatialdds.egg-info/dependency_links.txt +0 -0
- {spatialdds-0.0.1 → spatialdds-0.2.0}/spatialdds.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spatialdds
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: SpatialDDS over plain HTTPS and a WebSocket: a client for the web binding (Appendix N), and the reference registry behind one command.
|
|
5
|
+
Author: Open AR Cloud
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/OpenArCloud/spatialdds-web
|
|
8
|
+
Project-URL: Specification, https://github.com/OpenArCloud/SpatialDDS-spec
|
|
9
|
+
Keywords: spatialdds,spatial,geopose,anchors,registry,openarcloud
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: requests>=2.25
|
|
19
|
+
Requires-Dist: websockets>=12
|
|
20
|
+
Provides-Extra: server
|
|
21
|
+
Requires-Dist: aiohttp>=3.8; extra == "server"
|
|
22
|
+
Requires-Dist: mcap>=1.1; extra == "server"
|
|
23
|
+
Requires-Dist: jsonschema>=4.0; extra == "server"
|
|
24
|
+
|
|
25
|
+
# spatialdds
|
|
26
|
+
|
|
27
|
+
SpatialDDS over plain HTTPS and a WebSocket: a client for programs, and the
|
|
28
|
+
reference registry behind one command.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install spatialdds # the client: two dependencies
|
|
32
|
+
pip install "spatialdds[server]" # and the registry
|
|
33
|
+
pip install "./lib/spatialdds[server]" # from a checkout of this repo
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`fetch` and a WebSocket really are the whole client -- the endpoint's own
|
|
37
|
+
README shows that in three lines of `curl`, and nothing here replaces it. This
|
|
38
|
+
package is the step after that, when a program wants native values instead of
|
|
39
|
+
canonical JSON, bytes it can trust, refusals it can act on, and records it did
|
|
40
|
+
not have to assemble member by member.
|
|
41
|
+
|
|
42
|
+
**Implements Appendix N as of SpatialDDS-spec `9c3e1f2`.** Package versions and
|
|
43
|
+
specification versions move independently; `spatialdds.SPEC_COMMIT` is the one
|
|
44
|
+
that says what the wire looks like.
|
|
45
|
+
|
|
46
|
+
## Your own registry, in one command
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
python -m spatialdds.serve --authority registry.mytown.example --publish
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
That is a conformant SpatialDDS endpoint: empty, typed, and ready to be
|
|
53
|
+
published into. Its types come from the IDL pinned inside this package at
|
|
54
|
+
`SPEC_COMMIT`, so there is no base recording to find first -- the specification
|
|
55
|
+
is the type source, and `spatialdds.server.pin` is where it lives. State goes
|
|
56
|
+
to a journal (`./spatialdds-registry.mcap` by default, named in the banner)
|
|
57
|
+
which is an ordinary SpatialDDS recording: restart replays it, and any tool
|
|
58
|
+
that reads a recording can read your registry's state.
|
|
59
|
+
|
|
60
|
+
`python -m spatialdds.serve --demo` serves the packaged fountain set instead --
|
|
61
|
+
five surveyed anchors, two content manifests, the assets they name -- with
|
|
62
|
+
publishing on and a token printed. Same boot path, seed data on top.
|
|
63
|
+
|
|
64
|
+
The server half is an extra because being an endpoint is the part you opt
|
|
65
|
+
into: `aiohttp` serves it, `mcap` is the journal, `jsonschema` validates every
|
|
66
|
+
published body before it reaches the wire. Reading somebody else's registry
|
|
67
|
+
needs none of them.
|
|
68
|
+
|
|
69
|
+
## Publishing without writing out eighteen members
|
|
70
|
+
|
|
71
|
+
Appendix N's schemas make every member of a record required, so an `Announce`
|
|
72
|
+
is eighteen members, a `ContentAnnounce` sixteen, a `GeoAnchor` nine. The
|
|
73
|
+
builders take the arguments you actually have:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
import spatialdds as sd
|
|
77
|
+
|
|
78
|
+
ep = sd.connect("http://127.0.0.1:8787", token="tok", scene="mytown")
|
|
79
|
+
ep.publish_service(service_id="mytown-vps", kind="VPS",
|
|
80
|
+
coverage=sd.circle(30.2849, -97.7393, 500))
|
|
81
|
+
ep.publish_content(content_id="duck", title="Duck", position=(30.2849, -97.7393),
|
|
82
|
+
asset="https://cdn.example/duck.gltf", sha256=digest)
|
|
83
|
+
ep.publish_anchor("anchor/duck-perch", lat=30.2849, lon=-97.7393,
|
|
84
|
+
method="VisualFix", sigma_enu_m=(0.25, 0.25, 0.5),
|
|
85
|
+
content="duck")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`publish_service` and `publish_content` are two PUTs each -- the manifest
|
|
89
|
+
first, then the record that points at it -- and return what `publish` returns,
|
|
90
|
+
with the manifest's own result on `.manifest`.
|
|
91
|
+
|
|
92
|
+
The builders are also usable on their own: `sd.service_announce`,
|
|
93
|
+
`sd.content_announce`, `sd.content_manifest`, `sd.geo_anchor`, with
|
|
94
|
+
`sd.circle`, `sd.bbox`, `sd.geopose`, `sd.cov_pos3`, `sd.cov_none`,
|
|
95
|
+
`sd.frame`,
|
|
96
|
+
`sd.earth_fixed`, `sd.stamp`, `sd.topic`, `sd.asset`, `sd.cells`,
|
|
97
|
+
`sd.service_uri` and `sd.content_uri`. Each returns a plain dict in canonical
|
|
98
|
+
form, publishable as it stands and dumpable as the authoring JSON this
|
|
99
|
+
repository's tools read. `spatialdds.records` is the module they live in.
|
|
100
|
+
|
|
101
|
+
**What they fill in, and what they refuse to.** Three conventions, each
|
|
102
|
+
documented where it is applied: a stamp of now unless you pass `when=`, an
|
|
103
|
+
earth-fixed frame unless you pass one, and URIs assembled under a stated
|
|
104
|
+
authority -- never a guessed one. `ep.publish_*` gets the authority from the
|
|
105
|
+
endpoint itself (`ep.authority`, which asks the resolver metadata, then the
|
|
106
|
+
endpoint's own 404 document at `/`, then the address you connected to). What
|
|
107
|
+
they never fill is **identity**: `provider_id` and `org` are yours to state,
|
|
108
|
+
because a library that invented a provider id would be inventing provenance.
|
|
109
|
+
|
|
110
|
+
`GeoAnchor.checksum` is required by 1.8 and specified by nobody
|
|
111
|
+
(spatialdds-web finding 31). The builder fills it with the SHA-256 of the
|
|
112
|
+
record's own canonical JSON with `checksum` emptied -- a convention, chosen
|
|
113
|
+
because a reader can recompute it from what was served. If the specification
|
|
114
|
+
settles the semantics, this changes.
|
|
115
|
+
|
|
116
|
+
The full map of builder argument to IDL member, including every member filled
|
|
117
|
+
by convention, is printed by `python3 gates/builders.py --census` in the
|
|
118
|
+
repository.
|
|
119
|
+
|
|
120
|
+
## What it is for: the lift
|
|
121
|
+
|
|
122
|
+
An endpoint serves Appendix N.1 canonical JSON, and three rules separate that
|
|
123
|
+
from the values a program wants. All three are easy to get subtly wrong:
|
|
124
|
+
|
|
125
|
+
* `int64` and `uint64` are **unconditional decimal strings**. A client that
|
|
126
|
+
treats `stamp.sec` as a string gets surprising comparisons; one that calls
|
|
127
|
+
`int()` on every string corrupts identifiers.
|
|
128
|
+
* An octet run is **base64**.
|
|
129
|
+
* A union is tagged on `"type"`, and carries `_discriminator` once lifted.
|
|
130
|
+
|
|
131
|
+
These are not this library's rules -- they are the reference gateway's, and
|
|
132
|
+
the repository gates that the two agree by lifting every record in both
|
|
133
|
+
committed recordings with each implementation and comparing. Same rules, same
|
|
134
|
+
results, different source of the type information: the server reads the IDL,
|
|
135
|
+
and a client reading a remote endpoint has none, so this reads the generated
|
|
136
|
+
serializer tables that travel with the package. That gate earned its keep on
|
|
137
|
+
2026-10-15, when the disagreement it found turned out to be in the server.
|
|
138
|
+
|
|
139
|
+
A lifted union keeps `_discriminator` rather than `"type"`, because that is
|
|
140
|
+
what the lift produces and inventing a fourth shape would be a fourth rule.
|
|
141
|
+
Pass `lifted=False` to `connect()` to get the canonical JSON untouched.
|
|
142
|
+
|
|
143
|
+
## The three bars
|
|
144
|
+
|
|
145
|
+
Each one runs on its own, pasted into a fresh shell with nothing else run
|
|
146
|
+
first, which is why the serve line all three need is printed here rather than
|
|
147
|
+
assumed. `gates/library.py` executes each bar against its own fresh endpoint
|
|
148
|
+
and compares its output to what is printed below it.
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
python3 tools/run_gateway.py --mcap samples/fountain-anchors.mcap \
|
|
152
|
+
--manifests samples/manifests --assets samples/assets \
|
|
153
|
+
--publish --token not-a-secret --public-url https://demo.spatialdds.org
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Hello spatial, six lines.** Discover, subscribe, and read typed samples until
|
|
157
|
+
the latched set is complete.
|
|
158
|
+
|
|
159
|
+
<!-- bar: read -->
|
|
160
|
+
```python
|
|
161
|
+
import spatialdds as sd
|
|
162
|
+
ep = sd.connect("http://127.0.0.1:8787")
|
|
163
|
+
svc = ep.search(geohash="9v6krc")[0]
|
|
164
|
+
for ev in svc.topic("geo_anchor").subscribe(timeout=10):
|
|
165
|
+
if isinstance(ev, sd.EndOfReplay): print("latched set complete:", ev.replayed); break
|
|
166
|
+
print(" ", ev.key, ev.data["method"], ev.data["geopose"]["stamp"]["sec"])
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```console
|
|
170
|
+
anchor/fountain-north-rim Surveyed 1791559800
|
|
171
|
+
anchor/fountain-south-rim VisualFix 1791559800
|
|
172
|
+
anchor/fountain-east-rim VisualFix 1791559800
|
|
173
|
+
anchor/fountain-west-rim VisualFix 1791559800
|
|
174
|
+
anchor/fountain-plaque GNSS 1791559800
|
|
175
|
+
latched set complete: 5
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`geopose.stamp.sec` arrives as an `int` there, not as `"1791559800"`. That is
|
|
179
|
+
the whole lift, in the one place a reader will notice it.
|
|
180
|
+
|
|
181
|
+
**Publish the duck, four lines.** The content manifest, and the announce that
|
|
182
|
+
places it.
|
|
183
|
+
|
|
184
|
+
<!-- bar: publish -->
|
|
185
|
+
```python
|
|
186
|
+
import json, spatialdds as sd
|
|
187
|
+
ep = sd.connect("http://127.0.0.1:8787", token="not-a-secret")
|
|
188
|
+
d = json.load(open("samples/duck.input.json"))
|
|
189
|
+
print("manifest", ep.publish_manifest(d["manifest"]).created, "| announce", ep.publish(topic=d["announce"]["path"], key=d["announce"]["key"], record=d["announce"]["record"]).created)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```console
|
|
193
|
+
manifest True | announce True
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Resolve and verify, two lines.** The URI resolved per the endpoint's own
|
|
197
|
+
§7.5.2 metadata, and the asset's bytes checked against the hash the manifest
|
|
198
|
+
declared.
|
|
199
|
+
|
|
200
|
+
<!-- bar: resolve -->
|
|
201
|
+
```python
|
|
202
|
+
import json, spatialdds as sd
|
|
203
|
+
ep = sd.connect("http://127.0.0.1:8787", token="not-a-secret"); ep.publish_manifest(json.load(open("samples/duck.input.json"))["manifest"]); print(len(ep.resolve("spatialdds://demo.spatialdds.org/south-mall/content/duck").fetch_asset()), "bytes verified")
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
```console
|
|
207
|
+
1432 bytes verified
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The duck's manifest is published on the first line because these two lines
|
|
211
|
+
have to stand alone. Against an endpoint that already holds the manifest, that
|
|
212
|
+
call goes away and the bar is one line.
|
|
213
|
+
|
|
214
|
+
## The surface
|
|
215
|
+
|
|
216
|
+
| | |
|
|
217
|
+
| --- | --- |
|
|
218
|
+
| `sd.connect(base, token=None, verify_integrity=True, timeout=15.0, lifted=True, scene="default", authority=None)` | an `Endpoint`; nothing is fetched until you ask |
|
|
219
|
+
| `ep.search(geohash=None, kinds=None)` | §3.3.0 search → a list of `Hit` |
|
|
220
|
+
| `ep.near(lat, lon, radius_m)` | a helper over `search`, never a second protocol |
|
|
221
|
+
| `ep.resolve(uri)` | §7.5.2 resolution → `Resolved` |
|
|
222
|
+
| `ep.authority` | the DNS name the endpoint says it answers as |
|
|
223
|
+
| `ep.publish(topic=, key=, record=, if_match=None)` | PUT one instance → `Written` |
|
|
224
|
+
| `ep.publish_manifest(record)` | PUT a manifest, keyed by its own `id` |
|
|
225
|
+
| `ep.publish_service(service_id=, kind=, coverage=, manifest=None, ...)` | build and PUT an announce, and its manifest if given |
|
|
226
|
+
| `ep.publish_content(content_id=, position=, asset=, ...)` | build and PUT a content manifest and its announce |
|
|
227
|
+
| `ep.publish_anchor(anchor_id, lat=, lon=, method=, content=None, ...)` | build and PUT an anchor, optionally naming content |
|
|
228
|
+
| `ep.withdraw(topic=, key=)` | DELETE: leaves the latched set and disposes |
|
|
229
|
+
| `hit.service_id`, `.kind`, `.coverage`, `.topics` | the typed service manifest |
|
|
230
|
+
| `hit.topic(type_name)` | a `Topic`, URL taken from the manifest, never built |
|
|
231
|
+
| `hit.reaches(lat, lon, radius_m)` | does the declared coverage reach a point |
|
|
232
|
+
| `topic.type`, `.url`, `.name`, `.durability`, `.access`, `.fqn` | what the manifest said |
|
|
233
|
+
| `topic.latched()` | every live instance, lifted |
|
|
234
|
+
| `topic.instance(key)` | one instance, key percent-encoded per N.3 |
|
|
235
|
+
| `topic.subscribe(timeout=None)` | a generator of `Sample` / `Dispose` / `EndOfReplay` / `Liveliness` |
|
|
236
|
+
| `resolved.doc`, `.uri`, `.etag`, `.assets` | the resolved manifest |
|
|
237
|
+
| `resolved.asset_url(i)`, `.fetch_asset(i)` | the URL it would fetch, and the verified bytes |
|
|
238
|
+
| `written.doc`, `.etag`, `.created`, `.manifest` | what a publish returned |
|
|
239
|
+
| `sd.records` | the builders, listed above |
|
|
240
|
+
| `sd.lift(fqn, doc)` | the lift on its own, for JSON you already have |
|
|
241
|
+
| `sd.SPEC_COMMIT`, `sd.APPENDIX_N`, `sd.__version__` | what this speaks |
|
|
242
|
+
|
|
243
|
+
`ep.near()` picks a geohash precision whose cell covers the radius, encodes the
|
|
244
|
+
centre and eight points around the query circle so the covering cells are found
|
|
245
|
+
without neighbour arithmetic, searches each distinct cell, and filters the hits
|
|
246
|
+
by their own declared coverage. Everything it sends is an ordinary §3.3.0
|
|
247
|
+
geohash query.
|
|
248
|
+
|
|
249
|
+
`topic.url` and `assets[].uri` are followed by different rules, deliberately. A
|
|
250
|
+
topic URL comes out of a service manifest this endpoint served, so its path is
|
|
251
|
+
this endpoint's and the library follows it by path -- which is what makes a
|
|
252
|
+
registry advertising a DNS name usable from a laptop. An asset URI is an
|
|
253
|
+
ordinary web URL that usually points somewhere else entirely, so it is fetched
|
|
254
|
+
exactly as written; the one exception is an asset on the endpoint's own
|
|
255
|
+
advertised authority, which is rebased onto the endpoint you are talking to.
|
|
256
|
+
|
|
257
|
+
## Errors
|
|
258
|
+
|
|
259
|
+
One family, built from the endpoint's own N.8 problem documents — `status`,
|
|
260
|
+
`type`, `detail` carried, not re-invented. Everything below derives from
|
|
261
|
+
`SpatialDDSError`, so one `except` catches the lot.
|
|
262
|
+
|
|
263
|
+
| | |
|
|
264
|
+
| --- | --- |
|
|
265
|
+
| `Unreachable` | the endpoint did not answer; names the URL and the serve line |
|
|
266
|
+
| `Unauthorized` | 401; says to pass `token=` and where the token is printed |
|
|
267
|
+
| `SurfaceOff` | 405 from a write verb; says to start with `--publish` |
|
|
268
|
+
| `Problem` | any other refusal, with `.status`, `.type`, `.slug`, `.detail` |
|
|
269
|
+
| `IntegrityError` | fetched bytes do not match the declared hash |
|
|
270
|
+
| `UnverifiableIntegrity` | the declared value is not a hash this library can check |
|
|
271
|
+
|
|
272
|
+
That last one is the unusual one and it is deliberate. SpatialDDS counts "a
|
|
273
|
+
checksum field in the body" as a §7.5.2 integrity signal, but nothing specifies
|
|
274
|
+
what such a field digests or in what form (spatialdds-web finding 31). Where a
|
|
275
|
+
declared value does not parse as a SHA-256 of the asset's bytes, this library
|
|
276
|
+
raises rather than reporting a check it did not perform.
|
|
277
|
+
|
|
278
|
+
## Integrity by default
|
|
279
|
+
|
|
280
|
+
Latched reads revalidate with the ETag the endpoint gave; `fetch_asset` checks
|
|
281
|
+
the bytes. Opting out exists and is loud: `verify_integrity=False`, at the call
|
|
282
|
+
site, nowhere else.
|
|
283
|
+
|
|
284
|
+
## Not in 0.2.0
|
|
285
|
+
|
|
286
|
+
Stated so nobody waits for them: no async API, no caching beyond ETag
|
|
287
|
+
revalidation, no retry policy, no MCAP tooling beyond the journal the server
|
|
288
|
+
writes, and no DDS dependency of any kind. The wire is HTTP and a WebSocket.
|
|
289
|
+
|
|
290
|
+
On the registry, four things are deferred rather than missing, and the same
|
|
291
|
+
four are on the 1.9 candidates list: **leases** (nothing expires; `ttl_sec` is
|
|
292
|
+
advice to caches), **per-provider scopes** (one token, one operator),
|
|
293
|
+
**server-set identity** (`provider_id` is whatever the publisher says), and
|
|
294
|
+
**upstream subscriptions** (a registry does not follow another registry).
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# spatialdds
|
|
2
|
+
|
|
3
|
+
SpatialDDS over plain HTTPS and a WebSocket: a client for programs, and the
|
|
4
|
+
reference registry behind one command.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
pip install spatialdds # the client: two dependencies
|
|
8
|
+
pip install "spatialdds[server]" # and the registry
|
|
9
|
+
pip install "./lib/spatialdds[server]" # from a checkout of this repo
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`fetch` and a WebSocket really are the whole client -- the endpoint's own
|
|
13
|
+
README shows that in three lines of `curl`, and nothing here replaces it. This
|
|
14
|
+
package is the step after that, when a program wants native values instead of
|
|
15
|
+
canonical JSON, bytes it can trust, refusals it can act on, and records it did
|
|
16
|
+
not have to assemble member by member.
|
|
17
|
+
|
|
18
|
+
**Implements Appendix N as of SpatialDDS-spec `9c3e1f2`.** Package versions and
|
|
19
|
+
specification versions move independently; `spatialdds.SPEC_COMMIT` is the one
|
|
20
|
+
that says what the wire looks like.
|
|
21
|
+
|
|
22
|
+
## Your own registry, in one command
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
python -m spatialdds.serve --authority registry.mytown.example --publish
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
That is a conformant SpatialDDS endpoint: empty, typed, and ready to be
|
|
29
|
+
published into. Its types come from the IDL pinned inside this package at
|
|
30
|
+
`SPEC_COMMIT`, so there is no base recording to find first -- the specification
|
|
31
|
+
is the type source, and `spatialdds.server.pin` is where it lives. State goes
|
|
32
|
+
to a journal (`./spatialdds-registry.mcap` by default, named in the banner)
|
|
33
|
+
which is an ordinary SpatialDDS recording: restart replays it, and any tool
|
|
34
|
+
that reads a recording can read your registry's state.
|
|
35
|
+
|
|
36
|
+
`python -m spatialdds.serve --demo` serves the packaged fountain set instead --
|
|
37
|
+
five surveyed anchors, two content manifests, the assets they name -- with
|
|
38
|
+
publishing on and a token printed. Same boot path, seed data on top.
|
|
39
|
+
|
|
40
|
+
The server half is an extra because being an endpoint is the part you opt
|
|
41
|
+
into: `aiohttp` serves it, `mcap` is the journal, `jsonschema` validates every
|
|
42
|
+
published body before it reaches the wire. Reading somebody else's registry
|
|
43
|
+
needs none of them.
|
|
44
|
+
|
|
45
|
+
## Publishing without writing out eighteen members
|
|
46
|
+
|
|
47
|
+
Appendix N's schemas make every member of a record required, so an `Announce`
|
|
48
|
+
is eighteen members, a `ContentAnnounce` sixteen, a `GeoAnchor` nine. The
|
|
49
|
+
builders take the arguments you actually have:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import spatialdds as sd
|
|
53
|
+
|
|
54
|
+
ep = sd.connect("http://127.0.0.1:8787", token="tok", scene="mytown")
|
|
55
|
+
ep.publish_service(service_id="mytown-vps", kind="VPS",
|
|
56
|
+
coverage=sd.circle(30.2849, -97.7393, 500))
|
|
57
|
+
ep.publish_content(content_id="duck", title="Duck", position=(30.2849, -97.7393),
|
|
58
|
+
asset="https://cdn.example/duck.gltf", sha256=digest)
|
|
59
|
+
ep.publish_anchor("anchor/duck-perch", lat=30.2849, lon=-97.7393,
|
|
60
|
+
method="VisualFix", sigma_enu_m=(0.25, 0.25, 0.5),
|
|
61
|
+
content="duck")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`publish_service` and `publish_content` are two PUTs each -- the manifest
|
|
65
|
+
first, then the record that points at it -- and return what `publish` returns,
|
|
66
|
+
with the manifest's own result on `.manifest`.
|
|
67
|
+
|
|
68
|
+
The builders are also usable on their own: `sd.service_announce`,
|
|
69
|
+
`sd.content_announce`, `sd.content_manifest`, `sd.geo_anchor`, with
|
|
70
|
+
`sd.circle`, `sd.bbox`, `sd.geopose`, `sd.cov_pos3`, `sd.cov_none`,
|
|
71
|
+
`sd.frame`,
|
|
72
|
+
`sd.earth_fixed`, `sd.stamp`, `sd.topic`, `sd.asset`, `sd.cells`,
|
|
73
|
+
`sd.service_uri` and `sd.content_uri`. Each returns a plain dict in canonical
|
|
74
|
+
form, publishable as it stands and dumpable as the authoring JSON this
|
|
75
|
+
repository's tools read. `spatialdds.records` is the module they live in.
|
|
76
|
+
|
|
77
|
+
**What they fill in, and what they refuse to.** Three conventions, each
|
|
78
|
+
documented where it is applied: a stamp of now unless you pass `when=`, an
|
|
79
|
+
earth-fixed frame unless you pass one, and URIs assembled under a stated
|
|
80
|
+
authority -- never a guessed one. `ep.publish_*` gets the authority from the
|
|
81
|
+
endpoint itself (`ep.authority`, which asks the resolver metadata, then the
|
|
82
|
+
endpoint's own 404 document at `/`, then the address you connected to). What
|
|
83
|
+
they never fill is **identity**: `provider_id` and `org` are yours to state,
|
|
84
|
+
because a library that invented a provider id would be inventing provenance.
|
|
85
|
+
|
|
86
|
+
`GeoAnchor.checksum` is required by 1.8 and specified by nobody
|
|
87
|
+
(spatialdds-web finding 31). The builder fills it with the SHA-256 of the
|
|
88
|
+
record's own canonical JSON with `checksum` emptied -- a convention, chosen
|
|
89
|
+
because a reader can recompute it from what was served. If the specification
|
|
90
|
+
settles the semantics, this changes.
|
|
91
|
+
|
|
92
|
+
The full map of builder argument to IDL member, including every member filled
|
|
93
|
+
by convention, is printed by `python3 gates/builders.py --census` in the
|
|
94
|
+
repository.
|
|
95
|
+
|
|
96
|
+
## What it is for: the lift
|
|
97
|
+
|
|
98
|
+
An endpoint serves Appendix N.1 canonical JSON, and three rules separate that
|
|
99
|
+
from the values a program wants. All three are easy to get subtly wrong:
|
|
100
|
+
|
|
101
|
+
* `int64` and `uint64` are **unconditional decimal strings**. A client that
|
|
102
|
+
treats `stamp.sec` as a string gets surprising comparisons; one that calls
|
|
103
|
+
`int()` on every string corrupts identifiers.
|
|
104
|
+
* An octet run is **base64**.
|
|
105
|
+
* A union is tagged on `"type"`, and carries `_discriminator` once lifted.
|
|
106
|
+
|
|
107
|
+
These are not this library's rules -- they are the reference gateway's, and
|
|
108
|
+
the repository gates that the two agree by lifting every record in both
|
|
109
|
+
committed recordings with each implementation and comparing. Same rules, same
|
|
110
|
+
results, different source of the type information: the server reads the IDL,
|
|
111
|
+
and a client reading a remote endpoint has none, so this reads the generated
|
|
112
|
+
serializer tables that travel with the package. That gate earned its keep on
|
|
113
|
+
2026-10-15, when the disagreement it found turned out to be in the server.
|
|
114
|
+
|
|
115
|
+
A lifted union keeps `_discriminator` rather than `"type"`, because that is
|
|
116
|
+
what the lift produces and inventing a fourth shape would be a fourth rule.
|
|
117
|
+
Pass `lifted=False` to `connect()` to get the canonical JSON untouched.
|
|
118
|
+
|
|
119
|
+
## The three bars
|
|
120
|
+
|
|
121
|
+
Each one runs on its own, pasted into a fresh shell with nothing else run
|
|
122
|
+
first, which is why the serve line all three need is printed here rather than
|
|
123
|
+
assumed. `gates/library.py` executes each bar against its own fresh endpoint
|
|
124
|
+
and compares its output to what is printed below it.
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
python3 tools/run_gateway.py --mcap samples/fountain-anchors.mcap \
|
|
128
|
+
--manifests samples/manifests --assets samples/assets \
|
|
129
|
+
--publish --token not-a-secret --public-url https://demo.spatialdds.org
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Hello spatial, six lines.** Discover, subscribe, and read typed samples until
|
|
133
|
+
the latched set is complete.
|
|
134
|
+
|
|
135
|
+
<!-- bar: read -->
|
|
136
|
+
```python
|
|
137
|
+
import spatialdds as sd
|
|
138
|
+
ep = sd.connect("http://127.0.0.1:8787")
|
|
139
|
+
svc = ep.search(geohash="9v6krc")[0]
|
|
140
|
+
for ev in svc.topic("geo_anchor").subscribe(timeout=10):
|
|
141
|
+
if isinstance(ev, sd.EndOfReplay): print("latched set complete:", ev.replayed); break
|
|
142
|
+
print(" ", ev.key, ev.data["method"], ev.data["geopose"]["stamp"]["sec"])
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```console
|
|
146
|
+
anchor/fountain-north-rim Surveyed 1791559800
|
|
147
|
+
anchor/fountain-south-rim VisualFix 1791559800
|
|
148
|
+
anchor/fountain-east-rim VisualFix 1791559800
|
|
149
|
+
anchor/fountain-west-rim VisualFix 1791559800
|
|
150
|
+
anchor/fountain-plaque GNSS 1791559800
|
|
151
|
+
latched set complete: 5
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`geopose.stamp.sec` arrives as an `int` there, not as `"1791559800"`. That is
|
|
155
|
+
the whole lift, in the one place a reader will notice it.
|
|
156
|
+
|
|
157
|
+
**Publish the duck, four lines.** The content manifest, and the announce that
|
|
158
|
+
places it.
|
|
159
|
+
|
|
160
|
+
<!-- bar: publish -->
|
|
161
|
+
```python
|
|
162
|
+
import json, spatialdds as sd
|
|
163
|
+
ep = sd.connect("http://127.0.0.1:8787", token="not-a-secret")
|
|
164
|
+
d = json.load(open("samples/duck.input.json"))
|
|
165
|
+
print("manifest", ep.publish_manifest(d["manifest"]).created, "| announce", ep.publish(topic=d["announce"]["path"], key=d["announce"]["key"], record=d["announce"]["record"]).created)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```console
|
|
169
|
+
manifest True | announce True
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Resolve and verify, two lines.** The URI resolved per the endpoint's own
|
|
173
|
+
§7.5.2 metadata, and the asset's bytes checked against the hash the manifest
|
|
174
|
+
declared.
|
|
175
|
+
|
|
176
|
+
<!-- bar: resolve -->
|
|
177
|
+
```python
|
|
178
|
+
import json, spatialdds as sd
|
|
179
|
+
ep = sd.connect("http://127.0.0.1:8787", token="not-a-secret"); ep.publish_manifest(json.load(open("samples/duck.input.json"))["manifest"]); print(len(ep.resolve("spatialdds://demo.spatialdds.org/south-mall/content/duck").fetch_asset()), "bytes verified")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
```console
|
|
183
|
+
1432 bytes verified
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The duck's manifest is published on the first line because these two lines
|
|
187
|
+
have to stand alone. Against an endpoint that already holds the manifest, that
|
|
188
|
+
call goes away and the bar is one line.
|
|
189
|
+
|
|
190
|
+
## The surface
|
|
191
|
+
|
|
192
|
+
| | |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| `sd.connect(base, token=None, verify_integrity=True, timeout=15.0, lifted=True, scene="default", authority=None)` | an `Endpoint`; nothing is fetched until you ask |
|
|
195
|
+
| `ep.search(geohash=None, kinds=None)` | §3.3.0 search → a list of `Hit` |
|
|
196
|
+
| `ep.near(lat, lon, radius_m)` | a helper over `search`, never a second protocol |
|
|
197
|
+
| `ep.resolve(uri)` | §7.5.2 resolution → `Resolved` |
|
|
198
|
+
| `ep.authority` | the DNS name the endpoint says it answers as |
|
|
199
|
+
| `ep.publish(topic=, key=, record=, if_match=None)` | PUT one instance → `Written` |
|
|
200
|
+
| `ep.publish_manifest(record)` | PUT a manifest, keyed by its own `id` |
|
|
201
|
+
| `ep.publish_service(service_id=, kind=, coverage=, manifest=None, ...)` | build and PUT an announce, and its manifest if given |
|
|
202
|
+
| `ep.publish_content(content_id=, position=, asset=, ...)` | build and PUT a content manifest and its announce |
|
|
203
|
+
| `ep.publish_anchor(anchor_id, lat=, lon=, method=, content=None, ...)` | build and PUT an anchor, optionally naming content |
|
|
204
|
+
| `ep.withdraw(topic=, key=)` | DELETE: leaves the latched set and disposes |
|
|
205
|
+
| `hit.service_id`, `.kind`, `.coverage`, `.topics` | the typed service manifest |
|
|
206
|
+
| `hit.topic(type_name)` | a `Topic`, URL taken from the manifest, never built |
|
|
207
|
+
| `hit.reaches(lat, lon, radius_m)` | does the declared coverage reach a point |
|
|
208
|
+
| `topic.type`, `.url`, `.name`, `.durability`, `.access`, `.fqn` | what the manifest said |
|
|
209
|
+
| `topic.latched()` | every live instance, lifted |
|
|
210
|
+
| `topic.instance(key)` | one instance, key percent-encoded per N.3 |
|
|
211
|
+
| `topic.subscribe(timeout=None)` | a generator of `Sample` / `Dispose` / `EndOfReplay` / `Liveliness` |
|
|
212
|
+
| `resolved.doc`, `.uri`, `.etag`, `.assets` | the resolved manifest |
|
|
213
|
+
| `resolved.asset_url(i)`, `.fetch_asset(i)` | the URL it would fetch, and the verified bytes |
|
|
214
|
+
| `written.doc`, `.etag`, `.created`, `.manifest` | what a publish returned |
|
|
215
|
+
| `sd.records` | the builders, listed above |
|
|
216
|
+
| `sd.lift(fqn, doc)` | the lift on its own, for JSON you already have |
|
|
217
|
+
| `sd.SPEC_COMMIT`, `sd.APPENDIX_N`, `sd.__version__` | what this speaks |
|
|
218
|
+
|
|
219
|
+
`ep.near()` picks a geohash precision whose cell covers the radius, encodes the
|
|
220
|
+
centre and eight points around the query circle so the covering cells are found
|
|
221
|
+
without neighbour arithmetic, searches each distinct cell, and filters the hits
|
|
222
|
+
by their own declared coverage. Everything it sends is an ordinary §3.3.0
|
|
223
|
+
geohash query.
|
|
224
|
+
|
|
225
|
+
`topic.url` and `assets[].uri` are followed by different rules, deliberately. A
|
|
226
|
+
topic URL comes out of a service manifest this endpoint served, so its path is
|
|
227
|
+
this endpoint's and the library follows it by path -- which is what makes a
|
|
228
|
+
registry advertising a DNS name usable from a laptop. An asset URI is an
|
|
229
|
+
ordinary web URL that usually points somewhere else entirely, so it is fetched
|
|
230
|
+
exactly as written; the one exception is an asset on the endpoint's own
|
|
231
|
+
advertised authority, which is rebased onto the endpoint you are talking to.
|
|
232
|
+
|
|
233
|
+
## Errors
|
|
234
|
+
|
|
235
|
+
One family, built from the endpoint's own N.8 problem documents — `status`,
|
|
236
|
+
`type`, `detail` carried, not re-invented. Everything below derives from
|
|
237
|
+
`SpatialDDSError`, so one `except` catches the lot.
|
|
238
|
+
|
|
239
|
+
| | |
|
|
240
|
+
| --- | --- |
|
|
241
|
+
| `Unreachable` | the endpoint did not answer; names the URL and the serve line |
|
|
242
|
+
| `Unauthorized` | 401; says to pass `token=` and where the token is printed |
|
|
243
|
+
| `SurfaceOff` | 405 from a write verb; says to start with `--publish` |
|
|
244
|
+
| `Problem` | any other refusal, with `.status`, `.type`, `.slug`, `.detail` |
|
|
245
|
+
| `IntegrityError` | fetched bytes do not match the declared hash |
|
|
246
|
+
| `UnverifiableIntegrity` | the declared value is not a hash this library can check |
|
|
247
|
+
|
|
248
|
+
That last one is the unusual one and it is deliberate. SpatialDDS counts "a
|
|
249
|
+
checksum field in the body" as a §7.5.2 integrity signal, but nothing specifies
|
|
250
|
+
what such a field digests or in what form (spatialdds-web finding 31). Where a
|
|
251
|
+
declared value does not parse as a SHA-256 of the asset's bytes, this library
|
|
252
|
+
raises rather than reporting a check it did not perform.
|
|
253
|
+
|
|
254
|
+
## Integrity by default
|
|
255
|
+
|
|
256
|
+
Latched reads revalidate with the ETag the endpoint gave; `fetch_asset` checks
|
|
257
|
+
the bytes. Opting out exists and is loud: `verify_integrity=False`, at the call
|
|
258
|
+
site, nowhere else.
|
|
259
|
+
|
|
260
|
+
## Not in 0.2.0
|
|
261
|
+
|
|
262
|
+
Stated so nobody waits for them: no async API, no caching beyond ETag
|
|
263
|
+
revalidation, no retry policy, no MCAP tooling beyond the journal the server
|
|
264
|
+
writes, and no DDS dependency of any kind. The wire is HTTP and a WebSocket.
|
|
265
|
+
|
|
266
|
+
On the registry, four things are deferred rather than missing, and the same
|
|
267
|
+
four are on the 1.9 candidates list: **leases** (nothing expires; `ttl_sec` is
|
|
268
|
+
advice to caches), **per-provider scopes** (one token, one operator),
|
|
269
|
+
**server-set identity** (`provider_id` is whatever the publisher says), and
|
|
270
|
+
**upstream subscriptions** (a registry does not follow another registry).
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "spatialdds"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "SpatialDDS over plain HTTPS and a WebSocket: a client for the web binding (Appendix N), and the reference registry behind one command."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "Open AR Cloud" }]
|
|
13
|
+
keywords = ["spatialdds", "spatial", "geopose", "anchors", "registry", "openarcloud"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Topic :: Scientific/Engineering :: GIS",
|
|
21
|
+
]
|
|
22
|
+
# Two, and no more, for reading and publishing. The wire is HTTP and a
|
|
23
|
+
# WebSocket; anything else would be this library's opinion rather than the
|
|
24
|
+
# binding's requirement.
|
|
25
|
+
dependencies = ["requests>=2.25", "websockets>=12"]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
# Being an endpoint is the part you opt into. aiohttp serves it, mcap is the
|
|
29
|
+
# format a registry's state lives in, and jsonschema validates every published
|
|
30
|
+
# body against the vendored schemas before it reaches the wire. That last one
|
|
31
|
+
# is not optional in any useful sense: without it the write surface refuses
|
|
32
|
+
# every publish with a 500 rather than accept something unvalidated, so
|
|
33
|
+
# leaving it out of this group would ship a registry nobody can publish into.
|
|
34
|
+
server = ["aiohttp>=3.8", "mcap>=1.1", "jsonschema>=4.0"]
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
spatialdds-serve = "spatialdds.serve:main"
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://github.com/OpenArCloud/spatialdds-web"
|
|
41
|
+
Specification = "https://github.com/OpenArCloud/SpatialDDS-spec"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools]
|
|
44
|
+
packages = ["spatialdds", "spatialdds.server"]
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
# Everything vendored travels with the package, because the point of 0.2.0 is
|
|
48
|
+
# that `pip install` is enough:
|
|
49
|
+
#
|
|
50
|
+
# * `artifacts/serializer_tables.json` -- what the lift reads, in both
|
|
51
|
+
# directions. A client has no recording to learn the types from.
|
|
52
|
+
# * `artifacts/schemas/*.json` -- the 112 generated JSON Schemas. The endpoint
|
|
53
|
+
# publishes them and validates against them, and §8.4's third-party reader
|
|
54
|
+
# has nothing else to go on.
|
|
55
|
+
# * `artifacts/idl/*.idl` -- the pinned IDL. A registry that starts empty
|
|
56
|
+
# boots its types from this; the tables cannot stand in because they carry
|
|
57
|
+
# no `@key`, so a keyed resource would have no instance names.
|
|
58
|
+
# * `demo/**` -- the fountain set `--demo` serves. Byte-identical to the
|
|
59
|
+
# repository's `samples/` copy, which `tools/pack_demo.py` maintains and
|
|
60
|
+
# `gates/serve_demo.py` checks.
|
|
61
|
+
spatialdds = [
|
|
62
|
+
"artifacts/serializer_tables.json",
|
|
63
|
+
"artifacts/schemas/*.json",
|
|
64
|
+
"artifacts/idl/*.idl",
|
|
65
|
+
"demo/*.mcap",
|
|
66
|
+
"demo/manifests/*.json",
|
|
67
|
+
"demo/assets/*",
|
|
68
|
+
]
|