From 454b949e5e873b38efead10e2d0cd92bd5b2397a Mon Sep 17 00:00:00 2001 From: Jake Herrmann Date: Fri, 10 Jan 2025 17:13:15 -0900 Subject: [PATCH 1/3] add mypy --- .github/workflows/static-analysis.yml | 3 +++ CHANGELOG.md | 4 ++++ pyproject.toml | 8 ++++++++ requirements.txt | 1 + 4 files changed, 16 insertions(+) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index ae6beee..63d9cef 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -7,6 +7,9 @@ jobs: # Docs: https://github.com/ASFHyP3/actions uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.12.0 + call-mypy-workflow: + uses: ASFHyP3/actions/.github/workflows/reusable-mypy.yml@v0.14.0 + cfn-lint: runs-on: ubuntu-latest steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index e85e616..62a30de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.8] +### Added +- Add `mypy` to [`static-analysis`](.github/workflows/static-analysis.yml) + ## [0.3.7] ### Fixed - Remove the [Context extension](https://github.com/stac-api-extensions/context), which is no longer supported as of [stac-fastapi v3.0.0](https://github.com/stac-utils/stac-fastapi/blob/main/CHANGES.md#300---2024-07-29). Our previous release (v0.3.6) upgraded the `stac-fastapi.pgstac` dependency from `2.5.0` to `3.0.1` without removing the Context extension, which caused https://stac.asf.alaska.edu to return `Internal Server Error`. diff --git a/pyproject.toml b/pyproject.toml index 48c98bf..3d0c04e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,3 +33,11 @@ convention = "google" [tool.ruff.lint.isort] case-sensitive = true lines-after-imports = 2 + +[tool.mypy] +python_version = "3.9" +warn_redundant_casts = true +warn_unused_ignores = true +warn_unreachable = true +strict_equality = true +check_untyped_defs = true diff --git a/requirements.txt b/requirements.txt index 241dc22..15ab15d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ boto3==1.35.82 cfn-lint==1.22.2 ruff +mypy pypgstac[psycopg]==0.8.6 pystac==1.10.1 pytest==8.3.4 From 75175f2ab07d228a39db26873855285b039c794b Mon Sep 17 00:00:00 2001 From: Jake Herrmann Date: Fri, 10 Jan 2025 17:16:00 -0900 Subject: [PATCH 2/3] fix mypy errors --- .../sentinel-1-global-coherence/create_coherence_items.py | 3 ++- pyproject.toml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/collections/sentinel-1-global-coherence/create_coherence_items.py b/collections/sentinel-1-global-coherence/create_coherence_items.py index 85eaf97..ad96d80 100644 --- a/collections/sentinel-1-global-coherence/create_coherence_items.py +++ b/collections/sentinel-1-global-coherence/create_coherence_items.py @@ -3,6 +3,7 @@ from dataclasses import dataclass from datetime import datetime, timezone from pathlib import Path, PurePath +from typing import Optional import boto3 from shapely import geometry @@ -57,7 +58,7 @@ class ItemMetadata: bbox: geometry.Polygon tile: str product: str - extra: ExtraItemMetadata = None + extra: Optional[ExtraItemMetadata] = None def get_s3_url() -> str: diff --git a/pyproject.toml b/pyproject.toml index 3d0c04e..21082b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,3 +41,4 @@ warn_unused_ignores = true warn_unreachable = true strict_equality = true check_untyped_defs = true +exclude = ["/build/"] From 2543bdbffd72555b03f4d48068298dd76869d59c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:50:31 +0000 Subject: [PATCH 3/3] Bump ASFHyP3/actions from 0.12.0 to 0.14.0 Bumps [ASFHyP3/actions](https://github.com/asfhyp3/actions) from 0.12.0 to 0.14.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.12.0...v0.14.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/changelog.yml | 2 +- .github/workflows/create-jira-issue.yml | 2 +- .github/workflows/deploy-stac-prod.yml | 2 +- .github/workflows/labeled-pr.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 3b1e740..071ebb4 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -13,4 +13,4 @@ on: jobs: call-changelog-check-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.12.0 + uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.14.0 diff --git a/.github/workflows/create-jira-issue.yml b/.github/workflows/create-jira-issue.yml index d95ef84..c4e970a 100644 --- a/.github/workflows/create-jira-issue.yml +++ b/.github/workflows/create-jira-issue.yml @@ -6,7 +6,7 @@ on: jobs: call-create-jira-issue-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.12.0 + uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.14.0 secrets: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} diff --git a/.github/workflows/deploy-stac-prod.yml b/.github/workflows/deploy-stac-prod.yml index 159c89e..1856ee4 100644 --- a/.github/workflows/deploy-stac-prod.yml +++ b/.github/workflows/deploy-stac-prod.yml @@ -31,6 +31,6 @@ jobs: call-bump-version-workflow: needs: deploy-stac-api - uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.12.0 + uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.14.0 secrets: USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }} diff --git a/.github/workflows/labeled-pr.yml b/.github/workflows/labeled-pr.yml index f408f3b..c3c050d 100644 --- a/.github/workflows/labeled-pr.yml +++ b/.github/workflows/labeled-pr.yml @@ -12,4 +12,4 @@ on: jobs: call-labeled-pr-check-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.12.0 + uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.14.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e04c25d..5dc3501 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: jobs: call-release-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.12.0 + uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.14.0 with: release_prefix: ASF STAC secrets: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 63d9cef..0bb421e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -5,7 +5,7 @@ on: push jobs: call-ruff-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.12.0 + uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.14.0 call-mypy-workflow: uses: ASFHyP3/actions/.github/workflows/reusable-mypy.yml@v0.14.0