Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
49 changes: 11 additions & 38 deletions .github/workflows/test-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,32 @@ jobs:
pytest:
strategy:
matrix:
os: [ubuntu-latest, macos-14]
deps:
- label: Latest
# we can't specify `tophu` for conda, not available on mac
# Numba pin: https://github.com/numba/numba/blob/release0.61/numba/__init__.py#L42-L45
spec: >-
isce3-cpu
dask
numpy<2.3

os: [ubuntu-latest, macos-latest]
fail-fast: true
name: ${{ matrix.os }} • ${{ matrix.deps.label }}
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup environment
uses: mamba-org/setup-micromamba@v2
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.10
with:
environment-file: conda-env.yml
environment-name: dolphin-env
# persist on the same day.
cache-environment-key: environment-${{ steps.date.outputs.date }}
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
generate-run-shell: false
create-args: ${{ matrix.deps.spec }}
condarc: |
channels:
- conda-forge
- name: Install
# TODO: remove ortools pin when fixed: https://github.com/google/or-tools/issues/4674
run: |
python -m pip install --no-deps .
- name: Install test dependencies
# Remove pytest pin when fixed: https://github.com/pytest-dev/pytest-cov/issues/693
pixi-version: v0.48.2
# cache: true
- name: Install environment
run: |
python -m pip install -r tests/requirements.txt "pytest<8.4" "ortools!=9.13.*"
python -m pip install --no-deps \
git+https://github.com/isce-framework/tophu@main \
"snaphu>=0.4.0"
pixi install --environment test
- name: Enable numba boundscheck for better error catching
run: |
echo "NUMBA_BOUNDSCHECK=1" >> $GITHUB_ENV
echo "TQDM_DISABLE=1" >> $GITHUB_ENV
- name: Test (with numba boundscheck on)
- name: Test
# Run the task "test" inside the "test" environment with verbose output
run: |
pytest -n0 --capture=no -vv
# https://community.codecov.com/t/numba-jitted-methods-are-not-captured-by-codecov/2649
# - name: Coverage report
# uses: codecov/codecov-action@v2
pixi run --environment test test -vv

dockerize: # Based on Mintpy: https://github.com/insarlab/MintPy/blob/5ca554fef324b816f9130feec567e2cf463e41d2/.github/workflows/build-n-publish-to-pypi.yml
name: Build Docker image and push to GitHub Container Registry
Expand Down
27 changes: 12 additions & 15 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ version: 2
mkdocs:
configuration: mkdocs.yml

# Conda is causing "excessive memory usage"
# https://docs.readthedocs.io/en/stable/guides/conda.html#making-builds-faster-with-mamba
build:
os: "ubuntu-20.04"
tools:
python: "mambaforge-4.10"

conda:
environment: conda-env.yml

python:
install:
- method: pip
path: .
extra_requirements:
- docs
os: ubuntu-24.04
commands:
- asdf plugin add pixi
- asdf install pixi latest
- asdf global pixi latest
- pixi install -e docs
- pixi shell --environment docs
# Avoiding problems from the local extension in docs/mdx_bib.py :
# Config value 'markdown_extensions': Failed to load extension 'docs.mdx_bib'
# ModuleNotFoundError: No module named 'docs'
- export PYTHONPATH="${PYTHONPATH}:${PWD}"
- mkdocs build --clean --site-dir $READTHEDOCS_OUTPUT/html --config-file mkdocs.yml
10 changes: 0 additions & 10 deletions docs/requirements.txt

This file was deleted.

15,196 changes: 15,196 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

112 changes: 102 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ description = "Workflows for generating surface displacement maps using InSAR"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"

dependencies = [
"h5py>=3.6",
"jax>=0.4.19",
"numba>=0.56",
"numpy>=1.23",
"opera-utils>=0.16",
"pydantic>=2.1",
"pyproj>=3.3",
"rasterio>=1.3",
"ruamel_yaml>=0.15",
"scipy>=1.9",
"snaphu>=0.4.1",
"threadpoolctl>=3.0",
"tqdm>=4.60",
"typing_extensions>=3.10",
"tyro>=0.9.20",
]

classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Science/Research",
Expand All @@ -24,7 +42,90 @@ license = { file = "LICENSE.txt" }
# see section: setuptools_scm
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
# dependencies will be read from text files
dynamic = ["version", "dependencies", "optional-dependencies"]
dynamic = ["version"]

# extra requirements: `pip install dolphin[docs]` or `pip install .[docs]`
[project.optional-dependencies]
docs = [
"black[jupyter]",
"markdown",
"mkdocs",
"mkdocs-gen-files",
"mkdocs-jupyter==0.25.0",
"mkdocs-literate-nav",
"mkdocs-material",
"mkdocs-section-index",
"mkdocstrings-python",
"nbdime",
"pybtex",
"pymdown-extensions",
]
test = [
"asv",
"black[jupyter]",
"boto3",
"moto[server]",
"nbdime",
"pooch",
"pre-commit",
"pytest",
"pytest-cov",
"pytest-randomly",
"pytest-xdist",
"shapely",
"snaphu>=0.4.1",
"spurt>=0.1.1",
"ortools!=9.13.*",
"xarray>=2025",
]
all = ["dolphin[test,docs]"]

