Skip to content

Commit

Permalink
Add uv to GitHub Actions (#58)
Browse files Browse the repository at this point in the history
* Add uv to GitHub Actions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update toml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
giswqs and pre-commit-ci[bot] committed Sep 22, 2024
1 parent 2011566 commit 408cfc8
Show file tree
Hide file tree
Showing 10 changed files with 8,394 additions and 116 deletions.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
67 changes: 44 additions & 23 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,57 @@
name: docs-build

on:
pull_request:
branches:
- master

jobs:
deploy:
docs-build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install GDAL
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Install optional dependencies
run: |
pip install --user -r requirements.txt -r requirements_dev.txt
pip install .
- name: Discover typos with codespell
run: codespell --skip="*.csv,*.geojson,*.json,*.js,*.html,*cff,./.git" --ignore-words-list="aci,acount,acounts,fallow,hart,hist,nd,ned,ois,wqs,watermask"
- name: PKG-TEST
uv pip install --find-links https://girder.github.io/large_image_wheels GDAL pyproj
uv pip install pytest
uv pip install -r requirements_dev.txt
- name: Test import
run: |
python -m unittest discover tests/
- name: Build docs
uv run python -c "import geospatial; print('geospatial import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running pytest
run: |
pip install -r requirements_docs.txt
mkdocs build
uv run pytest . --verbose
- name: Install mkdocs
run: |
uv pip install -r requirements_docs.txt
uv run mkdocs build
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v2.0
uses: nwtgck/actions-netlify@v3.0
with:
publish-dir: "./site"
production-branch: master
Expand All @@ -46,4 +63,8 @@ jobs:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10

- name: Cleanup
if: always()
run: |
echo "Cleaning up resources."
54 changes: 36 additions & 18 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,51 @@
name: docs

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install GDAL
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Install optional dependencies
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- name: Test GDAL installation
uv pip install --find-links https://girder.github.io/large_image_wheels GDAL pyproj
uv pip install pytest
uv pip install -r requirements_dev.txt
- name: Test import
run: |
python -c "from osgeo import gdal"
gdalinfo --version
- name: Install dependencies
uv run python -c "import geospatial; print('geospatial import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running pytest
run: |
pip install --user -r requirements.txt -r requirements_dev.txt
pip install .
- name: Discover typos with codespell
run: codespell --skip="*.csv,*.geojson,*.json,*.js,*.html,*cff,./.git" --ignore-words-list="aci,acount,acounts,fallow,hart,hist,nd,ned,ois,wqs,watermask"
- name: PKG-TEST
uv run pytest . --verbose
- name: Install mkdocs
run: |
python -m unittest discover tests/
- run: pip install -r requirements_docs.txt
- run: mkdocs gh-deploy --force
uv pip install -r requirements_docs.txt
uv run mkdocs gh-deploy --force
38 changes: 19 additions & 19 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ on:
name: macOS build
jobs:
test-macOS:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (${{ matrix.python-version}})
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.py }})
strategy:
fail-fast: false
matrix:
os: ["macOS-latest"]
python-version: ["3.12"]
config:
- { os: macOS-latest, py: "3.12" }
env:
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: ${{ matrix.python-version}}
- name: Install GDAL
run: |
brew install gdal
- name: Test GDAL installation
run: |
gdalinfo --version
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.config.py }}
run: uv python install ${{ matrix.config.py }}

- name: Install dependencies
run: uv sync --python ${{ matrix.config.py }}

- name: Test import
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install -r requirements.txt
pip install .
uv run python -c "import geospatial; print('geospatial import successful')"
50 changes: 29 additions & 21 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
name: TestingUbuntu

on:
push:
branches:
- master
branches: ["master"]
pull_request:
branches:
- master
branches: ["master"]

name: Linux build
jobs:
test-ubuntu:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Install optional dependencies
run: |
pip install -r requirements.txt -r requirements_dev.txt
pip install .
- name: PKG-TEST
uv pip install --find-links https://girder.github.io/large_image_wheels gdal pyproj
uv pip install pytest
- name: Test import
run: |
uv run python -c "import geospatial; print('geospatial import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running pytest
run: |
python -m unittest discover tests/
uv run pytest . --verbose
37 changes: 19 additions & 18 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
name: "TestingWindows"

on:
push:
branches:
- master
pull_request:
branches:
- master

name: Windows build
jobs:
test-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
auto-activate-base: true
python-version: "3.12"
- name: Install GDAL
run: |
conda install -c conda-forge gdal --yes
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Test import
run: |
pip install --upgrade setuptools
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install -r requirements.txt
pip install .
uv run python -c "import geospatial; print('geospatial import successful')"
17 changes: 8 additions & 9 deletions docs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,23 @@
"\n",
"## Installation\n",
"\n",
"### Mamba\n",
"### uv\n",
"\n",
"Installing commonly used packages for geospatial analysis and data visualization with only one command.\n",
"[uv](https://docs.astral.sh/uv/) us an extremely fast Python package and project manager, written in Rust. It is designed to be a drop-in replacement for pip. You can install `geospatial` using `uv` as follows:\n",
"\n",
"```bash\n",
"mamba install -c conda-forge geospatial\n",
"uv pip install geospatial\n",
"uv pip install --find-links https://girder.github.io/large_image_wheels gdal pdal pyproj \n",
"```\n",
"\n",
"### uv\n",
"### Mamba\n",
"\n",
"[uv](https://docs.astral.sh/uv/) us an extremely fast Python package and project manager, written in Rust. It is designed to be a drop-in replacement for pip. You can install `geospatial` using `uv` as follows:\n",
"Installing commonly used packages for geospatial analysis and data visualization with only one command.\n",
"\n",
"```bash\n",
"uv install geospatial\n",
"uv pip install gdal pdal --find-links https://girder.github.io/large_image_wheels\n",
"mamba install -c conda-forge geospatial\n",
"```\n",
"\n",
"\n",
"## Video Tutorial\n",
"\n",
"[![Introducing geospatial](images/thumbnail.png)](https://youtu.be/t7eJKQwacOE \"Introducing geospatial\")"
Expand All @@ -61,7 +60,7 @@
"\n",
"The [recipe](https://github.com/conda-forge/geospatial-feedstock/blob/main/recipe/meta.yaml) of the geospatial Python package on the conda-forge channel:\n",
"\n",
" - python >=3.8\n",
" - python >=3.9\n",
" - apache-sedona\n",
" - bokeh\n",
" - cartopy\n",
Expand Down
Loading

0 comments on commit 408cfc8

Please sign in to comment.