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

ci: mypy in linting github action #1326

Merged
merged 4 commits into from
Sep 25, 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
7 changes: 3 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/fetch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
51 changes: 32 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions eodag/rest/types/eodag_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions eodag/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down