diff --git a/.travis.yml b/.travis.yml index 66731cf911..7884982ead 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +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: 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-min - python: 3.5 env: CONDA_ENV=py35 - python: 3.6 @@ -38,11 +34,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 @@ -50,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" @@ -63,14 +55,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/README.md b/README.md index b2a4569289..d9ae7739da 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 and above. -**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, with pvlib-python 0.6.3.** Contributing 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: 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/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 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/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 25e82d6017..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 2.7 and 3.4+. +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 f2a6b7a5d0..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 versions 2.7 and 3.4-3.7. +pvlib-python is compatible with Python 3.5 and above. pvlib-python requires Pandas and Numpy. The minimum version requirements are specified in @@ -228,7 +227,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/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/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..866068d963 100644 --- a/pvlib/test/test_modelchain.py +++ b/pvlib/test/test_modelchain.py @@ -1,9 +1,4 @@ import sys -try: - from unittest.mock import ANY -except ImportError: - # python 2 - from mock import ANY import numpy as np import pandas as pd diff --git a/pvlib/test/test_pvsystem.py b/pvlib/test/test_pvsystem.py index cd7679f323..2fd556fb92 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): diff --git a/setup.py b/setup.py index 0a43d8076b..a4b41e6c00 100755 --- a/setup.py +++ b/setup.py @@ -38,16 +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', - 'six', - ] -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'], - '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(), []))) @@ -58,10 +57,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', @@ -71,7 +67,8 @@ setuptools_kwargs = { 'zip_safe': False, 'scripts': [], - 'include_package_data': True + 'include_package_data': True, + 'python_requires': '~=3.5' } # set up pvlib packages to be installed and extensions to be compiled