Skip to content

Return modified copies in common powerups - #1667

Merged
JaGeo merged 2 commits into
materialsproject:mainfrom
lyn1dev:fix-powerups-copy
Nov 26, 2026
Merged

JaGeo merged 2 commits into
materialsproject:mainfrom
lyn1dev:fix-powerups-copy

Conversation

@lyn1dev

@lyn1dev lyn1dev commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Deep-copy the input flow in atomate2.common.powerups.add_metadata_to_flow and atomate2.common.powerups.update_custodian_handlers before calling update_maker_kwargs, matching all other powerups across vasp, cp2k, and abinit (which already deepcopy the input Job/Flow/Maker and leave the caller's object unchanged).
  • Update add_metadata_to_flow and custodian-handler powerup tests in tests/vasp/test_powerups.py and tests/cp2k/test_powerups.py to assert that a new Flow instance is returned and the original flow's maker kwargs are not mutated.

Closes #1666

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have autodoc documentation.

AI was used to write this code.

@JaGeo

JaGeo commented Nov 25, 2026

Copy link
Copy Markdown
Member

@lyn1dev could you replacw copy with deepcopy in the doc strings?

@lyn1dev

lyn1dev commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@JaGeo Updated both add_metadata_to_flow and update_custodian_handlers docstrings in src/atomate2/common/powerups.py to say "A deepcopy of the flow" in 1d628513ec8cfe8d7ee796771e63d03fcadc151b.

ruff check src/atomate2/common/powerups.py, ruff format --check src/atomate2/common/powerups.py, and pytest tests/vasp/test_powerups.py tests/cp2k/test_powerups.py -k "metadata or custodian" pass locally (8 passed).

@JaGeo
JaGeo merged commit e1907ed into materialsproject:main Nov 26, 2026
19 checks passed
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.

update_vasp_custodian_handlers and add_metadata_to_flow modify the input flow instead of returning a copy

2 participants