Skip to content
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
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.git
.github
.cache
.pytest_cache
*.egg-info
__pycache__/
*.py[cod]
site/
build/
dist/
docs/
tests/
notebooks/
archive/
data/
44 changes: 44 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Deploy Docs

on:
push:
branches:
- main
paths:
- "obia/**"
- "docs/**"
- "mkdocs.yml"
- "pyproject.toml"
- ".github/workflows/docs.yml"
workflow_dispatch:

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install package and docs dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs,detection]"

- name: Build MkDocs site
run: mkdocs build --strict

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
cname: obia.sefa.ai
35 changes: 0 additions & 35 deletions .github/workflows/main.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Docker Image

on:
push:
tags:
- "v*.*.*"

env:
IMAGE_NAME: iosefa/obia

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
52 changes: 52 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish Python Package

on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install build tool
run: python -m pip install --upgrade build

- name: Build distributions
run: python -m build

- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish:
needs: build
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/obia

permissions:
id-token: write

steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests

on:
pull_request:
paths:
- "obia/**"
- "tests/**"
- "pyproject.toml"
- "environment.yml"
- ".github/workflows/tests.yml"
push:
branches:
- main
paths:
- "obia/**"
- "tests/**"
- "pyproject.toml"
- "environment.yml"
- ".github/workflows/tests.yml"
workflow_dispatch:

jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"

- name: Run tests
run: pytest -q
29 changes: 11 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,19 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

notebooks/data

*.png
*.gpkg
# Local geospatial data and generated outputs
notebooks/
*.gpkg-shm
*.gpkg-wal
*.yaml
*.tif
*.laz
*.las
*.json
*.jpeg
*.jpg
*.xml
*.npy
*.pth
*.pt
*.ckpt
*.parquet
*.pkl

scripts/SAM copy
archive/

Expand All @@ -182,8 +180,8 @@ archive/

# Data directories and outputs
data/
notebooks/lightning_logs/
notebooks/tiles/
output_tiles*/
lightning_logs/
scripts/lightning_logs/
scripts/SAM/backup/
scripts/SAM/crowns/
Expand All @@ -201,11 +199,6 @@ scripts/SegmentationSAM/data/
scripts/SegmentationSAM/training_crowns/
scripts/SegmentationSAM/training_crowns_raw/

# Model files and serialized artifacts
*.pth
*.pt
*.ckpt
*.parquet
*.pkl
# Serialized graph artifacts
scripts/segments_graph.pkl*
scripts/segments_labeled.parquet*
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM condaforge/miniforge3:latest

LABEL org.opencontainers.image.title="OBIA"
LABEL org.opencontainers.image.description="Object-based image analysis tools for geospatial rasters"
LABEL org.opencontainers.image.source="https://github.com/iosefa/obia"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

WORKDIR /opt/obia

COPY pyproject.toml README.md LICENSE MANIFEST.in ./
COPY obia ./obia

RUN conda install -y -c conda-forge \
"python=3.11" \
pip \
"setuptools>=68" \
wheel \
"numpy>=2.1.1" \
"rasterio>=1.3.11" \
"shapely>=2.0.3" \
"pillow>=10.3.0" \
"pandas>=2.2.2" \
"geopandas>=1.0.1" \
"scipy>=1.14.1" \
"scikit-image>=0.23.2" \
"tqdm>=4.66.2" \
"scikit-learn>=1.4.2" \
"affine>=2.4.0" \
"pyproj>=3.6.1" \
"matplotlib>=3.8" \
requests \
opencv \
gdal \
pdal \
python-pdal \
&& pip install --no-cache-dir --no-deps pyforestscan . \
&& conda clean -afy

CMD ["python"]
Loading
Loading