-
Notifications
You must be signed in to change notification settings - Fork 5
Self-Contained JSON file format #412
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
Conversation
Merging to
|
changed from `get_self_contained_json` to `get_expanded_json`
* added comments * renamed variables to be more self documenting and obvious * added type hinting where it would help * renamed test to be more self documenting and make more sense
* changed name from `mybigsmiles` that triggered spelling error CI to something that would not trigger it and is more explicit and better anyways. * replaced it with `my material 1 bigsmiles` and `my material 2 bigsmiles`
Json file format additions/upgrades
1. A complex project node can be serialized into an expanded JSON string, without UUID placeholders. | ||
2. The expanded JSON can be deserialized into a node that is equivalent to the original node. | ||
""" | ||
expanded_project_json: str = complex_project_node.get_expanded_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.
in hindsight, I probably should have named this project_expanded_json
to make more sense, but I think it'll pass for now
# assert the expanded JSON was correctly deserialized to project node | ||
assert deserialized_project_node == complex_project_node | ||
|
||
short_json: str = complex_project_node.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.
this should have also been condensed_json
instead to make it more self documenting and clearer
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.
agreed
>>> # ============= Get long form JSON ============= | ||
>>> long_form_json = my_project.get_expanded_json(indent=4) | ||
|
||
???+ info "Short JSON VS Long 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.
We should have called this section Condensed JSON VS Expanded JSON
, but it is okay for now and we can come back to it later
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.
agreed
Description
The SDK can produce fully self-contained JSON string for node graphs.
Such a node graph does not contain any UUID reference (self-contained) and can be super helpful for users if they want to store their work in a JSON file before uploading it to CRIPT.
@bearmit expressed that he would like this feature.
Changes
Also added a hint about using
kwargs
to beautify JSON strings into the documentation.Tests
A test is included to ensures that self-containing JSON can be parsed by
cript.load_nodes_from_json
.Known Issues
Notes
Checklist
CONTRIBUTORS.md
) in the pull request source branch.