docs(skills): add dpdata plugin skill#954
docs(skills): add dpdata plugin skill#954njzjz-bot wants to merge 2 commits intodeepmodeling:masterfrom
Conversation
📝 WalkthroughWalkthroughA comprehensive documentation guide is added explaining how to create and use external dpdata plugin packages, including the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #954 +/- ##
=======================================
Coverage 86.37% 86.37%
=======================================
Files 86 86
Lines 8086 8086
=======================================
Hits 6984 6984
Misses 1102 1102 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new “dpdata-plugin” skill document describing how to build and distribute external dpdata Format plugins via pyproject.toml entry points, and updates .gitignore to ignore common local uv development artifacts.
Changes:
- Add
skills/dpdata-plugin/SKILL.mddocumenting external plugin discovery and a minimal plugin package template. - Ignore
uv.lockand.venv/in.gitignorefor local development.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| skills/dpdata-plugin/SKILL.md | New skill documentation for creating/distributing external dpdata plugins via entry points |
| .gitignore | Ignore local uv lockfile and virtualenv directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
|
||
| So an external plugin package only needs to ensure that importing the entry-point target triggers the `@Format.register(...)` side effects. | ||
|
|
||
| ## Minimal external plugin package (based on plugin_example/) |
| def from_system(self, N, **kwargs): | ||
| return { | ||
| "atom_numbs": [20], | ||
| "atom_names": ["X"], | ||
| "atom_types": np.zeros(20, dtype=int), | ||
| "cells": np.repeat(np.eye(3)[None, ...], N, axis=0) * 100.0, | ||
| "coords": np.random.rand(N, 20, 3) * 100.0, |
| ### 4) Install and test | ||
|
|
||
| In a clean env (recommended via `uv`): | ||
|
|
||
| ```bash | ||
| uv run --with dpdata --with numpy python3 - <<'PY' | ||
| import dpdata | ||
| from dpdata.format import Format | ||
|
|
||
| # importing dpdata will load entry points (dpdata.plugins) | ||
| print('random' in Format.get_formats()) | ||
| PY |
|
CodSpeed flagged a small import-time regression. To minimize any chance of CI noise, I reverted the Authored by OpenClaw (model: gpt-5.2) |
|
Note: |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
skills/dpdata-plugin/SKILL.md (1)
108-113: Add a key-collision check to the debug checklistPlease add a checklist bullet to verify the registered key (e.g.,
random) does not collide with existing built-in or external plugin keys, since later-loaded plugins can overwrite prior registrations silently.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/dpdata-plugin/SKILL.md` around lines 108 - 113, Add a checklist bullet to skills/dpdata-plugin/SKILL.md under "Debug checklist" that instructs users to verify the plugin's registered key (e.g., the string passed to `@Format.register`, such as "random") doesn't collide with built-in or previously loaded plugin keys; specifically check the registry for existing keys before registering to avoid silent overwrites by later-loaded plugins.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/dpdata-plugin/SKILL.md`:
- Around line 94-104: The verification snippet fails because the example plugin
package isn't installed into the uv environment, so Format.get_formats() won't
include the "random" entry; fix the SKILL.md example by installing the plugin
into the uv environment before running the test (e.g., run uv pip install -e .
prior to uv run) so that dpdata's entry points are registered and
Format.get_formats() returns True.
---
Nitpick comments:
In `@skills/dpdata-plugin/SKILL.md`:
- Around line 108-113: Add a checklist bullet to skills/dpdata-plugin/SKILL.md
under "Debug checklist" that instructs users to verify the plugin's registered
key (e.g., the string passed to `@Format.register`, such as "random") doesn't
collide with built-in or previously loaded plugin keys; specifically check the
registry for existing keys before registering to avoid silent overwrites by
later-loaded plugins.
🪄 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: d1ada6e5-1002-453c-aacd-8ad8e4814222
📒 Files selected for processing (1)
skills/dpdata-plugin/SKILL.md
| In a clean env (recommended via `uv`): | ||
|
|
||
| ```bash | ||
| uv run --with dpdata --with numpy python3 - <<'PY' | ||
| import dpdata | ||
| from dpdata.format import Format | ||
|
|
||
| # importing dpdata will load entry points (dpdata.plugins) | ||
| print('random' in Format.get_formats()) | ||
| PY | ||
| ``` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify the current install/test snippet does not install the example plugin package.
fd -a SKILL.md | xargs rg -n -C2 "uv run --with dpdata --with numpy|Format.get_formats|uv pip install -e \."Repository: deepmodeling/dpdata
Length of output: 803
🏁 Script executed:
# Find pyproject.toml or setup.py in the skills/dpdata-plugin directory
find skills/dpdata-plugin -maxdepth 2 -name "pyproject.toml" -o -name "setup.py"Repository: deepmodeling/dpdata
Length of output: 45
🏁 Script executed:
# Check the overall structure of the skill directory
cd skills/dpdata-plugin && find . -maxdepth 2 -type f | head -20Repository: deepmodeling/dpdata
Length of output: 73
🏁 Script executed:
# Search for 'random' format definition in the skills directory
rg -r "random" skills/dpdata-plugin/ | grep -i "format\|class"Repository: deepmodeling/dpdata
Length of output: 45
🏁 Script executed:
# List the entire structure of skills/dpdata-plugin
cd skills/dpdata-plugin && ls -laRepository: deepmodeling/dpdata
Length of output: 231
🏁 Script executed:
# Look for 'random' format implementation in the main dpdata codebase
rg -r "random" dpdata/ | grep -i "class.*Format\|def.*random" | head -10Repository: deepmodeling/dpdata
Length of output: 45
🏁 Script executed:
# Check if there's a README or explanation about skills in the repo
find . -maxdepth 2 -name "README*" -o -name "AGENTS*"Repository: deepmodeling/dpdata
Length of output: 113
🏁 Script executed:
# Check the AGENTS.md file to understand the context
cat AGENTS.mdRepository: deepmodeling/dpdata
Length of output: 7323
🏁 Script executed:
# Check the plugin_example directory
ls -la plugin_example/Repository: deepmodeling/dpdata
Length of output: 359
🏁 Script executed:
# Read the full SKILL.md file to get complete context
cat skills/dpdata-plugin/SKILL.mdRepository: deepmodeling/dpdata
Length of output: 3238
Verification command must install the plugin package first
The test on Line 97 will print False instead of True because the example plugin package (dpdata_random) is never installed in the uv run environment. Without uv pip install -e ., the entry point is not registered and plugin discovery fails.
✅ Suggested fix
### 4) Install and test
In a clean env (recommended via `uv`):
```bash
+uv pip install -e .
uv run --with dpdata --with numpy python3 - <<'PY'
import dpdata
from dpdata.format import Format
# importing dpdata will load entry points (dpdata.plugins)
print('random' in Format.get_formats())
PY</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
```suggestion
In a clean env (recommended via `uv`):
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@skills/dpdata-plugin/SKILL.md` around lines 94 - 104, The verification
snippet fails because the example plugin package isn't installed into the uv
environment, so Format.get_formats() won't include the "random" entry; fix the
SKILL.md example by installing the plugin into the uv environment before running
the test (e.g., run uv pip install -e . prior to uv run) so that dpdata's entry
points are registered and Format.get_formats() returns True.
This PR adds an Agent Skill under
skills/describing how to create and install external dpdata plugins (Format.register +project.entry-points."dpdata.plugins").Authored by OpenClaw (model: gpt-5.2)
Summary by CodeRabbit