Skip to content
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

oarepo_model_builder.events..before_model_loaded and oarepo_model_bui… #271

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions oarepo_model_builder/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ def run_internal(
x.split("=", maxsplit=1)[0]: x.split("=", maxsplit=1)[1] for x in includes
}

for entrypoint in load_entry_points_dict(
"oarepo_model_builder.events.before_model_loaded"
).values():
entrypoint(
model_filename=model_filename,
configs=configs,
sets=sets,
included_models=included_models,
includes=includes,
)

# load model (and resolve includes) and optionally save it before the processing (for debugging)
model = load_model(
model_filename,
Expand All @@ -202,6 +213,19 @@ def run_internal(
merged_models=included_models,
extra_included=includes,
)

for entrypoint in load_entry_points_dict(
"oarepo_model_builder.events.after_model_loaded"
).values():
entrypoint(
model=model,
model_filename=model_filename,
configs=configs,
sets=sets,
included_models=included_models,
includes=includes,
)

if save_model:
with open(save_model, "w") as f:
yaml.dump(json.loads(json.dumps(model.schema)), f)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-model-builder
version = 4.0.90
version = 4.0.91
description = A utility library that generates OARepo required data model files from a JSON specification file
authors = Miroslav Bauer <[email protected]>, Miroslav Simek <[email protected]>
readme = README.md
Expand Down
Loading