Skip to content

Increase python requirement to >= 3.8 #2029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/pytest-remote-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ jobs:
strategy:
fail-fast: false # don't cancel other matrix jobs when one fails
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
suffix: [''] # the alternative to "-min"
include:
- python-version: 3.7
- python-version: 3.8
suffix: -min

runs-on: ubuntu-latest
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
run: pytest pvlib/tests/iotools --cov=./ --cov-report=xml --remote-data

- name: Upload coverage to Codecov
if: matrix.python-version == 3.7 && matrix.suffix == ''
if: matrix.python-version == 3.8 && matrix.suffix == ''
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
fail-fast: false # don't cancel other matrix jobs when one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
environment-type: [conda, bare]
suffix: [''] # placeholder as an alternative to "-min"
include:
- os: ubuntu-latest
python-version: 3.7
python-version: 3.8
environment-type: conda
suffix: -min
exclude:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
pytest pvlib --cov=./ --cov-report=xml --ignore=pvlib/tests/iotools

- name: Upload coverage to Codecov
if: matrix.python-version == 3.7 && matrix.suffix == '' && matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda'
if: matrix.python-version == 3.8 && matrix.suffix == '' && matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@
"include": [
// minimum supported versions
{
"python": "3.7",
"python": "3.8",
"build": "",
"numpy": "1.17.5",
"pandas": "1.3.0",
"scipy": "1.6.0",
// Note: these don't have a minimum in setup.py
"h5py": "3.1.0",
"ephem": "3.7.6.0",
"numba": "0.40.0"
"ephem": "3.7.7.0", // first version to support py 3.8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"ephem": "3.7.7.0", // first version to support py 3.8
"ephem": "3.7.7.1", // first version to support py 3.8

If I understood the information on pypi correctly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 3.7.7.0 has wheels available for python 3.8: https://pypi.org/project/ephem/3.7.7.0/#files

That's how I identified these versions. Is there a different/better way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're asking the wrong person! I was just browsing to get a sense for the consequences.

"numba": "0.47.0", // first version to support py 3.8
},
// latest versions available
{
Expand Down
28 changes: 0 additions & 28 deletions ci/requirements-py3.7.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ dependencies:
- pytest-cov
- pytest-mock
- pytest-timeout
- python=3.7
- python=3.8
- pytz
- requests
- pip:
- dataclasses
- h5py==3.1.0
- h5py==2.10.0 # chosen for compatibility with numpy 1.17.3 and py3.8
- numpy==1.17.3
- pandas==1.3.0
- scipy==1.6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def find_pmp(df):

results = pd.DataFrame(data)
results['pmp'] /= results['pmp'].max() # normalize power to 0-1
results_pivot = results.pivot('fd', 'fs', 'pmp')
results_pivot = results.pivot(index='fd', columns='fs', values='pmp')
plt.figure()
plt.imshow(results_pivot, origin='lower', aspect='auto')
plt.xlabel('shaded fraction')
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/solar-position/plot_sunpath_diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@

tz = 'Asia/Calcutta'
lat, lon = 28.6, 77.2
times = pd.date_range('2019-01-01 00:00:00', '2020-01-01', closed='left',
freq='H', tz=tz)
times = pd.date_range('2019-01-01 00:00:00', '2020-01-01', freq='H', tz=tz)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this break with python 3.8 even though the pandas version didn't change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to this PR, we had ReadTheDocs configured to use python 3.7, but we did not specify a particular pandas version to use for the documentation build. That means RTD had been using the latest version of pandas that was available for python 3.7 (pandas 1.3.5). With this PR updating the configuration to use python 3.8 but leaving the pandas version unspecified, ReadTheDocs then had access to a newer version of pandas, and in particular one that required these changes (pandas 2.0.3).

So updating the python version used in the docs build did change the pandas version that gets used, since we aren't telling RTD to use a particular pandas version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. So the equivalent would now be inclusive='left'? (That may not matter for the example.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so. And I agree it does not matter for this example, so I opted to simplify and just remove the parameter rather than update to the new name.


solpos = solarposition.get_solarposition(times, lat, lon)
# remove nighttime
Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew/v0.10.5.rst
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change going to affect a patch version or a minor one, v0.11.0, is preferred? I expected next release to be v0.11 but dunno.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree there is reason to generally prefer to drop support for a python version in a minor release, not a patch release. The choice to do it in a patch release in this particular case was motivated by (taken from #1975 (comment)):

Waiting for 0.11.0 would put the desire to drop 3.7 ASAP (#2023) in conflict with wanting to wait at least a year before removing the 0.10.0 (released June 2023) deprecations set to expire in 0.11.0.

So we want to make a release soon, but we still want to wait a little while for 0.11.0. I think including this in 0.10.5 is the best option. Also, this won't be the first time that we have dropped support for a python version in a patch release. For example we dropped 3.6 in v0.9.2.

So I don't love it either, but I don't see a better option. Ideas are welcome :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine. I don't have any strong opinion other than NEP29, but since this project doesn't follow it, I only advocate for moving forward the supported python version ^.^

Thanks for the explanation!

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Documentation

Requirements
~~~~~~~~~~~~
* Python 3.8 or higher. (:issue:`1975`, :pull:`2029`)
* Minimum version of scipy advanced from 1.5.0 to 1.6.0. (:pull:`2027`)


Expand Down
6 changes: 1 addition & 5 deletions pvlib/version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
try:
from importlib.metadata import PackageNotFoundError, version
except ImportError:
# for python < 3.8
from importlib_metadata import PackageNotFoundError, version
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version(__package__)
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ description = "A set of functions and classes for simulating the performance of
authors = [
{ name = "pvlib python Developers", email = "pvlib-admin@googlegroups.com" },
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
'numpy >= 1.17.3',
'pandas >= 1.3.0',
'pytz',
'requests',
'scipy >= 1.6.0',
'h5py',
'importlib-metadata; python_version < "3.8"',
]
license = { text = "BSD-3-Clause" }
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.7"
python: "3.8"
jobs:
# fetch the full history so that setuptools_scm can determine the
# correct version string for long PRs with many commits
Expand Down
Loading