diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 45d8b2c..0a394f8 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -18,7 +18,7 @@ runs: run: pipx install poetry==${{ inputs.poetry-version }} shell: bash - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ inputs.python-version }} cache: "poetry" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0501df9..f8fbe4b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Poetry uses: ./.github/actions/setup-poetry - name: Install dependencies @@ -24,7 +24,7 @@ jobs: check-format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Poetry uses: ./.github/actions/setup-poetry - name: Install dependencies diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a015dbc..a36dbf2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Poetry uses: ./.github/actions/setup-poetry - name: Install dependencies @@ -17,7 +17,7 @@ jobs: - name: Build package run: poetry build --no-interaction - name: Upload build artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: path: dist/ name: package-dist @@ -30,7 +30,7 @@ jobs: id-token: write steps: - name: Download build artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: path: ${{ github.workspace }}/dist/ name: package-dist diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index 583e397..d1e26ac 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -11,7 +11,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: persist-credentials: false - name: Set up Poetry @@ -21,12 +21,12 @@ jobs: - name: Build HTML run: poetry run make -C docs/ html - name: Upload artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: html-docs path: docs/_build/html - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/_build/html diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 21ad594..23b2422 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: - "3.10" fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Poetry uses: ./.github/actions/setup-poetry with: diff --git a/flame_hub/_exceptions.py b/flame_hub/_exceptions.py index 5952cdd..b8d6db0 100644 --- a/flame_hub/_exceptions.py +++ b/flame_hub/_exceptions.py @@ -1,20 +1,22 @@ -import typing as t from json import JSONDecodeError import httpx -from pydantic import ValidationError, BaseModel, ConfigDict, Field, AliasChoices +from pydantic import ValidationError, BaseModel, ConfigDict class ErrorResponse(BaseModel): model_config = ConfigDict(extra="allow") """Configuration so that extra properties may be available.""" - status_code: t.Annotated[int, Field(validation_alias=AliasChoices("statusCode", "status"))] - """The status code of the response. This attribute is mapped to the :python:`"statusCode"` or the - :python:`"status"` field of the response.""" + name: str + """Name of the error.""" code: str - """Written equivalent for ``status_code``.""" + """Name of the error code.""" + status_code: int + """HTTP code of the response.""" message: str """The error message.""" + issues: list + """List of issues.""" class HubAPIError(httpx.HTTPError): @@ -65,7 +67,7 @@ def new_hub_api_error_from_response(r: httpx.Response) -> HubAPIError: error_message = f"received status code {r.status_code}" try: - error_response = ErrorResponse(**r.json()) + error_response = ErrorResponse(**({"status_code": r.status_code} | r.json())) error_message = f"received status code {error_response.status_code} ({error_response.code}): " if error_response.message.strip() == "":