Skip to content

Commit

Permalink
Update pip dependencies to include scipy (#88)
Browse files Browse the repository at this point in the history
* Update pip dependencies to include scipy

* Update GHA module

* Update CI

* Update dependency list

* Update CI build

* Update badge link
  • Loading branch information
wpreimes authored Sep 13, 2024
1 parent 8176925 commit 2c00505
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 26 deletions.
43 changes: 24 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,27 @@ jobs:
matrix:
include:
- os: "ubuntu-latest"
python-version: '3.8' # first supported
python-version: '3.9' # first supported
- os: "windows-latest"
python-version: '3.9' # first supported
- os: "macos-latest"
python-version: '3.9' # first supported
- os: "ubuntu-latest"
python-version: '3.12' # latest supported
- os: "windows-latest"
python-version: '3.12' # latest supported
- os: "macos-latest"
python-version: '3.12' # latest supported
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
environment-file: environment.yml
#environment-file: environment.yml # we use setup.cfg dependencies only
activate-environment: pygeogrids
auto-activate-base: false
- name: Print environment infos
Expand All @@ -52,13 +55,13 @@ jobs:
- name: Export Environment
shell: bash -l {0}
run: |
mkdir -p .artifacts
mkdir -p artifacts
filename=env_py${{ matrix.python-version }}_${{ matrix.os }}.yml
conda env export --no-builds | grep -v "prefix" > .artifacts/$filename
conda env export --no-builds | grep -v "prefix" > artifacts/$filename
- name: Install package and test
shell: bash -l {0}
run: |
python setup.py develop
pip install -e .[testing]
pytest
- name: Upload Coverage
shell: bash -l {0}
Expand All @@ -72,21 +75,19 @@ jobs:
shell: bash -l {0}
run: |
pip install setuptools_scm
if [ ${{ matrix.os }} == "windows-latest" ]
if [ ${{ matrix.os }} == "ubuntu-latest" ]
then
# build whls on windows
pip install .
python setup.py bdist_wheel --dist-dir .artifacts/dist
else
# build dist on linux
python setup.py sdist --dist-dir .artifacts/dist
python setup.py sdist --dist-dir artifacts/dist
fi
ls .artifacts/dist
pip install wheel
python setup.py bdist_wheel --dist-dir artifacts/dist
ls artifacts/dist
- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: .artifacts/*
name: Artifacts-py${{ matrix.python-version }}-${{ matrix.os }}
path: artifacts/*
coveralls:
name: Submit Coveralls 👚
needs: build
Expand All @@ -109,7 +110,11 @@ jobs:
echo "GITHUB_REF = $GITHUB_REF"
echo "GITHUB_REPOSITORY = $GITHUB_REPOSITORY"
- name: Download Artifacts
uses: actions/[email protected]
uses: actions/download-artifact@v4
with:
path: Artifacts
pattern: Artifacts-*
merge-multiple: true
- name: Display downloaded files
run: ls -aR
- name: Upload to PyPI
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pygeogrids

|ci| |cov| |pip| |doc|

.. |ci| image:: https://github.com/TUW-GEO/pygeogrids/workflows/Automated%20Tests/badge.svg?branch=master
.. |ci| image:: https://github.com/TUW-GEO/pygeogrids/actions/workflows/build.yml/badge.svg?branch=master
:target: https://github.com/TUW-GEO/pygeogrids/actions

.. |cov| image:: https://coveralls.io/repos/TUW-GEO/pygeogrids/badge.svg?branch=master
Expand Down
6 changes: 2 additions & 4 deletions docs/env.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# To keep the RTD build as small as possible, we define a separate .yml here
# Other doc dependencies are defined in setup.cfg and installed via `pip install .[docs]`
name: docs
channels:
- conda-forge
- defaults
dependencies:
- python=3.10
- ipykernel
- nbsphinx
- python=3.12
- mock
- pillow
- sphinx<7
- sphinx_rtd_theme
- pip
- pip:
- recommonmark
- readthedocs-sphinx-ext
9 changes: 9 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ install_requires =
netCDF4
pyproj
pykdtree
scipy

# The usage of test_requires is discouraged, see `Dependency Management` docs
tests_require = pytest; pytest-cov
# Require a specific Python version, e.g. Python 2.7 or >= 3.4
Expand All @@ -55,6 +57,13 @@ testing =
pytest
pytest-cov

docs =
ipykernel
nbconvert
matplotlib
nbsphinx
sphinx_rtd_theme

[options.entry_points]
# Add here console scripts like:
# console_scripts =
Expand Down
6 changes: 4 additions & 2 deletions tests/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,15 @@ def test_nearest_neighbor_max_dist(self):
assert lat == 18.5

# test with maxdist lower than nearest point
gpi, dist = self.grid.find_nearest_gpi(14.3, 18.5, max_dist=10000)
with pytest.warns(UserWarning):
gpi, dist = self.grid.find_nearest_gpi(14.3, 18.5, max_dist=10000)
assert gpi == np.iinfo(np.int32).max
assert dist == np.inf

# test with custom gpi, see issue #68
grid = grids.BasicGrid(lon=[16,17], lat=[45,46], gpis=[100,200])
gpi, dist = grid.find_nearest_gpi(0,0, max_dist=1000)
with pytest.warns(UserWarning):
gpi, dist = grid.find_nearest_gpi(0,0, max_dist=1000)
assert gpi == np.iinfo(np.int32).max
assert dist == np.inf

Expand Down

0 comments on commit 2c00505

Please sign in to comment.