From a888c401f93461629c3eb8276aa141fffec03932 Mon Sep 17 00:00:00 2001 From: Kirk Bonney <47759761+kbonney@users.noreply.github.com> Date: Thu, 9 Nov 2023 12:35:09 -0500 Subject: [PATCH] Make IV capabilities optional (#90) * making iv optional * add iv option to testing workflow --- .github/workflows/lint-and-test.yml | 2 +- .readthedocs.yml | 2 +- docs/pages/moduleguides/iv.rst | 6 +++++- pvops/__init__.py | 7 ++++++- setup.py | 10 +++++++--- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index cc4edb6..3688245 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -18,7 +18,7 @@ jobs: - name: Install pvops run: | python -m pip install --upgrade pip - pip install . + pip install .[iv] - name: Test with pytest run: | pip install pytest pytest-cov diff --git a/.readthedocs.yml b/.readthedocs.yml index 58ef933..88bf276 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -15,4 +15,4 @@ python: - method: pip path: . extra_requirements: - - doc + - doc, iv diff --git a/docs/pages/moduleguides/iv.rst b/docs/pages/moduleguides/iv.rst index 19efbad..d0c65dc 100644 --- a/docs/pages/moduleguides/iv.rst +++ b/docs/pages/moduleguides/iv.rst @@ -4,10 +4,14 @@ IV Guide Module Overview ---------------- - These functions focus on current-voltage (IV) curve simulation and classification. +.. note:: + To use the capabilites in this module, pvOps must be installed with the ``iv`` option: + ``pip install pvops[iv]``. + + Tutorials that exemplify usage can be found at: - `tutorial_iv_classifier.ipynb `_. - `tutorial_iv_diode_extractor.ipynb `_. diff --git a/pvops/__init__.py b/pvops/__init__.py index b5fea55..399b8ad 100644 --- a/pvops/__init__.py +++ b/pvops/__init__.py @@ -1,7 +1,12 @@ +import warnings from pvops import text from pvops import text2time from pvops import timeseries -from pvops import iv +try: + from pvops import iv +except ModuleNotFoundError: + # warnings.warn("") + pass __version__ = '0.2.0' diff --git a/setup.py b/setup.py index fd7db51..62f0998 100644 --- a/setup.py +++ b/setup.py @@ -49,8 +49,6 @@ 'pvlib', 'pvanalytics', 'timezonefinder', - 'pyDOE', - 'tensorflow', ] DOCS_REQUIRE = [ @@ -66,8 +64,14 @@ 'sphinx_rtd_theme==1.3.0', ] +IV_REQUIRE = [ + 'keras', + 'tensorflow', + 'pyDOE', +] + EXTRAS_REQUIRE = { - 'optional': ['ruptures'], + 'iv': IV_REQUIRE, 'test': TESTS_REQUIRE, 'doc': DOCS_REQUIRE }