-
Notifications
You must be signed in to change notification settings - Fork 16
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
Generator for ProtoBuf (proto3) #476
Conversation
…red modules `constants` and `structure`
…ish two subclasses of the same interface
@TomGneuss thanks a lot! Before I dig deeper, would you mind creating a separate smaller pull request for the renaming pascal to snake case? I was at first quite confused why other generators were changed, and this might make exploration of the history more difficult down the line. If you lack time, I can do it for you -- please let me know what is easier for you. |
I ran the code-formatting script. As in #478, the mypy part fails. I also discovered an issue in the generated proto files regarding properties that are not concrete types but interfaces. Since proto3 does not support interfaces (and inheritance in general), i fixed it by using the "oneof" keyword or introduced a *choice-message where necessary. |
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.
Remove unnecessary blanks and empty lines
@@ -1,4 +1,5 @@ | |||
"""Render descriptions to documentation comments.""" | |||
|
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.
@@ -1,4 +1,5 @@ | |||
"""Generate Golang code for enhancing model classes.""" | |||
|
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.
@@ -1,4 +1,5 @@ | |||
"""Generate the Golang code for de/serialization of AAS classes from and to JSON.""" | |||
|
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.
@@ -1,4 +1,5 @@ | |||
"""Provide code generation for unrolling recursive calls and iterations.""" | |||
|
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.
@@ -1,4 +1,5 @@ | |||
"""Generate the invariant verifiers from the intermediate representation.""" | |||
|
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.
aas_core_codegen/xsd/naming.py
Outdated
@@ -5,6 +5,7 @@ | |||
:py:mod:`aas_core_codegen.naming`, which are used with different generators, | |||
these identifiers are used only for the XSD. | |||
""" | |||
|
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.
aas_core_codegen/yielding/linear.py
Outdated
@@ -1,4 +1,5 @@ | |||
"""Translate control flows to linear flows with goto-statements and co-routines.""" | |||
|
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.
setup.py
Outdated
@@ -4,6 +4,7 @@ | |||
https://packaging.python.org/en/latest/distributing.html | |||
https://github.com/pypa/sampleproject | |||
""" | |||
|
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.
Remove empty lines and blanks
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.
lgtm
I think i misread the emails that GitHub sent me as I see no diffs in that regard to the main branch anymore when I look at the changed files here on the web site. |
idk. Didn't work for us. Fixed minor bugs in the proto gen. |
@TomGneuss please let me know when you sync the pull request with the main branch and when it is ready for review. |
@g1zzm0 @TomGneuss please make sure that you create separate pull requests for all the non-protobuf related changes. Otherwise, it is very hard to follow the git history and also to review. |
We dont want to change the other non-proto related files. Black eddited some line endings, so i removed this changes from this branch. |
I see the changes now also in the web. Please revert them (the removal of blank lines). We intentionally put a blank line after the module docstring (and I think |
Ah, I see now. Are you sure you have the exact version of black as is specified in |
You can try in your virtual environment:
Maybe you have a system-wide installed black which eclipses the local one? |
|
Have you also installed black in this step? What do you get in the activated virtual environment when you call:
? |
… gh-protobuf # Conflicts: # aas_core_codegen/protobuf/structure/_generate.py
Yes.
|
@g1zzm0 @TomGneuss can you give me some hint what changed here? aas_core_codegen/intermediate/_translate.py Only formatting, right? |
As by issue #475, we requested a new generator for ProtoBuf. With this pull-request we present a possible solution for that.
In contrast to other generators, it only requires the
structure
module.Since ProtoBuf is only a configuration language, it does not support functionalities like verification or object-oriented patterns like Visitor.
Thus, the code-base is minimal because also the expected output is reduced compared to the normal Core SDK.