-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python union serialization codegen #6258
Conversation
try: | ||
iter(data) # type: ignore[arg-type] | ||
except TypeError: | ||
data = [data] # type: ignore[list-item] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only works if none of the element-types themselves are iterable. Specifically I think this will cause a problem in the situation of a Union that has a string as a union-arm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm true. This is surprisingly tricky. For starters I can check for the union itself and any of its arms, but we might also want to check for all type aliases of each arm 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about 4cd630d
not doing type aliases of arms so far
### What Part of a train * ➡️ #6257 * #6258 * #6259 This is needed to implement `TimeRangeBoundary` nicer: the `infinite` variant is supposed to use this unit type. The way I solved it is by introducing a special built-in `UnitType` that we always map to `Type::Unit`. For purposes of serialization this is just a variant of type null, i.e. we append to a `NullArray`. _are you sure this works?_ Yes, check the last piece of the train! ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/{{pr.number}}) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`.
# Conflicts: # rerun_py/rerun_sdk/rerun/datatypes/time_range_boundary.py
36cdca9
to
447881c
Compare
…#6259) ### What Part of a train * #6257 * #6258 * ➡️ #6259 Replaces a fair chunk of * #6221 Makes `VisibleTimeRange` a union - the motivator for this pr train in the first place. Adds a roundtrip test that compares the serialization of`VisibleTimeRange` archetype across sdk languages. (the archetype is meant for blueprint only, but I'm simply using the datastore for this comparision) ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/6259?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/6259?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/6259) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`.
What
Part of a train
VisibleTimeRange
is now a union, add serialization comparision test #6259This is fair chunk of:
In theory this should have been enough to be able to serialize
Transform3D
with generated code. However, I ran into native crashes in unrelated tests when trying to do so. Also, this requires shuffling around some other manual serialization code where we don't generate serialization for structs yet.are you sure this works? Passes existing python test & comparison tests. For the new unit-union variants check the last part of the train.
Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewerTo run all checks from
main
, comment on the PR with@rerun-bot full-check
.