diff --git a/docs/conf.py b/docs/conf.py index 8056c878..9633b9a3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -202,6 +202,7 @@ "matplotlib": ("https://matplotlib.org/stable/", None), "qcengine": ("https://molssi.github.io/QCEngine/", None), "qcfractal": ("https://molssi.github.io/QCFractal/", None), + "nglview": ("https://nglviewer.org/nglview/release/v2.7.7", None), } # -- Options for todo extension ---------------------------------------------- diff --git a/qcelemental/models/basemodels.py b/qcelemental/models/basemodels.py index 2fecef26..15504b55 100644 --- a/qcelemental/models/basemodels.py +++ b/qcelemental/models/basemodels.py @@ -20,6 +20,8 @@ def _repr(self) -> str: class ProtoModel(BaseModel): + """QCSchema extension of pydantic.BaseModel.""" + class Config: allow_mutation: bool = False extra: str = "forbid" @@ -198,6 +200,8 @@ def compare(self, other: Union["ProtoModel", BaseModel], **kwargs) -> bool: # remove when QCFractal merges `next` class AutodocBaseSettings(BaseSettings): + """Old class for pydantic docstring before autodoc-pydantic came about.""" + def __init_subclass__(cls) -> None: cls.__doc__ = AutoPydanticDocGenerator(cls, always_apply=True) diff --git a/qcelemental/models/molecule.py b/qcelemental/models/molecule.py index ac278a02..005f7bf0 100644 --- a/qcelemental/models/molecule.py +++ b/qcelemental/models/molecule.py @@ -16,6 +16,12 @@ except ImportError: # Will also trap ModuleNotFoundError from pydantic import ConstrainedFloat, ConstrainedInt, Field, constr, validator +try: + # purely for docs-build. not required except for Molecule.show() + import nglview +except ModuleNotFoundError: + pass + # molparse imports separated b/c https://github.com/python/mypy/issues/7203 from ..molparse.from_arrays import from_arrays from ..molparse.from_schema import from_schema diff --git a/qcelemental/models/procedures.py b/qcelemental/models/procedures.py index 5aa7807f..c70146bd 100644 --- a/qcelemental/models/procedures.py +++ b/qcelemental/models/procedures.py @@ -72,6 +72,8 @@ class QCInputSpecification(ProtoModel): class OptimizationInput(ProtoModel): + """QCSchema input directive for geometry optimization.""" + id: Optional[str] = None hash_index: Optional[str] = None schema_name: constr( # type: ignore @@ -96,6 +98,8 @@ def __repr_args__(self) -> "ReprArgs": class OptimizationResult(OptimizationInput): + """QCSchema results model for geometry optimization.""" + schema_name: constr( # type: ignore strip_whitespace=True, regex=qcschema_optimization_output_default ) = qcschema_optimization_output_default