Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #63

Merged
merged 7 commits into from
Dec 16, 2024
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
40 changes: 21 additions & 19 deletions .github/workflows/test-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,43 @@ jobs:
pytest:
strategy:
matrix:
os:
- label: Linux
runner: ubuntu-latest
- label: macOS
runner: macos-latest
os: [ubuntu-latest, macos-14]

deps:
- label: Latest
spec: ""

fail-fast: false
name: ${{ matrix.os.label }} • ${{ matrix.deps.label }}
runs-on: ${{ matrix.os.runner }}
fail-fast: true
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup environment
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v2
with:
environment-file: conda-env.yml
environment-name: sweets-env
extra-specs: ${{ matrix.deps.spec }}
channels: conda-forge
# 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
run: |
pip install --no-deps .
python -m pip install --no-deps .
- name: Install test dependencies
run: |
micromamba install -f tests/requirements.txt -c conda-forge
- name: Test
- name: Enable numba boundscheck for better error catching
run: |
pytest
echo "NUMBA_BOUNDSCHECK=1" >> $GITHUB_ENV
echo "TQDM_DISABLE=1" >> $GITHUB_ENV
- name: Test (with numba boundscheck on)
run: |
pytest -n0 -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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ci:
autofix_prs: false
autofix_prs: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
rev: "v5.0.0"
hooks:
# https://github.com/pre-commit/pre-commit-hooks/issues/718
# - id: check-added-large-files # Fails with git v1.8.3
Expand All @@ -19,28 +19,25 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: "24.10.0"
hooks:
- id: black
args: [--preview]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
rev: v0.8.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
types_or: [python, jupyter]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.11.2"
rev: "v1.13.0"
hooks:
- id: mypy
additional_dependencies:
- types-setuptools
- types-python-dateutil
- types-requests
- "pydantic>=2.1"

- repo: https://github.com/PyCQA/pydocstyle
rev: "6.3.0"
hooks:
- id: pydocstyle
# https://github.com/PyCQA/pydocstyle/pull/608#issuecomment-1381168417
additional_dependencies: ['.[toml]']
exclude: tests
- "pydantic>=2.5"
24 changes: 4 additions & 20 deletions conda-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,10 @@ name: sweets-env
channels:
- conda-forge
dependencies:
- python>=3.8
- pip>=21.3 # https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/#editable-installation
- git # for pip install, due to setuptools_scm
- wget # ASF Downloading
# - isce3>=0.14.0
# - compass>=0.4.1
# - dask>=2022.6.0
# - dolphin>=0.2.0
# - gdal>=3.5
# - h5py>=3.6
# - numpy>=1.20
# - opera-utils>=0.1.1
# - pydantic>=2.1
# - requests>=2.20
# - rich>=12.0
# - rioxarray>=0.13
# - s1reader>=0.2.1
# - sardem>=0.11.3
# - sentineleof>=0.7.0
# - shapely>=1.8
- python>=3.9
- pip>=21.3
- git
- wget
- isce3>=0.14.0
- colorcet
- compass>=0.4.1
Expand Down
7 changes: 3 additions & 4 deletions src/sweets/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from datetime import date, datetime
from functools import lru_cache
from pathlib import Path
from typing import Any, Optional
from typing import Any, Optional, Literal
from urllib.parse import urlencode

import requests
Expand Down Expand Up @@ -83,11 +83,10 @@ class ASFQuery(YamlModel):
alias="relativeOrbit",
description="Path number",
)
flight_direction: Optional[str] = Field(
flight_direction: Optional[Literal["ASCENDING", "DESCENDING"]] = Field(
None,
alias="flightDirection",
choices=["ASCENDING", "DESCENDING"],
description="Ascending or descending",
description="Direction of satellite during acquisition.",
)
frames: Optional[tuple[int, int]] = Field(
None,
Expand Down
Loading