Static typing for Message, Services, and Actions#206
Static typing for Message, Services, and Actions#206christophebedard merged 86 commits intoros2:rollingfrom
Conversation
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
|
Still need to fix a circular import issue. |
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <36806982+InvincibleRMC@users.noreply.github.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
|
Thanks so much for the review!
I was going to ask about this since I have a feeling this will expose some downstream bugs to be fixed. |
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
|
Pulls: #206 |
|
Another old mypy bug. import typing
class A:
def __init__(self) -> typing.NoReturn: # The return type of "__init__" must be None
raise NotImplementedError()Will add a # type: ignore for now. Cannot wait for |
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
|
Pulls: #206 |
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
|
|
|
@ros-pull-request-builder retest this please |
|
Alright, let's try a full CI run again. |
|
Pulls: #206 |
|
@christophebedard the |
|
It usually gets automatically retried if it fails due to an infra issue, but it's not always easy to find the corresponding job. ci_linux-rhel 3922 was retried with 3925, which also failed due to an infra issue and was retried with 3929: https://ci.ros2.org/job/ci_linux-rhel/3929/. There's a |
|
The RHEL job had some different test failures; I don't think it's related to these changes. The first one seems to be Zenoh router-related and the second one seems to be a time-related flake. |
|
@sloretz do you want to give this another look? Otherwise, I would go ahead and approve + merge it. |
|
Thanks so much for all the reviews and finally getting this merged! |
|
I created a new release ( The timing is great, because a Rolling sync was just completed, so we'll have time to let the buildfarm rebuild downstream packages and fix anything that breaks before the next sync. |
|
Feel free to ping me about any downstream problems you find. |
peci1
left a comment
There was a problem hiding this comment.
This PR (and not only this one, but this one is the major contributor) imposes new constraints on the names of messages.
I've reported the problem in #257 . I used the review feature on this PR to highlight the places where I see problems (only in msg.em for simplicity).
| if member.name in dict(inspect.getmembers(builtins)).keys(): | ||
| noqa_string = ', A002' | ||
| }@ | ||
| @(member.name): typing.Optional[@(type_annotations_setter[member.name])] = None, # noqa: E501@(noqa_string) |
| )]@ | ||
| from @('.'.join(type_.namespaces))._@(convert_camel_case_to_lower_case_underscore(type_.name.rsplit('_', 1)[0])) import @(type_.name) | ||
| @[ else]@ | ||
| from @('.'.join(type_.namespaces)) import @(type_.name) |
| self.@(member.name) = @(member.name) if @(member.name) is not None else chr(0) | ||
| @[ else]@ | ||
| self.@(member.name) = kwargs.get('@(member.name)', @(get_python_type(type_))()) | ||
| self.@(member.name) = @(member.name) if @(member.name) is not None else @(get_python_type(type_))() |
| '@(member.name)', | ||
| [@(get_python_type(type_))() for x in range(@(member.type.size))] | ||
| ) | ||
| self.@(member.name) = @(member.name) if @(member.name) is not None else [@(get_python_type(type_))() for x in range(@(member.type.size))] |
| }@ | ||
| @@builtins.property@(noqa_string) | ||
| def @(member.name)(self):@(noqa_string) | ||
| def @(member.name)(self) -> @(type_annotations_getter[member.name]):@(noqa_string)@(array_type_commment) |
|
|
||
| @@@(member.name).setter@(noqa_string) | ||
| def @(member.name)(self, value):@(noqa_string) | ||
| def @(member.name)(self, value: @(type_annotations_setter[member.name])) -> None:@(noqa_string) |
| )]@ | ||
| from @('.'.join(type_.namespaces))._@(convert_camel_case_to_lower_case_underscore(type_.name.rsplit('_', 1)[0])) import @(type_.name) | ||
| @[ else]@ | ||
| from @('.'.join(type_.namespaces)) import @(type_.name) |
| @{assert_msg_suffixes.insert(1, 'with length %d' % member.type.size)}@ | ||
| @[ end if]@ | ||
| @[ end if]@ | ||
| all(isinstance(v, @(get_python_type(type_))) for v in value) and |
| isinstance(value, str), \ | ||
| "The '@(member.name)' field must be of type '@(get_python_type(type_))'" | ||
| @[ elif isinstance(type_, BasicType) and type_.typename in (BOOLEAN_TYPE, *FLOATING_POINT_TYPES, *INTEGER_TYPES)]@ | ||
| isinstance(value, @(get_python_type(type_))), \ |
Adds static typing to generated messages. Closes #157.