From 536e125e7ebb61f4809313590f18d87f3c5683e2 Mon Sep 17 00:00:00 2001 From: Philip Date: Mon, 7 Jul 2025 20:03:58 +0100 Subject: [PATCH 1/5] Use tables instead of h5py --- pvlib/clearsky.py | 6 +++--- pvlib/location.py | 6 +++--- pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pvlib/clearsky.py b/pvlib/clearsky.py index be75ecd47a..b00f3edae3 100644 --- a/pvlib/clearsky.py +++ b/pvlib/clearsky.py @@ -10,7 +10,7 @@ import numpy as np import pandas as pd from scipy.linalg import hankel -import h5py +import tables from pvlib import atmosphere, tools from pvlib.tools import _degrees_to_index @@ -201,8 +201,8 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None, latitude_index = _degrees_to_index(latitude, coordinate='latitude') longitude_index = _degrees_to_index(longitude, coordinate='longitude') - with h5py.File(filepath, 'r') as lt_h5_file: - lts = lt_h5_file['LinkeTurbidity'][latitude_index, longitude_index] + with tables.open_file(filepath, mode='r') as lt_h5_file: + lts = lt_h5_file.root.LinkeTurbidity[latitude_index, longitude_index] if interp_turbidity: linke_turbidity = _interpolate_turbidity(lts, time) diff --git a/pvlib/location.py b/pvlib/location.py index 230ce26a66..ed80d5f658 100644 --- a/pvlib/location.py +++ b/pvlib/location.py @@ -10,7 +10,7 @@ import pandas as pd import pytz -import h5py +import tables from pvlib import solarposition, clearsky, atmosphere, irradiance from pvlib.tools import _degrees_to_index @@ -481,8 +481,8 @@ def lookup_altitude(latitude, longitude): latitude_index = _degrees_to_index(latitude, coordinate='latitude') longitude_index = _degrees_to_index(longitude, coordinate='longitude') - with h5py.File(filepath, 'r') as alt_h5_file: - alt = alt_h5_file['Altitude'][latitude_index, longitude_index] + with tables.open_file(filepath, mode='r') as alt_h5_file: + alt = alt_h5_file.root.Altitude[latitude_index, longitude_index] # 255 is a special value that means nodata. Fallback to 0 if nodata. if alt == 255: diff --git a/pyproject.toml b/pyproject.toml index f5f3d3c363..ead09fe7c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ dependencies = [ 'pytz', 'requests', 'scipy >= 1.6.0', - 'h5py', + 'tables', ] license = "BSD-3-Clause" classifiers = [ From 5969756e01737ecfc0a7391a0d4ca7e88a21ae15 Mon Sep 17 00:00:00 2001 From: Philip Date: Mon, 7 Jul 2025 20:07:29 +0100 Subject: [PATCH 2/5] Add Azure pipelines yml --- azure-pipelines.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..6b98dc4a72 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,40 @@ +trigger: + branches: + include: + - main + - refs/tags/* + +pool: + vmImage: ubuntu-latest + +stages: + - stage: Build + jobs: + - job: Python310Build + timeoutInMinutes: 120 + container: python:3.10.11 + steps: + - script: python -m venv $(Build.SourcesDirectory)/.venv + displayName: "Creating virtual environment" + - task: PipAuthenticate@1 + inputs: + artifactFeeds: 'bitbloom-artifacts' + onlyAddExtraIndex: True + - script: | + source $(Build.SourcesDirectory)/.venv/bin/activate + pip install .[test] + displayName: "Installing pvlib" + - script: | + source $(Build.SourcesDirectory)/.venv/bin/activate + python -m pytest tests + displayName: "Running tests with pytest" + - task: TwineAuthenticate@1 + inputs: + artifactFeed: "bitbloom-artifacts" + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) + - script: | + source $(Build.SourcesDirectory)/.venv/bin/activate + python setup.py sdist + python -m twine upload -r "bitbloom-artifacts" --config-file $(PYPIRC_PATH) dist/*.tar.gz + displayName: "Building and publishing sdist package" + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) From 5e98daedb31ab7d184d9a2e69fb23643ec6e742c Mon Sep 17 00:00:00 2001 From: Philip Date: Tue, 8 Jul 2025 12:49:20 +0100 Subject: [PATCH 3/5] add twine to build dependencies --- azure-pipelines.yml | 2 +- pyproject.toml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6b98dc4a72..c58641204d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,7 @@ stages: onlyAddExtraIndex: True - script: | source $(Build.SourcesDirectory)/.venv/bin/activate - pip install .[test] + pip install .[test,build] displayName: "Installing pvlib" - script: | source $(Build.SourcesDirectory)/.venv/bin/activate diff --git a/pyproject.toml b/pyproject.toml index ead09fe7c5..ccea868afb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,10 @@ test = [ 'pytest-remotedata', 'packaging', ] -all = ["pvlib[test,optional,doc]"] +build = [ + "twine" +] +all = ["pvlib[test,optional,doc,build]"] [project.urls] "Bug Tracker" = "https://github.com/pvlib/pvlib-python/issues" From 0fa48c6a1e181f8787c11d0b28e7e4c257434f42 Mon Sep 17 00:00:00 2001 From: Philip Date: Tue, 8 Jul 2025 13:48:57 +0100 Subject: [PATCH 4/5] Add twine to build requirements --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ccea868afb..d5b1b7102f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=70.1", "setuptools_scm>=6.2"] +requires = ["setuptools>=70.1", "setuptools_scm>=6.2", "twine"] build-backend = "setuptools.build_meta" From dfcb580f14ed81d8798025dab2d8b1ffe13773d3 Mon Sep 17 00:00:00 2001 From: Philip Date: Tue, 8 Jul 2025 15:40:26 +0100 Subject: [PATCH 5/5] Remove license config --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d5b1b7102f..3b8e48deb3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ dependencies = [ 'scipy >= 1.6.0', 'tables', ] -license = "BSD-3-Clause" classifiers = [ 'Development Status :: 4 - Beta', 'Operating System :: OS Independent',