Skip to content

Commit

Permalink
Automatic (de)serialization for bundles (#6821, PR #6931)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirho-ucsc committed Feb 26, 2025
2 parents 6589a7f + 1a0f6fb commit 28313d5
Show file tree
Hide file tree
Showing 16 changed files with 449 additions and 248 deletions.
9 changes: 6 additions & 3 deletions scripts/can_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ def plugin_for(catalog):


def save_bundle(bundle: Bundle, output_dir: str) -> None:
path = os.path.join(output_dir,
f'{bundle.uuid}.{bundle.canning_qualifier()}.json')
file_name = f'{bundle.uuid}.{bundle.canning_qualifier()}.json'
path = os.path.join(output_dir, file_name)
bundle_json = bundle.to_json()
# We can bundles without the FQID so that we can mock it during tests
bundle_json.pop('fqid')
with write_file_atomically(path) as f:
json.dump(bundle.to_json(), f, indent=4)
json.dump(bundle_json, f, indent=4)
log.info('Successfully wrote %s', path)


Expand Down
Loading

0 comments on commit 28313d5

Please sign in to comment.