# Pixi configuration
[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "osx-arm64"]

[tool.pixi.dependencies]
git = "*"
gdal = ">=3.3"
libgdal-netcdf = "*"
libgdal-hdf5 = "*"
h5py = ">=3.6"
hdf5 = "!=1.12.2"
jax = ">=0.4.19"
numba = ">=0.56"
numpy = ">=1.23"
opera-utils = ">=0.4.1"
pydantic = ">=2.1"
pyproj = ">=3.3"
rasterio = ">=1.3"
"ruamel.yaml" = ">=0.15"
scipy = ">=1.12"
threadpoolctl = ">=3.0"
tqdm = ">=4.60"
typing_extensions = ">=3.10"
tyro = ">=0.9.20"

# Like running pip install -e .
[tool.pixi.pypi-dependencies]
dolphin = { path = ".", editable = true }

[tool.pixi.tasks]
test = "python -m pytest"
check = "pre-commit run --all-files"

[tool.pixi.feature.test.dependencies]
isce3-cpu = "*"
dask = "*"

[tool.pixi.feature.test.pypi-dependencies]
tophu = { git = "https://github.com/scottstanie/tophu.git", rev = "303470c203bfddb59bf4debdecd1fd949d0c8d54" }

[tool.pixi.environments]
default = { features = [], solve-group = "default" }
test = { features = ["test"], solve-group = "default" }
docs = { features = ["docs"], solve-group = "default" }
all = { features = ["all", "docs", "test"], solve-group = "default" }

[project.urls]
Homepage = "https://github.com/isce-framework/dolphin"
Expand All @@ -34,14 +135,6 @@ Homepage = "https://github.com/isce-framework/dolphin"
[project.scripts]
dolphin = "dolphin.cli:main"

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }

# extra requirements: `pip install dolphin[docs]` or `pip install .[docs]`
[tool.setuptools.dynamic.optional-dependencies.docs]
file = ["docs/requirements.txt"]
[tool.setuptools.dynamic.optional-dependencies.test]
file = ["tests/requirements.txt"]

[tool.setuptools_scm]
# https://github.com/pypa/setuptools_scm#configuration-parameters
Expand Down Expand Up @@ -112,7 +205,6 @@ exclude = ["scripts"]
# Whether to allow unused variadic arguments, like *args and **kwargs.
ignore-variadic-names = true


[tool.black]
preview = true

Expand Down
15 changes: 0 additions & 15 deletions requirements.txt

This file was deleted.

29 changes: 12 additions & 17 deletions src/dolphin/_show_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import re
import sys
from importlib.metadata import metadata
from typing import Optional

import dolphin

Expand All @@ -35,21 +34,14 @@ def _get_sys_info() -> dict[str, str]:
}


def _get_version(module_name: str) -> Optional[str]:
if module_name in sys.modules:
mod = sys.modules[module_name]
else:
try:
mod = importlib.import_module(module_name.replace("-", "_"))
except ImportError:
return None
def _get_version(name: str) -> str | None:
try:
return mod.__version__
except AttributeError:
return mod.version
return importlib.metadata.version(name)
except importlib.metadata.PackageNotFoundError:
return None


def _get_unwrapping_options() -> dict[str, Optional[str]]:
def _get_unwrapping_options() -> dict[str, str | None]:
"""Information on possible phase unwrapping libraries.

Returns
Expand All @@ -65,7 +57,7 @@ def _get_unwrapping_options() -> dict[str, Optional[str]]:
return out


def _get_deps_info() -> dict[str, Optional[str]]:
def _get_deps_info() -> dict[str, str | None]:
"""Overview of the installed version of main dependencies.

Returns
Expand All @@ -85,11 +77,11 @@ def _get_deps_info() -> dict[str, Optional[str]]:
# Replace 'ruamel-yaml' with 'ruamel.yaml'
deps = [dep.replace("ruamel-yaml", "ruamel.yaml") for dep in deps]
# Add `osgeo` for gdal (not listed in pip requirements)
deps += ["osgeo.gdal"]
deps += ["gdal"]
return {name: _get_version(name) for name in deps}


def _get_gpu_info() -> dict[str, Optional[str]]:
def _get_gpu_info() -> dict[str, str | None]:
"""Overview of the optional GPU packages.

Returns
Expand All @@ -100,7 +92,10 @@ def _get_gpu_info() -> dict[str, Optional[str]]:
"""
from dolphin.utils import gpu_is_available

return {"jax": _get_version("jax"), "gpu_is_available": str(gpu_is_available())}
return {
"jax": _get_version("jax"),
"gpu_is_available": str(gpu_is_available()),
}


def _print_info_dict(info_dict: dict) -> None:
Expand Down
14 changes: 0 additions & 14 deletions tests/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_show_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_get_sys_info():
def test_get_deps_info():
deps_info = _get_deps_info()

assert "osgeo.gdal" in deps_info
assert "gdal" in deps_info
assert "numpy" in deps_info
assert "pydantic" in deps_info
assert "h5py" in deps_info
Expand Down
Loading