Skip to content

Commit

Permalink
use the mock to avoid installation in sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed Aug 29, 2024
1 parent b8f1064 commit bdc0742
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 11 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,19 @@
#
import os
import sys
from unittest.mock import MagicMock

sys.path.insert(0, os.path.abspath("../"))
# List of modules to mock
MOCK_MODULES = ['torchani', 'lammps']

class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()

sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)


# -- Project information -----------------------------------------------------

Expand Down
5 changes: 1 addition & 4 deletions pyxtal/interface/lammpslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
from ase.constraints import UnitCellFilter, FixSymmetry
from ase.optimize import LBFGS
from ase.optimize.fire import FIRE
try:
from lammps import lammps
except:
raise NotImplementedError('PLZ INSTALL lammps first')
from lammps import lammps


#
Expand Down

0 comments on commit bdc0742

Please sign in to comment.