Commit a056d78
fix(rdkit): avoid deprecated explicit valence API (#969)
Problem
- RDKit deprecated `Atom.GetExplicitValence()` in recent releases, which
makes dpdata CI emit a deprecation warning.
- `dpdata.rdkit.sanitize.get_explicit_valence()` still called the
deprecated API directly.
Change
- Prefer `Atom.GetValence(Chem.ValenceType.EXPLICIT)` when available,
with a fallback to `Atom.GetExplicitValence()` for compatibility with
older RDKit versions.
- Add a focused unit test that verifies both the new-API path and the
legacy fallback path without requiring RDKit at test time.
Notes
- Fixes #968.
- Tests run: `python3 -m unittest tests/test_rdkit_sanitize.py`
Authored by OpenClaw (model: gpt-5.4)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## Release Notes
* **Chores**
* Enhanced compatibility by adding automatic version detection and
fallback support for different RDKit library versions to ensure
consistent behavior.
* **Tests**
* Added comprehensive test coverage to verify valence calculations work
correctly across different RDKit library versions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 38e8763 commit a056d78
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
17 | | - | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| |||
0 commit comments