From 91e14826bcf5d95920c41521dfe22b5da76b010b Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Fri, 17 May 2019 16:26:26 -0600 Subject: [PATCH 01/12] Drop Python 2 and 3.4 --- .travis.yml | 14 ++------------ README.md | 5 ++--- ci/requirements-py27-min.yml | 10 ---------- ci/requirements-py27.yml | 23 ----------------------- ci/requirements-py34.yml | 21 --------------------- docs/environment.yml | 1 - docs/sphinx/source/contributing.rst | 2 +- docs/sphinx/source/installation.rst | 2 +- docs/sphinx/source/whatsnew.rst | 1 + docs/sphinx/source/whatsnew/v0.7.0.rst | 15 +++++++++++++++ setup.py | 3 --- 11 files changed, 22 insertions(+), 75 deletions(-) delete mode 100644 ci/requirements-py27-min.yml delete mode 100644 ci/requirements-py27.yml delete mode 100644 ci/requirements-py34.yml create mode 100644 docs/sphinx/source/whatsnew/v0.7.0.rst diff --git a/.travis.yml b/.travis.yml index 66731cf911..39055c2f1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,6 @@ sudo: false # if false, use TravisCI's container based build # someday add os: osx to specify osx, but python not yet supported on Travis matrix: include: - - python: 2.7 - env: CONDA_ENV=py27-min - - python: 2.7 - env: CONDA_ENV=py27 - - python: 3.4 - env: CONDA_ENV=py34 - python: 3.5 env: CONDA_ENV=py35 - python: 3.6 @@ -24,7 +18,7 @@ matrix: - CONDA_ENV=py36 - TASK="coverage" - DEPLOY_ENV="true" - - python: 3.6 + - python: 3.7 env: CONDA_ENV=py37 addons: @@ -38,11 +32,7 @@ cache: # setup miniconda for numpy, scipy, pandas, etc. before_install: - echo "before install" - - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then - export PYVER="2"; - else - export PYVER="3"; - fi + - export PYVER="3" - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export OSSTR="MacOSX-x86_64.sh"; else diff --git a/README.md b/README.md index b2a4569289..168b9e131c 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,9 @@ Installation pvlib-python releases may be installed using the ``pip`` and ``conda`` tools. Please see the [Installation page](http://pvlib-python.readthedocs.io/en/latest/installation.html) of the documentation for complete instructions. -pvlib-python is compatible with Python versions 2.7 and 3.4-3.7. +pvlib-python is compatible with Python 3.5-7. -**Python 2.7 support will end on June 1, 2019**. Releases made after this -date will require Python 3. +**Python 2.7 support ended on June 1, 2019**. Contributing diff --git a/ci/requirements-py27-min.yml b/ci/requirements-py27-min.yml deleted file mode 100644 index ecac0a4857..0000000000 --- a/ci/requirements-py27-min.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: test_env -dependencies: - - python=2.7 - - pytz - - pytest - - pytest-cov - - pytest-mock - - nose - - pip: - - coveralls diff --git a/ci/requirements-py27.yml b/ci/requirements-py27.yml deleted file mode 100644 index d69a1b8ad8..0000000000 --- a/ci/requirements-py27.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: test_env -channels: - - defaults - - conda-forge -dependencies: - - python=2.7 - - numpy - - scipy - - pytables - - pandas - - pytz - - ephem - - numba - - siphon - - pytest - - pytest-cov - - nose - - shapely # pvfactors dependency - - pip: - - coveralls - - pytest-mock - - pytest-timeout - - pvfactors==1.0.1 diff --git a/ci/requirements-py34.yml b/ci/requirements-py34.yml deleted file mode 100644 index 93efa85ebf..0000000000 --- a/ci/requirements-py34.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: test_env -channels: - - conda-forge - - defaults -dependencies: - - python=3.4 - - numpy - - scipy - - pytables - - pandas - - pytz - - ephem - - numba - - siphon - - pytest - - pytest-cov - - nose - - pip: - - coveralls - - pytest-mock - - pytest-timeout diff --git a/docs/environment.yml b/docs/environment.yml index e7eaa0e36e..67e0067d0b 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -4,7 +4,6 @@ channels: - defaults dependencies: - python=3.6 - - mock # needed for local python 2.7 builds - numpy=1.14.2 - scipy - pytables diff --git a/docs/sphinx/source/contributing.rst b/docs/sphinx/source/contributing.rst index 25e82d6017..088c93af2a 100644 --- a/docs/sphinx/source/contributing.rst +++ b/docs/sphinx/source/contributing.rst @@ -196,7 +196,7 @@ pvlib python generally follows the `PEP 8 -- Style Guide for Python Code `_. Maximum line length for code is 79 characters. -Code must be compatible with python 2.7 and 3.4+. +Code must be compatible with Python 3.5-7. pvlib python uses a mix of full and abbreviated variable names. See :ref:`variables_style_rules`. We could be better about consistency. diff --git a/docs/sphinx/source/installation.rst b/docs/sphinx/source/installation.rst index f2a6b7a5d0..f533fd580f 100644 --- a/docs/sphinx/source/installation.rst +++ b/docs/sphinx/source/installation.rst @@ -216,7 +216,7 @@ environment) when you start a new shell or terminal. Compatibility ------------- -pvlib-python is compatible with Python versions 2.7 and 3.4-3.7. +pvlib-python is compatible with Python 3.5-7. pvlib-python requires Pandas and Numpy. The minimum version requirements are specified in diff --git a/docs/sphinx/source/whatsnew.rst b/docs/sphinx/source/whatsnew.rst index 1250e8e05c..c3bea7c2d7 100644 --- a/docs/sphinx/source/whatsnew.rst +++ b/docs/sphinx/source/whatsnew.rst @@ -6,6 +6,7 @@ What's New These are new features and improvements of note in each release. +.. include:: whatsnew/v0.7.0.rst .. include:: whatsnew/v0.6.3.rst .. include:: whatsnew/v0.6.2.rst .. include:: whatsnew/v0.6.1.rst diff --git a/docs/sphinx/source/whatsnew/v0.7.0.rst b/docs/sphinx/source/whatsnew/v0.7.0.rst new file mode 100644 index 0000000000..cf2adfc9e6 --- /dev/null +++ b/docs/sphinx/source/whatsnew/v0.7.0.rst @@ -0,0 +1,15 @@ +.. _whatsnew_0700: + +v0.7.0 (MONTH DAY, YEAR) +--------------------- + +This is a major release that drops support for Python 2 and Python 3.4. We +recommend all users of v0.6.3 upgrade to this release. + +**Python 2.7 support ended on June 1, 2019**. (:issue:`501`) + + +Contributors +~~~~~~~~~~~~ +* Mark Campanellli (:ghuser:`markcampanelli`) +* Will Holmgren (:ghuser:`wholmgren`) diff --git a/setup.py b/setup.py index 0a43d8076b..09859e22ff 100755 --- a/setup.py +++ b/setup.py @@ -58,10 +58,7 @@ 'Operating System :: OS Independent', 'Intended Audience :: Science/Research', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', From 62077544f7e6014c8b8021f472f02749ef1dc10d Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Fri, 17 May 2019 18:16:47 -0600 Subject: [PATCH 02/12] Fix travis for 3.7 and update azure --- .travis.yml | 11 ++--------- azure-pipelines.yml | 4 ---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39055c2f1f..74ae0f6616 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,8 @@ matrix: - DEPLOY_ENV="true" - python: 3.7 env: CONDA_ENV=py37 - + dist: xenial + sudo: true addons: apt: packages: @@ -53,14 +54,6 @@ install: - echo "install" - conda env create --file ci/requirements-$CONDA_ENV.yml - source activate test_env # all envs are named test_env in the yml files - # needed to make sure that pandas is compiled against the right - # version of numpy - - if [[ "$CONDA_ENV" == "py27-min" ]]; then - pip uninstall numpy --yes; - pip uninstall pandas --yes; - pip install --no-cache-dir numpy==1.10.1; - pip install --no-cache-dir pandas==0.16.0; - fi - conda list - echo $PATH - ls -l /home/travis/miniconda/envs/test_env/lib diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 69d516f01c..e81111e233 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,8 +13,6 @@ jobs: strategy: matrix: - Python27: - python.version: '27' Python35: python.version: '35' Python36: @@ -68,8 +66,6 @@ jobs: strategy: matrix: - Python27-windows: - python.version: '27' Python35-windows: python.version: '35' Python36-windows: From 5dafd6c12d9282ca073955cb7db0963cdbbeead4 Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Fri, 17 May 2019 19:45:44 -0600 Subject: [PATCH 03/12] Remove six dependency --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 09859e22ff..f6f6430f9d 100755 --- a/setup.py +++ b/setup.py @@ -41,7 +41,6 @@ 'pandas >= 0.16.0', 'pytz', 'requests', - 'six', ] TESTS_REQUIRE = ['pytest', 'pytest-cov', 'pytest-mock', 'nose'] EXTRAS_REQUIRE = { From e381237d751eb235d14dc908e9c5ea07ab3d222b Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 11:42:24 -0600 Subject: [PATCH 04/12] Add min Travis build with consistent requirements and fixed tests --- .travis.yml | 9 +++--- README.md | 2 +- ci/requirements-py35-min.yml | 16 +++++++++++ ci/requirements-py35.yml | 26 +++++++++-------- ci/requirements-py36.yml | 26 +++++++++-------- ci/requirements-py37.yml | 26 +++++++++-------- docs/environment.yml | 37 ++++++++++++++++--------- docs/sphinx/source/installation.rst | 2 +- pvlib/__init__.py | 7 +++++ pvlib/test/test_pvsystem.py | 43 +++++++++++++++-------------- setup.py | 6 ++-- 11 files changed, 124 insertions(+), 76 deletions(-) create mode 100644 ci/requirements-py35-min.yml diff --git a/.travis.yml b/.travis.yml index 74ae0f6616..7884982ead 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ sudo: false # if false, use TravisCI's container based build # someday add os: osx to specify osx, but python not yet supported on Travis matrix: include: + - python: 3.5 + env: CONDA_ENV=py35-min - python: 3.5 env: CONDA_ENV=py35 - python: 3.6 @@ -18,10 +20,9 @@ matrix: - CONDA_ENV=py36 - TASK="coverage" - DEPLOY_ENV="true" - - python: 3.7 + - python: 3.6 env: CONDA_ENV=py37 - dist: xenial - sudo: true + addons: apt: packages: @@ -41,7 +42,7 @@ before_install: export PATH=/usr/lib/ccache:$PATH; fi - export BASE="http://repo.continuum.io/miniconda/Miniconda" - - export CONDAVER="4.5.4" + - export CONDAVER="4.6.14" - wget $BASE$PYVER-$CONDAVER-$OSSTR -O miniconda.sh; - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" diff --git a/README.md b/README.md index 168b9e131c..0ef095351f 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Please see the [Installation page](http://pvlib-python.readthedocs.io/en/latest/ pvlib-python is compatible with Python 3.5-7. -**Python 2.7 support ended on June 1, 2019**. +**Python 2.7 support ended on June 1, 2019, with pvlib-python 0.6.3.** Contributing diff --git a/ci/requirements-py35-min.yml b/ci/requirements-py35-min.yml new file mode 100644 index 0000000000..867318439a --- /dev/null +++ b/ci/requirements-py35-min.yml @@ -0,0 +1,16 @@ +name: test_env +channels: + - defaults +dependencies: + - coveralls + - nose + - numpy=1.10.1 + - pandas=0.18.0 + - pip + - pytest + - pytest-cov + - pytest-mock + - pytest-timeout + - python=3.5 + - pytz + - requests diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index 0ebcf6e806..65b5c76d00 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -3,21 +3,25 @@ channels: - defaults - conda-forge dependencies: - - python=3.5 - - numpy - - scipy - - pytables - - pandas - - pytz + - coveralls + - cython - ephem + - netcdf4 + - nose - numba - - siphon + - numpy + - pandas + - pip + - pytables # tables when using pip+PyPI - pytest - pytest-cov - - nose + - pytest-mock + - pytest-timeout + - python=3.5 + - pytz + - requests + - scipy - shapely # pvfactors dependency + - siphon # conda-forge - pip: - - coveralls - - pytest-mock - - pytest-timeout - pvfactors==1.0.1 diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index bddcd80f5e..a21bce2579 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -3,21 +3,25 @@ channels: - defaults - conda-forge dependencies: - - python=3.6 - - numpy - - scipy - - pytables - - pandas - - pytz + - coveralls + - cython - ephem + - netcdf4 + - nose - numba - - siphon + - numpy + - pandas + - pip + - pytables # tables when using pip+PyPI - pytest - pytest-cov - - nose + - pytest-mock + - pytest-timeout + - python=3.6 + - pytz + - requests + - scipy - shapely # pvfactors dependency + - siphon # conda-forge - pip: - - coveralls - - pytest-mock - - pytest-timeout - pvfactors==1.0.1 diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index aa2aa17eaf..3783e8f772 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -3,21 +3,25 @@ channels: - defaults - conda-forge dependencies: - - python=3.7 - - numpy - - scipy - - pytables - - pandas - - pytz + - coveralls + - cython - ephem + - netcdf4 + - nose - numba - - siphon + - numpy + - pandas + - pip + - pytables # tables when using pip+PyPI - pytest - pytest-cov - - nose + - pytest-mock + - pytest-timeout + - python=3.7 + - pytz + - requests + - scipy - shapely # pvfactors dependency + - siphon # conda-forge - pip: - - coveralls - - pytest-mock - - pytest-timeout - pvfactors==1.0.1 diff --git a/docs/environment.yml b/docs/environment.yml index 67e0067d0b..5c0ed6646c 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -3,18 +3,29 @@ channels: - conda-forge - defaults dependencies: - - python=3.6 - - numpy=1.14.2 - - scipy - - pytables - - pandas=0.22.0 - - pytz + - coveralls + - cython - ephem + - ipython + - matplotlib + - netcdf4 + - nose - numba - - ipython=6.3 - - matplotlib=2.2.2 - - siphon=0.7.0 - - sphinx=1.7.2 - - netCDF4=1.3.1 - - hdf4=4.2.12 - - sphinx_rtd_theme + - numpy + - pandas + - pip + - pytables # tables when using pip+PyPI + - pytest + - pytest-cov + - pytest-mock + - pytest-timeout + - python=3.6 + - pytz + - requests + - scipy + - shapely # pvfactors dependency + - siphon # conda-forge + - sphinx + - sphinx_rtd_theme + - pip: + - pvfactors==1.0.1 diff --git a/docs/sphinx/source/installation.rst b/docs/sphinx/source/installation.rst index f533fd580f..7deafd1bc9 100644 --- a/docs/sphinx/source/installation.rst +++ b/docs/sphinx/source/installation.rst @@ -228,7 +228,7 @@ be installed separately using pip or conda. These packages/features include: * scipy: single diode model, clear sky detection -* pytables: Linke turbidity look up for clear sky models +* pytables (tables on PyPI): Linke turbidity look up for clear sky models * numba: fastest solar position calculations * pyephem: solar positions calculations using an astronomical library * siphon: forecasting PV power using the pvlib.forecast module diff --git a/pvlib/__init__.py b/pvlib/__init__.py index 238d481615..52d928bf95 100644 --- a/pvlib/__init__.py +++ b/pvlib/__init__.py @@ -1,3 +1,10 @@ +# First ensure proper Python version. +import sys +if not ((3, 5) <= sys.version_info and sys.version_info <= (3, 7)): + raise RuntimeError("Current Python version is {}.{}.{}, but pvlib-python \ +is only compatible with Python 3.5-7.".format( + sys.version_info[0], sys.version_info[1], sys.version_info[2])) + from pvlib.version import __version__ from pvlib import tools from pvlib import atmosphere diff --git a/pvlib/test/test_pvsystem.py b/pvlib/test/test_pvsystem.py index cd7679f323..27b685c5cc 100644 --- a/pvlib/test/test_pvsystem.py +++ b/pvlib/test/test_pvsystem.py @@ -442,27 +442,28 @@ def test_calcparams_pvsyst(pvsyst_module_params): temp_cell = pd.Series([25, 50], index=times) IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_pvsyst( - effective_irradiance, - temp_cell, - alpha_sc=pvsyst_module_params['alpha_sc'], - gamma_ref=pvsyst_module_params['gamma_ref'], - mu_gamma=pvsyst_module_params['mu_gamma'], - I_L_ref=pvsyst_module_params['I_L_ref'], - I_o_ref=pvsyst_module_params['I_o_ref'], - R_sh_ref=pvsyst_module_params['R_sh_ref'], - R_sh_0=pvsyst_module_params['R_sh_0'], - R_s=pvsyst_module_params['R_s'], - cells_in_series=pvsyst_module_params['cells_in_series'], - EgRef=pvsyst_module_params['EgRef']) - - assert_series_equal(np.round(IL, 3), pd.Series([0.0, 4.8200], index=times)) - assert_series_equal(np.round(I0, 3), - pd.Series([0.0, 1.47e-7], index=times)) + effective_irradiance, + temp_cell, + alpha_sc=pvsyst_module_params['alpha_sc'], + gamma_ref=pvsyst_module_params['gamma_ref'], + mu_gamma=pvsyst_module_params['mu_gamma'], + I_L_ref=pvsyst_module_params['I_L_ref'], + I_o_ref=pvsyst_module_params['I_o_ref'], + R_sh_ref=pvsyst_module_params['R_sh_ref'], + R_sh_0=pvsyst_module_params['R_sh_0'], + R_s=pvsyst_module_params['R_s'], + cells_in_series=pvsyst_module_params['cells_in_series'], + EgRef=pvsyst_module_params['EgRef']) + + assert_series_equal( + IL.round(decimals=3), pd.Series([0.0, 4.8200], index=times)) + assert_series_equal( + I0.round(decimals=3), pd.Series([0.0, 1.47e-7], index=times)) assert_allclose(Rs, 0.500) - assert_series_equal(np.round(Rsh, 3), - pd.Series([1000.0, 305.757], index=times)) - assert_series_equal(np.round(nNsVth, 4), - pd.Series([1.6186, 1.7961], index=times)) + assert_series_equal( + Rsh.round(decimals=3), pd.Series([1000.0, 305.757], index=times)) + assert_series_equal( + nNsVth.round(decimals=4), pd.Series([1.6186, 1.7961], index=times)) def test_PVSystem_calcparams_desoto(cec_module_params, mocker): @@ -1239,7 +1240,7 @@ def test_PVSystem_creation(): def test_PVSystem_get_aoi(): system = pvsystem.PVSystem(surface_tilt=32, surface_azimuth=135) aoi = system.get_aoi(30, 225) - assert np.round(aoi, 4) == 42.7408 + assert np.around(aoi, decimals=4) == 42.7408 def test_PVSystem_get_irradiance(): diff --git a/setup.py b/setup.py index f6f6430f9d..cc4c5ba493 100755 --- a/setup.py +++ b/setup.py @@ -40,9 +40,9 @@ INSTALL_REQUIRES = ['numpy >= 1.10.1', 'pandas >= 0.16.0', 'pytz', - 'requests', - ] -TESTS_REQUIRE = ['pytest', 'pytest-cov', 'pytest-mock', 'nose'] + 'requests'] +TESTS_REQUIRE = ['nose', 'pytest', 'pytest-cov', 'pytest-mock', + 'pytest-timeout'] EXTRAS_REQUIRE = { 'optional': ['scipy', 'tables', 'numba', 'siphon', 'netcdf4', 'ephem', 'cython', 'pvfactors'], From ef4168d798ca6a609a49fdaf413f736b0773b896 Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 11:51:29 -0600 Subject: [PATCH 05/12] Pin pvfactors also in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cc4c5ba493..513edfc64d 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout'] EXTRAS_REQUIRE = { 'optional': ['scipy', 'tables', 'numba', 'siphon', 'netcdf4', - 'ephem', 'cython', 'pvfactors'], + 'ephem', 'cython', 'pvfactors == 1.0.1'], 'doc': ['sphinx', 'ipython', 'sphinx_rtd_theme', 'matplotlib'], 'test': TESTS_REQUIRE } From 554c104f47dd9bb74a2158d22c0f73293633f592 Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 12:09:10 -0600 Subject: [PATCH 06/12] Fix python version comparison for 3.7 patches --- pvlib/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/__init__.py b/pvlib/__init__.py index 52d928bf95..08903310d3 100644 --- a/pvlib/__init__.py +++ b/pvlib/__init__.py @@ -1,6 +1,6 @@ # First ensure proper Python version. import sys -if not ((3, 5) <= sys.version_info and sys.version_info <= (3, 7)): +if not ((3, 5) <= sys.version_info and sys.version_info < (3, 8)): raise RuntimeError("Current Python version is {}.{}.{}, but pvlib-python \ is only compatible with Python 3.5-7.".format( sys.version_info[0], sys.version_info[1], sys.version_info[2])) From 7406bb100dc1310b21122226c4947c77b7a8ce95 Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 12:16:52 -0600 Subject: [PATCH 07/12] Revert unneeded test change --- pvlib/test/test_pvsystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/test/test_pvsystem.py b/pvlib/test/test_pvsystem.py index 27b685c5cc..2fd556fb92 100644 --- a/pvlib/test/test_pvsystem.py +++ b/pvlib/test/test_pvsystem.py @@ -1240,7 +1240,7 @@ def test_PVSystem_creation(): def test_PVSystem_get_aoi(): system = pvsystem.PVSystem(surface_tilt=32, surface_azimuth=135) aoi = system.get_aoi(30, 225) - assert np.around(aoi, decimals=4) == 42.7408 + assert np.round(aoi, 4) == 42.7408 def test_PVSystem_get_irradiance(): From 38547468bed288b2a3df60f0be6666b9c894fb1a Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 12:41:45 -0600 Subject: [PATCH 08/12] Remove Python 2 mock usages --- pvlib/test/test_location.py | 6 +----- pvlib/test/test_modelchain.py | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pvlib/test/test_location.py b/pvlib/test/test_location.py index 7381322121..db32ac5970 100644 --- a/pvlib/test/test_location.py +++ b/pvlib/test/test_location.py @@ -1,9 +1,5 @@ import datetime -try: - from unittest.mock import ANY -except ImportError: - # python 2 - from mock import ANY +from unittest.mock import ANY import numpy as np from numpy import nan diff --git a/pvlib/test/test_modelchain.py b/pvlib/test/test_modelchain.py index 9f4a228116..5b3c556533 100644 --- a/pvlib/test/test_modelchain.py +++ b/pvlib/test/test_modelchain.py @@ -1,9 +1,5 @@ import sys -try: - from unittest.mock import ANY -except ImportError: - # python 2 - from mock import ANY +from unittest.mock import ANY import numpy as np import pandas as pd From 990ea4ed7b95f12db372f798636127533be2b0e1 Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 12:54:22 -0600 Subject: [PATCH 09/12] Address code review comments --- README.md | 2 +- docs/environment.yml | 37 ++++++++++------------------- docs/sphinx/source/conf.py | 6 ++--- docs/sphinx/source/contributing.rst | 2 +- docs/sphinx/source/installation.rst | 5 ++-- pvlib/__init__.py | 7 ------ setup.py | 8 +++---- 7 files changed, 23 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 0ef095351f..d9ae7739da 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Installation pvlib-python releases may be installed using the ``pip`` and ``conda`` tools. Please see the [Installation page](http://pvlib-python.readthedocs.io/en/latest/installation.html) of the documentation for complete instructions. -pvlib-python is compatible with Python 3.5-7. +pvlib-python is compatible with Python 3.5 and above. **Python 2.7 support ended on June 1, 2019, with pvlib-python 0.6.3.** diff --git a/docs/environment.yml b/docs/environment.yml index 5c0ed6646c..67e0067d0b 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -3,29 +3,18 @@ channels: - conda-forge - defaults dependencies: - - coveralls - - cython - - ephem - - ipython - - matplotlib - - netcdf4 - - nose - - numba - - numpy - - pandas - - pip - - pytables # tables when using pip+PyPI - - pytest - - pytest-cov - - pytest-mock - - pytest-timeout - python=3.6 - - pytz - - requests + - numpy=1.14.2 - scipy - - shapely # pvfactors dependency - - siphon # conda-forge - - sphinx - - sphinx_rtd_theme - - pip: - - pvfactors==1.0.1 + - pytables + - pandas=0.22.0 + - pytz + - ephem + - numba + - ipython=6.3 + - matplotlib=2.2.2 + - siphon=0.7.0 + - sphinx=1.7.2 + - netCDF4=1.3.1 + - hdf4=4.2.12 + - sphinx_rtd_theme diff --git a/docs/sphinx/source/conf.py b/docs/sphinx/source/conf.py index d09c7a71e9..119aadc0a7 100644 --- a/docs/sphinx/source/conf.py +++ b/docs/sphinx/source/conf.py @@ -16,10 +16,8 @@ import os # Mock modules so RTD works -try: - from mock import Mock as MagicMock -except ImportError: - from unittest.mock import MagicMock +from unittest.mock import MagicMock + class Mock(MagicMock): @classmethod diff --git a/docs/sphinx/source/contributing.rst b/docs/sphinx/source/contributing.rst index 088c93af2a..ca3efbcfbb 100644 --- a/docs/sphinx/source/contributing.rst +++ b/docs/sphinx/source/contributing.rst @@ -196,7 +196,7 @@ pvlib python generally follows the `PEP 8 -- Style Guide for Python Code `_. Maximum line length for code is 79 characters. -Code must be compatible with Python 3.5-7. +Code must be compatible with Python 3.5 and above. pvlib python uses a mix of full and abbreviated variable names. See :ref:`variables_style_rules`. We could be better about consistency. diff --git a/docs/sphinx/source/installation.rst b/docs/sphinx/source/installation.rst index 7deafd1bc9..f052b2bac4 100644 --- a/docs/sphinx/source/installation.rst +++ b/docs/sphinx/source/installation.rst @@ -201,8 +201,7 @@ Any changes that you make to this pvlib-python will be available inside your environment. If you run a git checkout, branch, or pull command the result will be applied to your pvlib-python installation. This is great for development. Note, however, that you will need to use -Python's ``reload`` function (`python 2 -`_, `python 3 +Python's ``reload`` function (`python 3 `_) if you make changes to pvlib during an interactive Python session (including a Jupyter notebook). Restarting the Python @@ -216,7 +215,7 @@ environment) when you start a new shell or terminal. Compatibility ------------- -pvlib-python is compatible with Python 3.5-7. +pvlib-python is compatible with Python 3.5 and above. pvlib-python requires Pandas and Numpy. The minimum version requirements are specified in diff --git a/pvlib/__init__.py b/pvlib/__init__.py index 08903310d3..238d481615 100644 --- a/pvlib/__init__.py +++ b/pvlib/__init__.py @@ -1,10 +1,3 @@ -# First ensure proper Python version. -import sys -if not ((3, 5) <= sys.version_info and sys.version_info < (3, 8)): - raise RuntimeError("Current Python version is {}.{}.{}, but pvlib-python \ -is only compatible with Python 3.5-7.".format( - sys.version_info[0], sys.version_info[1], sys.version_info[2])) - from pvlib.version import __version__ from pvlib import tools from pvlib import atmosphere diff --git a/setup.py b/setup.py index 513edfc64d..d1cce8e335 100755 --- a/setup.py +++ b/setup.py @@ -38,15 +38,15 @@ URL = 'https://github.com/pvlib/pvlib-python' INSTALL_REQUIRES = ['numpy >= 1.10.1', - 'pandas >= 0.16.0', + 'pandas >= 0.18.0', 'pytz', 'requests'] TESTS_REQUIRE = ['nose', 'pytest', 'pytest-cov', 'pytest-mock', 'pytest-timeout'] EXTRAS_REQUIRE = { - 'optional': ['scipy', 'tables', 'numba', 'siphon', 'netcdf4', - 'ephem', 'cython', 'pvfactors == 1.0.1'], - 'doc': ['sphinx', 'ipython', 'sphinx_rtd_theme', 'matplotlib'], + 'optional': ['ephem', 'cython', 'netcdf4', 'numba', 'pvfactors', 'scipy', + 'siphon', 'tables'], + 'doc': ['ipython', 'matplotlib', 'sphinx', 'sphinx_rtd_theme'], 'test': TESTS_REQUIRE } EXTRAS_REQUIRE['all'] = sorted(set(sum(EXTRAS_REQUIRE.values(), []))) From 507428fc1d781db176c31f5568335396a4ddb85d Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 12:58:13 -0600 Subject: [PATCH 10/12] Appease the stickler --- pvlib/test/test_modelchain.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pvlib/test/test_modelchain.py b/pvlib/test/test_modelchain.py index 5b3c556533..866068d963 100644 --- a/pvlib/test/test_modelchain.py +++ b/pvlib/test/test_modelchain.py @@ -1,5 +1,4 @@ import sys -from unittest.mock import ANY import numpy as np import pandas as pd From 391cf72294886cdd48ce9369091d007cc0173ec1 Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 14:26:51 -0600 Subject: [PATCH 11/12] Check for Python version range in setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d1cce8e335..eedd836540 100755 --- a/setup.py +++ b/setup.py @@ -67,7 +67,8 @@ setuptools_kwargs = { 'zip_safe': False, 'scripts': [], - 'include_package_data': True + 'include_package_data': True, + 'python_requires': '>=3.5, <4' } # set up pvlib packages to be installed and extensions to be compiled From 11408e6b445a92c1cb9274eef2b709964b8184e6 Mon Sep 17 00:00:00 2001 From: Mark Campanelli Date: Sun, 19 May 2019 14:39:43 -0600 Subject: [PATCH 12/12] Use more succint range syntax --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index eedd836540..a4b41e6c00 100755 --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ 'zip_safe': False, 'scripts': [], 'include_package_data': True, - 'python_requires': '>=3.5, <4' + 'python_requires': '~=3.5' } # set up pvlib packages to be installed and extensions to be compiled