diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..c58641204d --- /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,build] + 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/')) 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..3b8e48deb3 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" @@ -16,9 +16,8 @@ dependencies = [ 'pytz', 'requests', 'scipy >= 1.6.0', - 'h5py', + 'tables', ] -license = "BSD-3-Clause" classifiers = [ 'Development Status :: 4 - Beta', 'Operating System :: OS Independent', @@ -77,7 +76,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"