-
Notifications
You must be signed in to change notification settings - Fork 3
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
Maritime schema integration #24
Maritime schema integration #24
Conversation
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.
Great work. Approved with some comments.
Most comments are minor. The only one that needs to be resolved before merging is the one in pyproject.toml (how the maritime-schema package is referenced).
pyproject.toml
Outdated
global-land-mask = "^1.0.0" | ||
folium = "^0.14.0" | ||
pydantic = "^2.5" | ||
maritime-schema = { git = "https://github.com/dnv-opensource/maritime-schema.git" } |
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.
change to maritime-schema = "^0.0.3"
once the maritime-schema package is published.
(This line is the reason why the GitHub workflow fails. The workflow does not have permission to clone the maritime-schema repository)
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.
also done :)
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.
Installing the ship-traffic-generator package on my own machine I found out that we also need to limit the python versions we allow.
python = "^3.9"
needs to be changed to
python = ">=3.9, <3.13"
This is needed because "^3.9" effectively means ">=3.9, <4.0" , and hence includes 3.13
There are multiple other dependencies, though, that require python <3.13 (which makes sense. Also we ourselves would want to require that).
If we implicitly allow python 3.13 (which "^3,9" does), then dependency resolution fails.
src/trafficgen/types.py
Outdated
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.
we could think about applying the same improvements here that you introduced also in the caga.py module in maritime-schema. At least two minor things come to my mind; maybe there are more:
a) the to_camel
function we could import from maritime_schema.utils.strings
instead of implementing it here again
b) I remember you improved the way the model 'config' was handled, in maritime-schema. You created an additional base class that all models then inherited from. Not sure, but maybe this is an improvement that is worth to apply also here in ship-traffic-generator?
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.
sure, I will look into these!
@tomarnepedersen I've fixed most of the issues that Claas pointed out, but perhaps you also want to take a look to make sure you are happy with the changes. I tried my best not to change anything too drastically! To get most things to work, I've had to modify the maritime-schema, and change a lot of fields to Optional. This is because in ship-traffic-gen the classes such as |
See your point. Of course, possible to change the code in later release to do as you suggest. The reason for not having the fields optiona I guess is to not have to have checks if the parameter includes a value? |
Exactly. But I agree, we can fix this later on |
…e-schema and for python
Already merged a branch which was based on this one. This could be deleted |
These changes should allow the Types from maritime-schema to be used. The main changes are in types.py (now much shorter), as shared types live in maritime schema. Also some changes here and wherever an error was thrown. As far as I can see, the output generated is the same.