Skip to content

Commit 584b088

Browse files
authored
fix ImportError; add a check for it (#217)
1 parent f1859eb commit 584b088

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.github/workflows/test_import.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: test Python import
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v2
13+
with:
14+
python-version: '3.x'
15+
architecture: 'x64'
16+
- run: python -m pip install .
17+
- run: python -c 'import dpdata'
18+

dpdata/pymatgen/molecule.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import numpy as np
2-
from pymatgen.core import Molecule
2+
try:
3+
from pymatgen.core import Molecule
4+
except ImportError:
5+
pass
36
from collections import Counter
47
import dpdata
58

0 commit comments

Comments
 (0)