Skip to content

Counterpart to QCEl rc4#47

Merged
loriab merged 4 commits intoMolSSI:mainfrom
loriab:rc4
Mar 29, 2026
Merged

Counterpart to QCEl rc4#47
loriab merged 4 commits intoMolSSI:mainfrom
loriab:rc4

Conversation

@loriab
Copy link
Copy Markdown
Collaborator

@loriab loriab commented Mar 19, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates QCManyBody’s ManyBodyProperties serialization and cross-version conversion to match recent QCElemental v2 behavior (notably schema_name appearing in model_dump() while omitting None fields), and adjusts tests accordingly.

Changes:

  • Update v2 ManyBodyProperties to filter out None values during serialization while retaining schema_name.
  • Add/extend convert_v support for ManyBody properties and ensure v2→v1 result conversion converts nested property models.
  • Update schema keyword tests to account for v2 model_dump() including schema_name.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
qcmanybody/tests/test_schema_keywords.py Updates assertions to reflect v2 serialization (schema_name included) and uses exclude_unset for stable dict-size checks.
qcmanybody/models/v2/many_body.py Refactors v2 properties model generation/serialization; adds ManyBodyProperties.convert_v; strengthens v2→v1 result conversion for properties.
qcmanybody/models/v1/manybody_output_pydv1.py Adds ManyBodyResultProperties.convert_v and ensures v1→v2 result conversion converts properties.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 279 to +285
try:
dself["specification"].pop("schema_name")
dself["specification"]["specification"]["protocols"].pop("schema_name")
except KeyError:
for spec in dself["specification"].values():
spec.pop("schema_name")
spec["protocols"].pop("schema_name")
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ManyBodySpecification.convert_v, the try branch assumes dself["specification"] has a schema_name key and then indexes dself["specification"]["specification"]["protocols"], but specification is typed/validated as a dict of AtomicSpecifications, so this branch looks unreachable and the ...["specification"]["protocols"] path appears inconsistent with the structure used in the except branch (spec["protocols"]). Simplifying this to always iterate for spec in dself["specification"].values() (and dropping the nested ...["specification"]["specification"]...) would make the conversion logic clearer and avoid a latent crash if the try branch ever becomes reachable.

Suggested change
try:
dself["specification"].pop("schema_name")
dself["specification"]["specification"]["protocols"].pop("schema_name")
except KeyError:
for spec in dself["specification"].values():
spec.pop("schema_name")
spec["protocols"].pop("schema_name")
# strip schema_name from each atomic specification and its protocols
for spec in dself["specification"].values():
spec.pop("schema_name", None)
if "protocols" in spec:
spec["protocols"].pop("schema_name", None)

Copilot uses AI. Check for mistakes.
@loriab loriab marked this pull request as ready for review March 27, 2026 07:49
@loriab loriab merged commit 77bc56f into MolSSI:main Mar 29, 2026
6 checks passed
@loriab loriab deleted the rc4 branch March 29, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants