Closed ghorn closed 2 years ago
Hi @ghorn!
Yeah this should work, but this part of the code definitely needs some battle testing and ideally should be part of the type-fuzzing testsuite. In this case it is a simple typo, the IS_OPTIONAL flag is part of header.element_flags
and not directly set on header
. Could you verify that my branch here: https://github.com/thijsmie/cyclonedds-python/tree/element_flags_typo fixes your problem?
I tested your patch (not your branch) and I confirm it works and I recover the IdlStruct. Thanks!
Side note, I had to monkey-patch it in because I can only run with a pip binary distribution at the moment. I thought you might be interested because of how dirty it was:
"""
Basic app that listens to control telemetry and prints it out.
"""
# avert your eyes
import os
os.system("sed -i 's/descriptor.header.IS_OPTIONAL/descriptor.header.element_flags.IS_OPTIONAL/g' /long/path/to/pip/install/location/cyclonedds/idl/_xt_builder.py")
from cyclonedds.dynamic import get_types_for_typeid
from cyclonedds.domain import DomainParticipant
from cyclonedds.builtin import BuiltinDataReader, BuiltinTopicDcpsParticipant, BuiltinTopicDcpsSubscription, BuiltinTopicDcpsPublication, BuiltinTopicDcpsTopic
from cyclonedds.util import duration
from cyclonedds.core import DDSException
# etc etc
Now that I think about it, I guess I could just commit this locally.........
for those who are morbidly curious, the "portable" version is
# Monkey patch in a fix for dynamic discovery.
# See https://github.com/eclipse-cyclonedds/cyclonedds-python/issues/80#issuecomment-1112889825.
# This is actually the "portable" version, lol.
# Only God can judge me.
import importlib.util
cyclonedds_path = importlib.util.find_spec('cyclonedds').loader.path.removesuffix('/__init__.py')
import os
sed_expr = "s/descriptor.header.IS_OPTIONAL/descriptor.header.element_flags.IS_OPTIONAL/g"
os.system(f"find {cyclonedds_path} -name '_xt_builder.py' | xargs sed -i '{sed_expr}'")
from cyclonedds.dynamic import get_types_for_typeid
.........
That is... creative π . I submitted the PR, we'll make sure it works in the next release.
Thank you! What's the normal release schedule, btw?
The release schedule boils down to: "minor releases for big new stuff, patch releases to clean up stuff where needed". What that means for the python backend is to be figured out as we go along, we simply don't have a tradition yet!
Oh, one note for future reference, please leave the issue open till a fix merged. That allows the merge to autoclose the issue, providing some traceability.
Would you mind making a release for this issue? How automated is the release process?
Hi @ghorn,
We're looking to make a release this week. The release process for Python is a simple question of putting a tag on the repository, the rest is automated via CI. There are also pending fixes for C and C++ backends so the plan is to make a synchronised release of 0.9.1.
nice!
Hi @ghorn, Just checking in with you if the release 0.9.1 indeed fixed your issue.
Thanks for checking in. This does fix the issue. Where should I send the beer?
Good to hear! Hope you enjoy using CycloneDDS-Python π. Please redirect any beer-money for me towards django girls as I have enough π.
I'm not sure if this is a bug report or incorrect usage.
I'm trying to get type discovery working. My goal is to write an application that discovers types on a domain and can receive, introspect, and publish data of these dynamically discovered types. This includes types sent by the C++ and python bindings to cyclonedds.
Here's what I came up with:
This code raises an exception:
Am I approaching this correctly? Does the functionality I'm looking for supported? Thanks.