diff --git a/MANIFEST.in b/MANIFEST.in index 965b2dda..d61b8f2c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,9 +3,15 @@ include CONTRIBUTING.rst include HISTORY.rst include LICENSE include README.rst +include Makefile -recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] +recursive-include tests *.py -recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif +global-exclude *.py[co] +prune */*.egg-info +prune */*mypy_cache +prune */*ipynb_checkpoints +prune */__pycache__ + +prune docs +prune notebooks diff --git a/docs/conf.py b/docs/conf.py index 9cfb06d3..c0fdbb05 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -165,9 +165,18 @@ # the built documents. # # The short X.Y version. -version = thermoextrap.__version__ -# The full version, including alpha/beta/rc tags. -release = thermoextrap.__version__ +# versioning with scm with editable install has issues. +# instead, try to use scm if available. +try: + from setuptools_scm import get_version + + version = get_version(root="..", relative_to=__file__) + release = version +except ImportError: + version = thermoextrap.__version__ + # The full version, including alpha/beta/rc tags. + release = thermoextrap.__version__ + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/environment-tools.yaml b/environment-tools.yaml index ca215512..aca9efd1 100644 --- a/environment-tools.yaml +++ b/environment-tools.yaml @@ -1,5 +1,6 @@ # packages for development dependencies: + - matplotlib # linting # - black # - blackdoc diff --git a/environment.yaml b/environment.yaml index 5911a77c..fabb0650 100644 --- a/environment.yaml +++ b/environment.yaml @@ -5,12 +5,11 @@ channels: dependencies: - python>=3.8 - sympy - - matplotlib - numpy - scipy - xarray # - openmm - - cmomy + - cmomy>=0.1.9 - custom-inherit - attrs - pymbar<4.0 diff --git a/setup.cfg b/setup.cfg index 319a97b9..7d2412f0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,9 @@ classifiers = Programming Language :: Python :: 3.10 Topic :: Scientific/Engineering - +# TODO: fix optional dependcies. +# For now, matplotlib is a strong dependency. +# Also not sure about dask and bottleneck. [options] package_dir= =src @@ -32,11 +34,11 @@ zip_safe = True # if using mypy, must be False include_package_data = True python_requires = >=3.8 install_requires = - numpy >= 1.19 + numpy >= 1.20 xarray >= 0.16 sympy scipy - cmomy >= 0.1.7 + cmomy >= 0.1.9 custom-inherit attrs diff --git a/src/thermoextrap/gpr_active/active_utils.py b/src/thermoextrap/gpr_active/active_utils.py index 051a1aa1..4366e71b 100644 --- a/src/thermoextrap/gpr_active/active_utils.py +++ b/src/thermoextrap/gpr_active/active_utils.py @@ -4,7 +4,6 @@ import time import gpflow -import matplotlib.pyplot as plt import numpy as np import sympy as sp @@ -1046,6 +1045,9 @@ def do_plotting(self, x, y, err, alpha_list): Plots output used to select new update point. err is expected to be length 2 list with upper and lower confidence intervals """ + + import matplotlib.pyplot as plt + fig, ax = plt.subplots() if self.compare_func is not None: compare_y = self.compare_func(x[:, None]) diff --git a/src/thermoextrap/recursive_interp.py b/src/thermoextrap/recursive_interp.py index 93c8432f..5843ee58 100644 --- a/src/thermoextrap/recursive_interp.py +++ b/src/thermoextrap/recursive_interp.py @@ -17,11 +17,21 @@ try: import matplotlib.pyplot as plt + + _HAS_PLT = True except ImportError: - print( - "Could not find matplotlib - plotting will fail, so ensure that all" - " doPlot options are set to False, which is the default." - ) + _HAS_PLT = False + # print( + # "Could not find matplotlib - plotting will fail, so ensure that all" + # " doPlot options are set to False, which is the default." + # ) + + +def _has_plt(): + if _HAS_PLT: + pass + else: + raise ImportError("install matplotlib for this functionality") class RecursiveInterp: @@ -160,6 +170,7 @@ def recursiveTrain( # Do some plotting just as a visual for how things are going, if desired if doPlot: + _has_plt() if "val" in predictVals.dims: toplot = predictVals.isel(val=0) else: @@ -388,6 +399,7 @@ def checkPolynomialConsistency(self, doPlot=False): # Before loop, set up plot if wanted if doPlot: + _has_plt() pColors = plt.cm.cividis(np.linspace(0.0, 1.0, len(edgeSets))) pFig, pAx = plt.subplots() plotYmin = 1e10 @@ -450,6 +462,7 @@ def checkPolynomialConsistency(self, doPlot=False): plotYmax = np.max(allPlotY) if doPlot: + _has_plt() for edge in self.edgeB: pAx.plot([edge] * 2, [plotYmin, plotYmax], "k-") pAx.set_xlabel(r"$\beta$") diff --git a/tox.ini b/tox.ini index bcef9b20..e82222c4 100644 --- a/tox.ini +++ b/tox.ini @@ -175,16 +175,23 @@ conda_deps = {[base]conda_deps_test} conda-remote: {[base]package_name} conda-local: {posargs} + conda: pymbar<4.0 + deps = - pypi-remote: {[base]package_name} - pypi-local: {posargs} + pypi-remote: {[base]package_name}[mbar,gpr] + pypi-local: {posargs}[mbar,gpr] + conda: tensorflow + conda: tensorflow-probability + conda: gpflow + allowlist_externals = {[base]allowlist_externals} commands = {[base]commands_test_check} - pytest {toxinidir} + local: pytest {toxinidir} + remote: pytest {posargs} {toxinidir} # [testenv] # usedevelop =