Skip to content

Commit

Permalink
Merge pull request #29 from calpolyccg/optional-nglview
Browse files Browse the repository at this point in the history
Make NGLView an optional dependency
  • Loading branch information
ALescoulie authored Jul 15, 2022
2 parents 2327cd4 + 32ef67b commit 6aa3335
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
5 changes: 3 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ channels:
- conda-forge
- defaults
dependencies:
- mdanalysis>=2.0.0, <2.1
- nglview>=3.0.3, <3.1
- mdanalysis
- nglview
- numpy
- openmm
- pandas
- pdbfixer
- psi4
- pytest
- pytest-cov
- pyyaml
- rdkit
1 change: 0 additions & 1 deletion mdsapt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from .reader import InputReader
from .optimizer import Optimizer
from .sapt import TrajectorySAPT
from .viewer import Viewer

# Handle versioneer
from ._version import get_versions
Expand Down
13 changes: 12 additions & 1 deletion mdsapt/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
Allows for visualization of trajectories using `NGLView <http://nglviewer.org>`_
in a Jupyter Notebook.
.. note::
This module only works if NGLView is installed. It is likely not
automatically installed by your package manager because it is an optional
dependency.
Required Input:
- :class:`-mdsapt.reader.InputReader
Expand All @@ -17,7 +22,13 @@

from typing import Union

import nglview as nv
try:
import nglview as nv
except ImportError:
raise ImportError(
"nglview is not installed! Please install it to use the viewer module."
)

import numpy as np

from .sapt import TrajectorySAPT
Expand Down
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ requirements:
run:
- psi4
- mdanalysis
- nglview
- numpy
- openmm
- pandas
Expand All @@ -39,6 +38,7 @@ test:
requires:
- pip
- pytest
- nglview
commands:
- pip check
# This is currently disabled because it does not work.
Expand Down

0 comments on commit 6aa3335

Please sign in to comment.