diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41ce88a..21d9ead 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,28 +30,20 @@ jobs: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] python-version: ["3.14"] - pydantic-version: ["v2"] include: - python-version: "3.8" - pydantic-version: "v1" os: windows-latest - python-version: "3.9" - pydantic-version: "v2" os: macos-latest - python-version: "3.10" - pydantic-version: "v1" os: ubuntu-latest - python-version: "3.11" - pydantic-version: "v2" os: windows-latest - python-version: "3.12" - pydantic-version: "v1" os: macos-latest - python-version: "3.13" - pydantic-version: "v1" os: ubuntu-latest - python-version: "3.13" - pydantic-version: "v2" os: windows-latest fail-fast: false runs-on: ${{ matrix.os }} @@ -81,21 +73,18 @@ jobs: limit-access-to-actor: true - name: Install Dependencies run: uv pip install -r requirements-tests.txt - - name: Install Pydantic v1 - if: matrix.pydantic-version == 'v1' - run: uv pip install "pydantic<2.0.0" - name: Lint run: bash scripts/lint.sh - run: mkdir coverage - name: Test run: bash scripts/test.sh env: - COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }} - CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }} + COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }} + CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} - name: Store coverage files uses: actions/upload-artifact@v5 with: - name: coverage-${{ runner.os }}-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }} + name: coverage-${{ runner.os }}-${{ matrix.python-version }} path: coverage include-hidden-files: true diff --git a/src/fastapi_cli/config.py b/src/fastapi_cli/config.py index f5304ba..a2e91d5 100644 --- a/src/fastapi_cli/config.py +++ b/src/fastapi_cli/config.py @@ -3,13 +3,9 @@ from typing import Any, Dict, Optional from pydantic import BaseModel, StrictStr -from pydantic.version import VERSION as PYDANTIC_VERSION logger = logging.getLogger(__name__) -PYDANTIC_VERSION_MINOR_TUPLE = tuple(int(x) for x in PYDANTIC_VERSION.split(".")[:2]) -PYDANTIC_V2 = PYDANTIC_VERSION_MINOR_TUPLE[0] == 2 - class FastAPIConfig(BaseModel): entrypoint: Optional[StrictStr] = None @@ -43,8 +39,4 @@ def resolve(cls, entrypoint: Optional[str] = None) -> "FastAPIConfig": if entrypoint is not None: config["entrypoint"] = entrypoint - # Pydantic v2 uses model_validate, v1 uses parse_obj - if not PYDANTIC_V2: - return cls.parse_obj(config) # type: ignore[no-any-return, unused-ignore] - - return cls.model_validate(config) # type: ignore[no-any-return, unused-ignore, attr-defined] + return cls.model_validate(config)