current-data-py 0.1.12__tar.gz → 0.1.14__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.
Files changed (102) hide show
  1. {current_data_py-0.1.12 → current_data_py-0.1.14}/MANIFEST.in +0 -0
  2. current_data_py-0.1.14/PKG-INFO +199 -0
  3. current_data_py-0.1.14/README.md +185 -0
  4. {current_data_py-0.1.12 → current_data_py-0.1.14}/__init__.py +0 -0
  5. current_data_py-0.1.14/_multipart.py +52 -0
  6. current_data_py-0.1.14/current_data_py.egg-info/PKG-INFO +199 -0
  7. {current_data_py-0.1.12 → current_data_py-0.1.14}/current_data_py.egg-info/SOURCES.txt +2 -0
  8. {current_data_py-0.1.12 → current_data_py-0.1.14}/current_data_py.egg-info/dependency_links.txt +0 -0
  9. {current_data_py-0.1.12 → current_data_py-0.1.14}/current_data_py.egg-info/requires.txt +0 -0
  10. {current_data_py-0.1.12 → current_data_py-0.1.14}/current_data_py.egg-info/top_level.txt +0 -0
  11. {current_data_py-0.1.12 → current_data_py-0.1.14}/decoding.py +0 -0
  12. {current_data_py-0.1.12 → current_data_py-0.1.14}/examples/__init__.py +0 -0
  13. {current_data_py-0.1.12 → current_data_py-0.1.14}/examples/list_schemas.py +0 -0
  14. {current_data_py-0.1.12 → current_data_py-0.1.14}/examples/read_remote_td.py +0 -0
  15. {current_data_py-0.1.12 → current_data_py-0.1.14}/examples/read_td.py +0 -0
  16. {current_data_py-0.1.12 → current_data_py-0.1.14}/examples/write_td.py +0 -0
  17. {current_data_py-0.1.12 → current_data_py-0.1.14}/labeling.py +7 -7
  18. {current_data_py-0.1.12 → current_data_py-0.1.14}/management.py +12 -1
  19. {current_data_py-0.1.12 → current_data_py-0.1.14}/oss.py +34 -5
  20. current_data_py-0.1.14/proto_gen/python/labeling/service/service_pb2.py +79 -0
  21. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/labeling/service/service_pb2_grpc.py +16 -14
  22. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/labeling/task/task_pb2.py +12 -10
  23. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/labeling/template/template_pb2.py +0 -0
  24. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/management/metadata/metadata_pb2.py +16 -16
  25. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/management/selection/selection_pb2.py +0 -0
  26. current_data_py-0.1.14/proto_gen/python/management/service/service_pb2.py +84 -0
  27. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/management/service/service_pb2_grpc.py +33 -0
  28. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/builtin_interfaces/duration_pb2.py +0 -0
  29. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/builtin_interfaces/time_pb2.py +0 -0
  30. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/custom_msgs/joint_current_pb2.py +0 -0
  31. current_data_py-0.1.14/proto_gen/python/msg/custom_msgs/keypoints_validity_pb2.py +26 -0
  32. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/custom_msgs/pose_rpy_pb2.py +0 -0
  33. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/custom_msgs/slam_quality_pb2.py +0 -0
  34. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/custom_msgs/sonic_frame_pb2.py +0 -0
  35. current_data_py-0.1.14/proto_gen/python/msg/custom_msgs/subtask_description_pb2.py +25 -0
  36. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/custom_msgs/target_quality_pb2.py +0 -0
  37. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/foxglove/compressed_audio_pb2.py +0 -0
  38. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/foxglove/compressed_video_pb2.py +0 -0
  39. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/point32_pb2.py +0 -0
  40. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/point_pb2.py +0 -0
  41. current_data_py-0.1.14/proto_gen/python/msg/geometry_msgs/pose_array_pb2.py +27 -0
  42. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/pose_pb2.py +0 -0
  43. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/pose_stamped_pb2.py +0 -0
  44. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/pose_with_covariance_pb2.py +0 -0
  45. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/pose_with_covariance_stamped_pb2.py +0 -0
  46. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/quaternion_pb2.py +0 -0
  47. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/transform_pb2.py +0 -0
  48. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/transform_stamped_pb2.py +0 -0
  49. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/twist_pb2.py +0 -0
  50. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/twist_stamped_pb2.py +0 -0
  51. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/twist_with_covariance_pb2.py +0 -0
  52. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/twist_with_covariance_stamped_pb2.py +0 -0
  53. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/vector3_pb2.py +0 -0
  54. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/wrench_pb2.py +0 -0
  55. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/geometry_msgs/wrench_stamped_pb2.py +0 -0
  56. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/nav_msgs/map_meta_data_pb2.py +0 -0
  57. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/nav_msgs/occupancy_grid_pb2.py +0 -0
  58. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/nav_msgs/odometry_pb2.py +0 -0
  59. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/nav_msgs/path_pb2.py +0 -0
  60. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/battery_state_pb2.py +0 -0
  61. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/camera_info_pb2.py +0 -0
  62. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/compressed_image_pb2.py +0 -0
  63. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/image_pb2.py +0 -0
  64. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/imu_pb2.py +0 -0
  65. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/joint_state_pb2.py +0 -0
  66. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/laser_scan_pb2.py +0 -0
  67. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/nav_sat_fix_pb2.py +0 -0
  68. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/nav_sat_status_pb2.py +0 -0
  69. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/point_cloud2_pb2.py +0 -0
  70. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/point_field_pb2.py +0 -0
  71. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/range_pb2.py +0 -0
  72. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/sensor_msgs/region_of_interest_pb2.py +0 -0
  73. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/bool_pb2.py +0 -0
  74. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/color_rgba_pb2.py +0 -0
  75. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/float32_pb2.py +0 -0
  76. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/float64_pb2.py +0 -0
  77. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/header_pb2.py +0 -0
  78. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/int32_pb2.py +0 -0
  79. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/string_pb2.py +0 -0
  80. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/std_msgs/uint32_pb2.py +0 -0
  81. {current_data_py-0.1.12 → current_data_py-0.1.14}/proto_gen/python/msg/tf2_msgs/tf_message_pb2.py +0 -0
  82. {current_data_py-0.1.12 → current_data_py-0.1.14}/pyproject.toml +1 -1
  83. {current_data_py-0.1.12 → current_data_py-0.1.14}/remote/__init__.py +0 -0
  84. {current_data_py-0.1.12 → current_data_py-0.1.14}/remote/client.py +0 -0
  85. {current_data_py-0.1.12 → current_data_py-0.1.14}/remote/source.py +0 -0
  86. {current_data_py-0.1.12 → current_data_py-0.1.14}/remote/tos_source.py +0 -0
  87. {current_data_py-0.1.12 → current_data_py-0.1.14}/schema/__init__.py +4 -0
  88. {current_data_py-0.1.12 → current_data_py-0.1.14}/schema/message_metadata.py +0 -0
  89. {current_data_py-0.1.12 → current_data_py-0.1.14}/setup.cfg +0 -0
  90. {current_data_py-0.1.12 → current_data_py-0.1.14}/setup.py +0 -0
  91. {current_data_py-0.1.12 → current_data_py-0.1.14}/tests/check_environment.py +0 -0
  92. {current_data_py-0.1.12 → current_data_py-0.1.14}/tests/check_labeling.py +9 -9
  93. {current_data_py-0.1.12 → current_data_py-0.1.14}/tests/check_management.py +17 -2
  94. {current_data_py-0.1.12 → current_data_py-0.1.14}/tests/check_oss.py +0 -0
  95. {current_data_py-0.1.12 → current_data_py-0.1.14}/tests/check_package.py +4 -3
  96. {current_data_py-0.1.12 → current_data_py-0.1.14}/tests/check_remote.py +1 -1
  97. {current_data_py-0.1.12 → current_data_py-0.1.14}/tos.py +23 -2
  98. current_data_py-0.1.12/PKG-INFO +0 -435
  99. current_data_py-0.1.12/README.md +0 -421
  100. current_data_py-0.1.12/current_data_py.egg-info/PKG-INFO +0 -435
  101. current_data_py-0.1.12/proto_gen/python/labeling/service/service_pb2.py +0 -82
  102. current_data_py-0.1.12/proto_gen/python/management/service/service_pb2.py +0 -80
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: current-data-py
3
+ Version: 0.1.14
4
+ Summary: Current Data protobuf messages and schema metadata
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: protobuf>=3.20
8
+ Requires-Dist: turbodata==0.1.0
9
+ Requires-Dist: grpcio>=1.51.1
10
+ Requires-Dist: alibabacloud-oss-v2<2,>=1.4.0
11
+ Requires-Dist: tos<3,>=2.9
12
+ Requires-Dist: av>=12
13
+ Requires-Dist: pillow>=9
14
+
15
+ # current-data-py
16
+
17
+ Python SDK for robotics Protobuf messages, TD files, and platform service clients.
18
+ Run shell commands from the repository root in the shared development environment.
19
+
20
+ ## Use locally
21
+
22
+ Run the bundled examples to write and read a local TD file using the installed SDK:
23
+
24
+ ```sh
25
+ python -I -m current_data_py.examples.write_td /tmp/current-data-example.td
26
+ python -I -m current_data_py.examples.read_td /tmp/current-data-example.td
27
+ ```
28
+
29
+ `-I` avoids importing the unbuilt source directory in place of the installed package.
30
+ See [examples](examples) for other entry points.
31
+
32
+ For a minimal read-only service call, run this snippet with `python -I` so it uses
33
+ the installed SDK:
34
+
35
+ ```python
36
+ from contextlib import closing
37
+ import os
38
+ os.environ["ENV"] = "test"
39
+
40
+ from current_data_py.management import ManagementClient, MetadataFilter
41
+
42
+ with ManagementClient() as client:
43
+ with closing(client.stream_data_references(MetadataFilter(), timeout=30)) as records:
44
+ record = next(records, None)
45
+ print(record.id if record is not None else "No matching data")
46
+ ```
47
+
48
+ Set `ENV=test` before the first SDK import to select the test service; an unset or
49
+ empty value defaults to production. An explicit client `address=` overrides the
50
+ default. Remote examples require service connectivity and accessible data.
51
+
52
+ ## Upload files
53
+
54
+ Use `OSSClient` or `TOSClient` with upload permission. The management service
55
+ selects the bucket and allowed object prefix; keep it open during transfers:
56
+
57
+ ```python
58
+ from current_data_py.management import ManagementClient
59
+ from current_data_py.tos import TOSClient
60
+
61
+ with ManagementClient() as management:
62
+ with TOSClient(management, permission="upload", data_type="YAM",
63
+ data_kind="CONVERTED") as storage:
64
+ storage.upload_file(storage.object_prefix + "recording.td", "/data/recording.td",
65
+ multipart_threshold=100 * 1024**2,
66
+ part_size=16 * 1024**2, max_workers=4)
67
+ ```
68
+
69
+ Both clients accept the same transfer options. Files at or above
70
+ `multipart_threshold` use multipart upload; `0` forces multipart for nonempty
71
+ files. Empty files always use PutObject. Sizes are in bytes. `part_size` must be
72
+ 5 MiB–5 GiB, and the file must fit within 10,000 parts; increase it for larger
73
+ files. `max_workers` controls parallel requests (1–64); part buffers use roughly
74
+ `part_size * max_workers` memory, plus SDK overhead. Do not modify the source
75
+ file during upload.
76
+
77
+ Uploads reject existing objects by default, including when completing multipart
78
+ uploads. Set `forbid_overwrite=False` to replace one. Content type and metadata
79
+ are preserved. The return value is the provider's PutObject result for small
80
+ files or CompleteMultipartUpload result for multipart files.
81
+
82
+ Failed multipart transfers attempt to abort and delete incomplete parts. A failed
83
+ cleanup emits a warning; check the bucket's incomplete uploads. The upload role
84
+ and its scoped STS policy must allow `oss:AbortMultipartUpload` or
85
+ `tos:AbortMultipartUpload` in addition to PutObject. Deploy the management-service
86
+ policy update and ensure the underlying cloud role permits cleanup before use.
87
+ There is no persistent checkpoint: a later call starts a new upload. Uploading
88
+ does not register the data; call `ManagementClient.register_data` separately.
89
+
90
+ ## Test changes
91
+
92
+ The package bundles generated Protobuf modules during its build. After protocol
93
+ changes, [regenerate the bindings](../README.md#protobuf) first.
94
+ Build into a fresh temporary directory, validate the artifacts, and install this
95
+ checkout's wheel before running its checks. Only the local package is installed;
96
+ shared dependencies are left unchanged:
97
+
98
+ ```sh
99
+ (
100
+ set -e
101
+ sdk_dist=$(mktemp -d)
102
+ trap 'rm -rf "$sdk_dist"' EXIT
103
+ (cd current_data_py && python -m build --no-isolation --outdir "$sdk_dist")
104
+ python current_data_py/tests/check_distribution.py --dist-dir "$sdk_dist"
105
+ python -m pip install --no-deps --force-reinstall "$sdk_dist"/*.whl
106
+ for check in package environment management labeling remote oss tos decoding multipart; do
107
+ python -I "current_data_py/tests/check_${check}.py"
108
+ done
109
+ )
110
+ ```
111
+
112
+ These checks cover packaging, environment selection, clients, and media decoding
113
+ using local fixtures and mocked services. They do not require production credentials
114
+ or prove connectivity to a deployed service.
115
+
116
+ ## Publish to PyPI
117
+
118
+ CI checks this SDK but does not publish it. Releases are manual and must use the
119
+ latest successfully fetched `origin/main`, including the version bump. Development
120
+ branches, uncommitted changes, and older main commits are not release sources. Follow the
121
+ [repository Git workflow](../.agents/rules/git-workflow.md).
122
+ Prepare the version update in `pyproject.toml` on a development branch and merge it
123
+ through review together with the intended SDK changes before building a release.
124
+ Use a version that has not already been published.
125
+
126
+ ### Build and validate
127
+
128
+ Run from the repository root. Fetch the latest `origin/main`, record its commit,
129
+ and build from a clean exported copy so local edits and old artifacts cannot enter
130
+ the release:
131
+
132
+ ```bash
133
+ sdk_release_dir=$(mktemp -d /tmp/current-data-release.XXXXXX)
134
+ (
135
+ set -euo pipefail
136
+ git fetch origin
137
+ sdk_release_sha=$(git rev-parse origin/main)
138
+ printf '%s\n' "$sdk_release_sha" > "$sdk_release_dir/source-commit.txt"
139
+ mkdir "$sdk_release_dir/source"
140
+ git archive "$sdk_release_sha" | tar -x -C "$sdk_release_dir/source"
141
+ (cd "$sdk_release_dir/source/current_data_py" && python -m build --no-isolation --outdir "$sdk_release_dir/dist")
142
+ python "$sdk_release_dir/source/current_data_py/tests/check_distribution.py" --dist-dir "$sdk_release_dir/dist"
143
+ python -m twine check "$sdk_release_dir/dist/"*
144
+ python -m pip install --no-deps --force-reinstall "$sdk_release_dir/dist/"*.whl
145
+ (
146
+ cd "$sdk_release_dir"
147
+ unset PYTHONPATH PYTHONHOME
148
+ for check in package environment management labeling remote oss tos decoding; do
149
+ python -I "$sdk_release_dir/source/current_data_py/tests/check_${check}.py"
150
+ done
151
+ )
152
+ (cd "$sdk_release_dir/dist" && sha256sum *) > "$sdk_release_dir/SHA256SUMS"
153
+ )
154
+ ```
155
+
156
+ Release checks run outside both source trees so child Python processes also use
157
+ the installed wheel. They come from the recorded `origin/main` commit; unmerged
158
+ local test fixes are not included in the export.
159
+
160
+ Continue only after every check succeeds. Confirm `source-commit.txt` contains the
161
+ intended main commit and inspect the wheel for the intended release features.
162
+ Review the built package's README metadata for public display; exclude private
163
+ deployment addresses, bucket names, and credentials. Keep the release directory
164
+ and use these exact validated artifacts for uploading.
165
+
166
+ ### Upload
167
+
168
+ Use your configured PyPI credentials or Twine's interactive token prompt; do not
169
+ put tokens in the README or shell commands. Run from the repository root in the
170
+ same shell that defines `sdk_release_dir`.
171
+
172
+ Fetch main again immediately before uploading. If its commit has changed, rebuild
173
+ and rerun all checks from the new latest main. The command also checks that the
174
+ artifacts still match the hashes recorded after validation:
175
+
176
+ ```sh
177
+ (
178
+ set -e
179
+ sdk_repository=pypi
180
+ git fetch origin
181
+ if [ "$(git rev-parse origin/main)" != "$(cat "$sdk_release_dir/source-commit.txt")" ]; then
182
+ echo "origin/main changed; rebuild and validate the latest main before uploading." >&2
183
+ exit 1
184
+ fi
185
+ (cd "$sdk_release_dir/dist" && sha256sum -c ../SHA256SUMS)
186
+ python -m twine upload --repository "$sdk_repository" "$sdk_release_dir/dist/"*
187
+ )
188
+ ```
189
+
190
+ For an optional TestPyPI trial, change `sdk_repository=pypi` to
191
+ `sdk_repository=testpypi` in the same block and use TestPyPI credentials. Both
192
+ registries require the latest-main and artifact checks.
193
+
194
+ ### Verify the release
195
+
196
+ After upload, verify that PyPI shows the expected version and rendered description.
197
+ Compare the SHA-256 digests of both published files with `SHA256SUMS`, and retain
198
+ that file with `source-commit.txt` as the release record. An optional TestPyPI trial
199
+ does not replace verification of the production PyPI release.
@@ -0,0 +1,185 @@
1
+ # current-data-py
2
+
3
+ Python SDK for robotics Protobuf messages, TD files, and platform service clients.
4
+ Run shell commands from the repository root in the shared development environment.
5
+
6
+ ## Use locally
7
+
8
+ Run the bundled examples to write and read a local TD file using the installed SDK:
9
+
10
+ ```sh
11
+ python -I -m current_data_py.examples.write_td /tmp/current-data-example.td
12
+ python -I -m current_data_py.examples.read_td /tmp/current-data-example.td
13
+ ```
14
+
15
+ `-I` avoids importing the unbuilt source directory in place of the installed package.
16
+ See [examples](examples) for other entry points.
17
+
18
+ For a minimal read-only service call, run this snippet with `python -I` so it uses
19
+ the installed SDK:
20
+
21
+ ```python
22
+ from contextlib import closing
23
+ import os
24
+ os.environ["ENV"] = "test"
25
+
26
+ from current_data_py.management import ManagementClient, MetadataFilter
27
+
28
+ with ManagementClient() as client:
29
+ with closing(client.stream_data_references(MetadataFilter(), timeout=30)) as records:
30
+ record = next(records, None)
31
+ print(record.id if record is not None else "No matching data")
32
+ ```
33
+
34
+ Set `ENV=test` before the first SDK import to select the test service; an unset or
35
+ empty value defaults to production. An explicit client `address=` overrides the
36
+ default. Remote examples require service connectivity and accessible data.
37
+
38
+ ## Upload files
39
+
40
+ Use `OSSClient` or `TOSClient` with upload permission. The management service
41
+ selects the bucket and allowed object prefix; keep it open during transfers:
42
+
43
+ ```python
44
+ from current_data_py.management import ManagementClient
45
+ from current_data_py.tos import TOSClient
46
+
47
+ with ManagementClient() as management:
48
+ with TOSClient(management, permission="upload", data_type="YAM",
49
+ data_kind="CONVERTED") as storage:
50
+ storage.upload_file(storage.object_prefix + "recording.td", "/data/recording.td",
51
+ multipart_threshold=100 * 1024**2,
52
+ part_size=16 * 1024**2, max_workers=4)
53
+ ```
54
+
55
+ Both clients accept the same transfer options. Files at or above
56
+ `multipart_threshold` use multipart upload; `0` forces multipart for nonempty
57
+ files. Empty files always use PutObject. Sizes are in bytes. `part_size` must be
58
+ 5 MiB–5 GiB, and the file must fit within 10,000 parts; increase it for larger
59
+ files. `max_workers` controls parallel requests (1–64); part buffers use roughly
60
+ `part_size * max_workers` memory, plus SDK overhead. Do not modify the source
61
+ file during upload.
62
+
63
+ Uploads reject existing objects by default, including when completing multipart
64
+ uploads. Set `forbid_overwrite=False` to replace one. Content type and metadata
65
+ are preserved. The return value is the provider's PutObject result for small
66
+ files or CompleteMultipartUpload result for multipart files.
67
+
68
+ Failed multipart transfers attempt to abort and delete incomplete parts. A failed
69
+ cleanup emits a warning; check the bucket's incomplete uploads. The upload role
70
+ and its scoped STS policy must allow `oss:AbortMultipartUpload` or
71
+ `tos:AbortMultipartUpload` in addition to PutObject. Deploy the management-service
72
+ policy update and ensure the underlying cloud role permits cleanup before use.
73
+ There is no persistent checkpoint: a later call starts a new upload. Uploading
74
+ does not register the data; call `ManagementClient.register_data` separately.
75
+
76
+ ## Test changes
77
+
78
+ The package bundles generated Protobuf modules during its build. After protocol
79
+ changes, [regenerate the bindings](../README.md#protobuf) first.
80
+ Build into a fresh temporary directory, validate the artifacts, and install this
81
+ checkout's wheel before running its checks. Only the local package is installed;
82
+ shared dependencies are left unchanged:
83
+
84
+ ```sh
85
+ (
86
+ set -e
87
+ sdk_dist=$(mktemp -d)
88
+ trap 'rm -rf "$sdk_dist"' EXIT
89
+ (cd current_data_py && python -m build --no-isolation --outdir "$sdk_dist")
90
+ python current_data_py/tests/check_distribution.py --dist-dir "$sdk_dist"
91
+ python -m pip install --no-deps --force-reinstall "$sdk_dist"/*.whl
92
+ for check in package environment management labeling remote oss tos decoding multipart; do
93
+ python -I "current_data_py/tests/check_${check}.py"
94
+ done
95
+ )
96
+ ```
97
+
98
+ These checks cover packaging, environment selection, clients, and media decoding
99
+ using local fixtures and mocked services. They do not require production credentials
100
+ or prove connectivity to a deployed service.
101
+
102
+ ## Publish to PyPI
103
+
104
+ CI checks this SDK but does not publish it. Releases are manual and must use the
105
+ latest successfully fetched `origin/main`, including the version bump. Development
106
+ branches, uncommitted changes, and older main commits are not release sources. Follow the
107
+ [repository Git workflow](../.agents/rules/git-workflow.md).
108
+ Prepare the version update in `pyproject.toml` on a development branch and merge it
109
+ through review together with the intended SDK changes before building a release.
110
+ Use a version that has not already been published.
111
+
112
+ ### Build and validate
113
+
114
+ Run from the repository root. Fetch the latest `origin/main`, record its commit,
115
+ and build from a clean exported copy so local edits and old artifacts cannot enter
116
+ the release:
117
+
118
+ ```bash
119
+ sdk_release_dir=$(mktemp -d /tmp/current-data-release.XXXXXX)
120
+ (
121
+ set -euo pipefail
122
+ git fetch origin
123
+ sdk_release_sha=$(git rev-parse origin/main)
124
+ printf '%s\n' "$sdk_release_sha" > "$sdk_release_dir/source-commit.txt"
125
+ mkdir "$sdk_release_dir/source"
126
+ git archive "$sdk_release_sha" | tar -x -C "$sdk_release_dir/source"
127
+ (cd "$sdk_release_dir/source/current_data_py" && python -m build --no-isolation --outdir "$sdk_release_dir/dist")
128
+ python "$sdk_release_dir/source/current_data_py/tests/check_distribution.py" --dist-dir "$sdk_release_dir/dist"
129
+ python -m twine check "$sdk_release_dir/dist/"*
130
+ python -m pip install --no-deps --force-reinstall "$sdk_release_dir/dist/"*.whl
131
+ (
132
+ cd "$sdk_release_dir"
133
+ unset PYTHONPATH PYTHONHOME
134
+ for check in package environment management labeling remote oss tos decoding; do
135
+ python -I "$sdk_release_dir/source/current_data_py/tests/check_${check}.py"
136
+ done
137
+ )
138
+ (cd "$sdk_release_dir/dist" && sha256sum *) > "$sdk_release_dir/SHA256SUMS"
139
+ )
140
+ ```
141
+
142
+ Release checks run outside both source trees so child Python processes also use
143
+ the installed wheel. They come from the recorded `origin/main` commit; unmerged
144
+ local test fixes are not included in the export.
145
+
146
+ Continue only after every check succeeds. Confirm `source-commit.txt` contains the
147
+ intended main commit and inspect the wheel for the intended release features.
148
+ Review the built package's README metadata for public display; exclude private
149
+ deployment addresses, bucket names, and credentials. Keep the release directory
150
+ and use these exact validated artifacts for uploading.
151
+
152
+ ### Upload
153
+
154
+ Use your configured PyPI credentials or Twine's interactive token prompt; do not
155
+ put tokens in the README or shell commands. Run from the repository root in the
156
+ same shell that defines `sdk_release_dir`.
157
+
158
+ Fetch main again immediately before uploading. If its commit has changed, rebuild
159
+ and rerun all checks from the new latest main. The command also checks that the
160
+ artifacts still match the hashes recorded after validation:
161
+
162
+ ```sh
163
+ (
164
+ set -e
165
+ sdk_repository=pypi
166
+ git fetch origin
167
+ if [ "$(git rev-parse origin/main)" != "$(cat "$sdk_release_dir/source-commit.txt")" ]; then
168
+ echo "origin/main changed; rebuild and validate the latest main before uploading." >&2
169
+ exit 1
170
+ fi
171
+ (cd "$sdk_release_dir/dist" && sha256sum -c ../SHA256SUMS)
172
+ python -m twine upload --repository "$sdk_repository" "$sdk_release_dir/dist/"*
173
+ )
174
+ ```
175
+
176
+ For an optional TestPyPI trial, change `sdk_repository=pypi` to
177
+ `sdk_repository=testpypi` in the same block and use TestPyPI credentials. Both
178
+ registries require the latest-main and artifact checks.
179
+
180
+ ### Verify the release
181
+
182
+ After upload, verify that PyPI shows the expected version and rendered description.
183
+ Compare the SHA-256 digests of both published files with `SHA256SUMS`, and retain
184
+ that file with `source-commit.txt` as the release record. An optional TestPyPI trial
185
+ does not replace verification of the production PyPI release.
@@ -0,0 +1,52 @@
1
+ """Bounded-memory multipart scheduling shared by OSS and TOS."""
2
+ from concurrent.futures import ThreadPoolExecutor
3
+ import os
4
+ import warnings
5
+
6
+
7
+ def upload_size(path, threshold, part_size, max_workers):
8
+ for name, value, minimum, maximum in (
9
+ ("multipart_threshold", threshold, 0, 5 * 1024**3),
10
+ ("part_size", part_size, 5 * 1024**2, 5 * 1024**3),
11
+ ("max_workers", max_workers, 1, 64),
12
+ ):
13
+ if isinstance(value, bool) or not isinstance(value, int) or not minimum <= value <= maximum:
14
+ raise ValueError(f"{name} must be an integer between {minimum} and {maximum}")
15
+ size = os.stat(path).st_size
16
+ if (size + part_size - 1) // part_size > 10000:
17
+ raise ValueError("Upload exceeds 10000 parts; increase part_size")
18
+ return size
19
+
20
+
21
+ def transfer(path, size, part_size, max_workers, start, put, complete, abort):
22
+ # Verify the file before creating any remote upload. Each worker opens its
23
+ # own handle and retains at most one part; queued tasks contain only offsets.
24
+ with open(path, "rb") as source:
25
+ before = os.fstat(source.fileno())
26
+ if before.st_size != size:
27
+ raise ValueError("Upload source changed before transfer")
28
+ upload_id = start()
29
+
30
+ def send(number):
31
+ offset = (number - 1) * part_size
32
+ length = min(part_size, size - offset)
33
+ with open(path, "rb") as source:
34
+ source.seek(offset)
35
+ data = source.read(length)
36
+ if len(data) != length:
37
+ raise ValueError("Upload source changed during transfer")
38
+ return number, put(upload_id, number, data)
39
+
40
+ try:
41
+ with ThreadPoolExecutor(max_workers=max_workers) as pool:
42
+ parts = list(pool.map(send, range(1, (size + part_size - 1) // part_size + 1)))
43
+ after = os.stat(path)
44
+ if (before.st_size, before.st_mtime_ns, before.st_ino) != (after.st_size, after.st_mtime_ns, after.st_ino):
45
+ raise ValueError("Upload source changed during transfer")
46
+ return complete(upload_id, parts)
47
+ except BaseException:
48
+ try:
49
+ abort(upload_id)
50
+ except Exception:
51
+ warnings.warn("Multipart cleanup failed; incomplete parts may remain in storage", RuntimeWarning)
52
+ raise
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: current-data-py
3
+ Version: 0.1.14
4
+ Summary: Current Data protobuf messages and schema metadata
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: protobuf>=3.20
8
+ Requires-Dist: turbodata==0.1.0
9
+ Requires-Dist: grpcio>=1.51.1
10
+ Requires-Dist: alibabacloud-oss-v2<2,>=1.4.0
11
+ Requires-Dist: tos<3,>=2.9
12
+ Requires-Dist: av>=12
13
+ Requires-Dist: pillow>=9
14
+
15
+ # current-data-py
16
+
17
+ Python SDK for robotics Protobuf messages, TD files, and platform service clients.
18
+ Run shell commands from the repository root in the shared development environment.
19
+
20
+ ## Use locally
21
+
22
+ Run the bundled examples to write and read a local TD file using the installed SDK:
23
+
24
+ ```sh
25
+ python -I -m current_data_py.examples.write_td /tmp/current-data-example.td
26
+ python -I -m current_data_py.examples.read_td /tmp/current-data-example.td
27
+ ```
28
+
29
+ `-I` avoids importing the unbuilt source directory in place of the installed package.
30
+ See [examples](examples) for other entry points.
31
+
32
+ For a minimal read-only service call, run this snippet with `python -I` so it uses
33
+ the installed SDK:
34
+
35
+ ```python
36
+ from contextlib import closing
37
+ import os
38
+ os.environ["ENV"] = "test"
39
+
40
+ from current_data_py.management import ManagementClient, MetadataFilter
41
+
42
+ with ManagementClient() as client:
43
+ with closing(client.stream_data_references(MetadataFilter(), timeout=30)) as records:
44
+ record = next(records, None)
45
+ print(record.id if record is not None else "No matching data")
46
+ ```
47
+
48
+ Set `ENV=test` before the first SDK import to select the test service; an unset or
49
+ empty value defaults to production. An explicit client `address=` overrides the
50
+ default. Remote examples require service connectivity and accessible data.
51
+
52
+ ## Upload files
53
+
54
+ Use `OSSClient` or `TOSClient` with upload permission. The management service
55
+ selects the bucket and allowed object prefix; keep it open during transfers:
56
+
57
+ ```python
58
+ from current_data_py.management import ManagementClient
59
+ from current_data_py.tos import TOSClient
60
+
61
+ with ManagementClient() as management:
62
+ with TOSClient(management, permission="upload", data_type="YAM",
63
+ data_kind="CONVERTED") as storage:
64
+ storage.upload_file(storage.object_prefix + "recording.td", "/data/recording.td",
65
+ multipart_threshold=100 * 1024**2,
66
+ part_size=16 * 1024**2, max_workers=4)
67
+ ```
68
+
69
+ Both clients accept the same transfer options. Files at or above
70
+ `multipart_threshold` use multipart upload; `0` forces multipart for nonempty
71
+ files. Empty files always use PutObject. Sizes are in bytes. `part_size` must be
72
+ 5 MiB–5 GiB, and the file must fit within 10,000 parts; increase it for larger
73
+ files. `max_workers` controls parallel requests (1–64); part buffers use roughly
74
+ `part_size * max_workers` memory, plus SDK overhead. Do not modify the source
75
+ file during upload.
76
+
77
+ Uploads reject existing objects by default, including when completing multipart
78
+ uploads. Set `forbid_overwrite=False` to replace one. Content type and metadata
79
+ are preserved. The return value is the provider's PutObject result for small
80
+ files or CompleteMultipartUpload result for multipart files.
81
+
82
+ Failed multipart transfers attempt to abort and delete incomplete parts. A failed
83
+ cleanup emits a warning; check the bucket's incomplete uploads. The upload role
84
+ and its scoped STS policy must allow `oss:AbortMultipartUpload` or
85
+ `tos:AbortMultipartUpload` in addition to PutObject. Deploy the management-service
86
+ policy update and ensure the underlying cloud role permits cleanup before use.
87
+ There is no persistent checkpoint: a later call starts a new upload. Uploading
88
+ does not register the data; call `ManagementClient.register_data` separately.
89
+
90
+ ## Test changes
91
+
92
+ The package bundles generated Protobuf modules during its build. After protocol
93
+ changes, [regenerate the bindings](../README.md#protobuf) first.
94
+ Build into a fresh temporary directory, validate the artifacts, and install this
95
+ checkout's wheel before running its checks. Only the local package is installed;
96
+ shared dependencies are left unchanged:
97
+
98
+ ```sh
99
+ (
100
+ set -e
101
+ sdk_dist=$(mktemp -d)
102
+ trap 'rm -rf "$sdk_dist"' EXIT
103
+ (cd current_data_py && python -m build --no-isolation --outdir "$sdk_dist")
104
+ python current_data_py/tests/check_distribution.py --dist-dir "$sdk_dist"
105
+ python -m pip install --no-deps --force-reinstall "$sdk_dist"/*.whl
106
+ for check in package environment management labeling remote oss tos decoding multipart; do
107
+ python -I "current_data_py/tests/check_${check}.py"
108
+ done
109
+ )
110
+ ```
111
+
112
+ These checks cover packaging, environment selection, clients, and media decoding
113
+ using local fixtures and mocked services. They do not require production credentials
114
+ or prove connectivity to a deployed service.
115
+
116
+ ## Publish to PyPI
117
+
118
+ CI checks this SDK but does not publish it. Releases are manual and must use the
119
+ latest successfully fetched `origin/main`, including the version bump. Development
120
+ branches, uncommitted changes, and older main commits are not release sources. Follow the
121
+ [repository Git workflow](../.agents/rules/git-workflow.md).
122
+ Prepare the version update in `pyproject.toml` on a development branch and merge it
123
+ through review together with the intended SDK changes before building a release.
124
+ Use a version that has not already been published.
125
+
126
+ ### Build and validate
127
+
128
+ Run from the repository root. Fetch the latest `origin/main`, record its commit,
129
+ and build from a clean exported copy so local edits and old artifacts cannot enter
130
+ the release:
131
+
132
+ ```bash
133
+ sdk_release_dir=$(mktemp -d /tmp/current-data-release.XXXXXX)
134
+ (
135
+ set -euo pipefail
136
+ git fetch origin
137
+ sdk_release_sha=$(git rev-parse origin/main)
138
+ printf '%s\n' "$sdk_release_sha" > "$sdk_release_dir/source-commit.txt"
139
+ mkdir "$sdk_release_dir/source"
140
+ git archive "$sdk_release_sha" | tar -x -C "$sdk_release_dir/source"
141
+ (cd "$sdk_release_dir/source/current_data_py" && python -m build --no-isolation --outdir "$sdk_release_dir/dist")
142
+ python "$sdk_release_dir/source/current_data_py/tests/check_distribution.py" --dist-dir "$sdk_release_dir/dist"
143
+ python -m twine check "$sdk_release_dir/dist/"*
144
+ python -m pip install --no-deps --force-reinstall "$sdk_release_dir/dist/"*.whl
145
+ (
146
+ cd "$sdk_release_dir"
147
+ unset PYTHONPATH PYTHONHOME
148
+ for check in package environment management labeling remote oss tos decoding; do
149
+ python -I "$sdk_release_dir/source/current_data_py/tests/check_${check}.py"
150
+ done
151
+ )
152
+ (cd "$sdk_release_dir/dist" && sha256sum *) > "$sdk_release_dir/SHA256SUMS"
153
+ )
154
+ ```
155
+
156
+ Release checks run outside both source trees so child Python processes also use
157
+ the installed wheel. They come from the recorded `origin/main` commit; unmerged
158
+ local test fixes are not included in the export.
159
+
160
+ Continue only after every check succeeds. Confirm `source-commit.txt` contains the
161
+ intended main commit and inspect the wheel for the intended release features.
162
+ Review the built package's README metadata for public display; exclude private
163
+ deployment addresses, bucket names, and credentials. Keep the release directory
164
+ and use these exact validated artifacts for uploading.
165
+
166
+ ### Upload
167
+
168
+ Use your configured PyPI credentials or Twine's interactive token prompt; do not
169
+ put tokens in the README or shell commands. Run from the repository root in the
170
+ same shell that defines `sdk_release_dir`.
171
+
172
+ Fetch main again immediately before uploading. If its commit has changed, rebuild
173
+ and rerun all checks from the new latest main. The command also checks that the
174
+ artifacts still match the hashes recorded after validation:
175
+
176
+ ```sh
177
+ (
178
+ set -e
179
+ sdk_repository=pypi
180
+ git fetch origin
181
+ if [ "$(git rev-parse origin/main)" != "$(cat "$sdk_release_dir/source-commit.txt")" ]; then
182
+ echo "origin/main changed; rebuild and validate the latest main before uploading." >&2
183
+ exit 1
184
+ fi
185
+ (cd "$sdk_release_dir/dist" && sha256sum -c ../SHA256SUMS)
186
+ python -m twine upload --repository "$sdk_repository" "$sdk_release_dir/dist/"*
187
+ )
188
+ ```
189
+
190
+ For an optional TestPyPI trial, change `sdk_repository=pypi` to
191
+ `sdk_repository=testpypi` in the same block and use TestPyPI credentials. Both
192
+ registries require the latest-main and artifact checks.
193
+
194
+ ### Verify the release
195
+
196
+ After upload, verify that PyPI shows the expected version and rendered description.
197
+ Compare the SHA-256 digests of both published files with `SHA256SUMS`, and retain
198
+ that file with `source-commit.txt` as the release record. An optional TestPyPI trial
199
+ does not replace verification of the production PyPI release.
@@ -1,6 +1,7 @@
1
1
  MANIFEST.in
2
2
  README.md
3
3
  __init__.py
4
+ _multipart.py
4
5
  decoding.py
5
6
  labeling.py
6
7
  management.py
@@ -9,6 +10,7 @@ pyproject.toml
9
10
  setup.py
10
11
  tos.py
11
12
  ./__init__.py
13
+ ./_multipart.py
12
14
  ./decoding.py
13
15
  ./labeling.py
14
16
  ./management.py