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 ea10ca3bd..2fe97a2ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,21 +11,37 @@ on: jobs: lint: - name: Linting (pre-commit) + name: Linting (pre-commit and mypy) runs-on: ubuntu-latest 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: 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! @@ -37,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: @@ -157,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: @@ -196,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: 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) 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: