fix(dpdata): use public format APIs#1880
Conversation
📝 WalkthroughWalkthroughThe pull request refactors import paths across three modules to use dpdata's new Changesdpdata Import Path Migration
🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
538c76d to
9bff68b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1880 +/- ##
==========================================
- Coverage 49.81% 49.80% -0.01%
==========================================
Files 83 83
Lines 14988 14986 -2
==========================================
- Hits 7466 7464 -2
Misses 7522 7522 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dpgen/generator/lib/abacus_scf.py`:
- Line 6: The import path is wrong: replace the non-existent module
dpdata.formats.abacus.stru with dpdata.abacus.stru wherever get_frame_from_stru
and make_unlabeled_stru are imported (e.g., in the module that currently imports
from dpdata.formats.abacus.stru and the similar import in the other test
module). Update the import statement to import get_frame_from_stru and
make_unlabeled_stru from dpdata.abacus.stru so the runtime can find those
symbols.
In `@dpgen/generator/run.py`:
- Line 32: The import dpdata.formats.siesta.output is invalid and should be
changed to dpdata.siesta.output; update the import statement in
dpgen/generator/run.py to import from dpdata.siesta.output and ensure any
references that expect the old package path (the code that uses the siesta
output module later in this file) continue to refer to the same symbols from the
corrected import; this fixes the ImportError when importing dpgen.generator.run.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a4f52112-0576-4de0-9ae8-9490252c1365
📒 Files selected for processing (3)
dpgen/auto_test/lib/abacus.pydpgen/generator/lib/abacus_scf.pydpgen/generator/run.py
21afda3 to
63e9bbc
Compare
Avoid importing dpdata backend parser modules directly. Use dpdata's registered public format interface for ABACUS STRU, VASP POSCAR, and SIESTA output handling so DP-GEN works with both dpdata 0.2.x and 1.x without depending on moved backend module paths. Authored by OpenClaw (model: gpt-5.5)
876dfae to
1053cfd
Compare
Problem
dpdata.abacus.stru, which breaks DP-GEN imports with the latest dpdata release.Change
dpdata.System(..., fmt=...)/System.to(...)calls.dpdata.LabeledSystem(..., fmt="siesta/output").type_mappath compatible with dpdata 1.x by normalizingatom_typesbefore applying the type map.Test
dpdata==1.0.2:python -m pytest tests/data/test_disturb_abacus.py tests/auto_test/test_abacus.py tests/generator/test_post_fp.py::TestPostFPABACUS::test_nframs_with_failed_job tests/generator/test_post_fp.py::TestPostFPSIESTA -qdpdata==0.2.25: same targeted pytest command above.uvx ruff check dpgen/auto_test/lib/abacus.py dpgen/generator/lib/abacus_scf.py dpgen/generator/run.pyAuthored by OpenClaw (model: gpt-5.5)