From 6b7c477525671e72f336940b6fa5888442f49a68 Mon Sep 17 00:00:00 2001 From: Sylvain Brunato Date: Tue, 24 Sep 2024 17:38:18 +0200 Subject: [PATCH 1/4] ci: mypy in linting github action --- .github/workflows/test.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea10ca3bd..304b17ddd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ on: jobs: lint: - name: Linting (pre-commit) + name: Linting (pre-commit and mypy) runs-on: ubuntu-latest steps: - name: Checkout the repo @@ -24,8 +24,25 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.8" - - name: Run pre-commit action - uses: pre-commit/action@v3.0.1 + - name: Update pip + run: python -m pip install --upgrade pip + - name: Get pip cache dir + id: pip-cache + shell: bash + run: echo "DIR=$(pip cache dir)" >> $GITHUB_OUTPUT + - name: Get current week number + id: get-week + shell: bash + run: echo "WEEK=$(date +'%V')" >> $GITHUB_OUTPUT + - name: Pip cache + uses: actions/cache@v4 + with: + path: ${{ steps.pip-cache.outputs.DIR }} + key: ${{ runner.os }}-pip-${{ steps.get-week.outputs.WEEK }}-${{ hashFiles('setup.cfg') }} + - name: Install tox + run: python -m pip install tox + - name: Run linters with tox + run: python -m tox -e linters tests: name: Test it! From e9f14124c260de98e31ff5c4185c9a2b83e08ac8 Mon Sep 17 00:00:00 2001 From: Julia Lahovnik Date: Tue, 24 Sep 2024 18:15:21 +0200 Subject: [PATCH 2/4] style: fix typing issues --- eodag/rest/types/eodag_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eodag/rest/types/eodag_search.py b/eodag/rest/types/eodag_search.py index a2bf6da4a..9a1b00e31 100644 --- a/eodag/rest/types/eodag_search.py +++ b/eodag/rest/types/eodag_search.py @@ -363,8 +363,8 @@ def to_eodag(cls, value: str) -> str: def to_stac( cls, field_name: str, - stac_item_properties: List[str] = None, - provider: str = None, + stac_item_properties: Optional[List[str]] = None, + provider: Optional[str] = None, ) -> str: """Get the alias of a field in a Pydantic model""" field = cls.model_fields.get(field_name) From be092540c1398c57fde3430bb15e7aaab73fe7b7 Mon Sep 17 00:00:00 2001 From: Sylvain Brunato Date: Wed, 25 Sep 2024 11:47:08 +0200 Subject: [PATCH 3/4] refactor: missing HTTPError arg --- eodag/utils/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eodag/utils/__init__.py b/eodag/utils/__init__.py index 4ed146af9..e71c86243 100644 --- a/eodag/utils/__init__.py +++ b/eodag/utils/__init__.py @@ -99,7 +99,7 @@ from jsonpath_ng import jsonpath from jsonpath_ng.ext import parse from jsonpath_ng.jsonpath import Child, Fields, Index, Root, Slice -from requests import HTTPError +from requests import HTTPError, Response from shapely.geometry import Polygon, shape from shapely.geometry.base import GEOMETRY_TYPES, BaseGeometry from tqdm.auto import tqdm @@ -1129,7 +1129,7 @@ def json(self) -> Any: def raise_for_status(self) -> None: """raises an exception when the status is not ok""" if self.status_code != 200: - raise HTTPError() + raise HTTPError(response=Response()) def md5sum(file_path: str) -> str: From c97251eb983646ceb996d47e756e62f815165d10 Mon Sep 17 00:00:00 2001 From: Sylvain Brunato Date: Wed, 25 Sep 2024 11:48:09 +0200 Subject: [PATCH 4/4] ci: use checkout fetch-depth for setuptools scm --- .github/workflows/deploy.yml | 7 +++---- .github/workflows/fetch.yml | 6 ++---- .github/workflows/test.yml | 28 ++++++++++++---------------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2d473c1dc..adb268893 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,10 +14,9 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v4 - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + with: + # Get history and tags for SCM versioning to work + fetch-depth: 0 - name: Set up Python 3.8 uses: actions/setup-python@v5 with: diff --git a/.github/workflows/fetch.yml b/.github/workflows/fetch.yml index 23922b01c..34fff7f66 100644 --- a/.github/workflows/fetch.yml +++ b/.github/workflows/fetch.yml @@ -16,10 +16,8 @@ jobs: uses: actions/checkout@v4 with: lfs: true - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + # Get history and tags for SCM versioning to work + fetch-depth: 0 - name: Set up Python 3.8 uses: actions/setup-python@v5 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 304b17ddd..2fe97a2ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,10 +16,9 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4 - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + with: + # Get history and tags for SCM versioning to work + fetch-depth: 0 - name: Set up Python 3.8 uses: actions/setup-python@v5 with: @@ -54,10 +53,9 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4 - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + with: + # Get history and tags for SCM versioning to work + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} uses: actions/setup-python@v5 with: @@ -174,10 +172,9 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4 - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + with: + # Get history and tags for SCM versioning to work + fetch-depth: 0 - name: Set up Python 3.8 uses: actions/setup-python@v5 with: @@ -213,10 +210,9 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4 - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + with: + # Get history and tags for SCM versioning to work + fetch-depth: 0 - name: Set up Python 3.8 uses: actions/setup-python@v5 with: