diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 74307b54..5c79cc45 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -64,9 +64,6 @@ jobs: - test_system.py - test_task.py - test_volume.py - pydantic-version: - - pydantic==1.9 - - pydantic==2.* runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -76,7 +73,6 @@ jobs: - name: Setup run: | ./scripts/ci-setup.sh - pip install --upgrade ${{ matrix.pydantic-version }} - name: Run tests run: | python -m pytest -vv --no-runtime-skip --durations=10 tests/python_on_whales/components/${{ matrix.component }} diff --git a/python_on_whales/docker_client.py b/python_on_whales/docker_client.py index dfc2c3c9..fb5599e8 100644 --- a/python_on_whales/docker_client.py +++ b/python_on_whales/docker_client.py @@ -33,29 +33,23 @@ class ClientVersion(DockerCamelModel): platform: Optional[Dict[str, str]] = None version: Optional[str] = None - if pydantic.VERSION.startswith("1."): - api_version: Optional[str] = None - else: - api_version: Annotated[ - Optional[str], - pydantic.Field( - validation_alias=pydantic.AliasChoices("APIVersion", "ApiVersion") - ), - ] = None + api_version: Annotated[ + Optional[str], + pydantic.Field( + validation_alias=pydantic.AliasChoices("APIVersion", "ApiVersion") + ), + ] = None default_api_version: Optional[str] = None git_commit: Optional[str] = None go_version: Optional[str] = None os: Optional[str] = None arch: Optional[str] = None - if pydantic.VERSION.startswith("1."): - build_time: Optional[str] = None - else: - build_time: Annotated[ - Optional[str], - pydantic.Field( - validation_alias=pydantic.AliasChoices("BuildTime", "BuiltTime") - ), - ] = None + build_time: Annotated[ + Optional[str], + pydantic.Field( + validation_alias=pydantic.AliasChoices("BuildTime", "BuiltTime") + ), + ] = None context: Optional[str] = None experimental: Optional[bool] = None @@ -70,30 +64,24 @@ class ServerVersion(DockerCamelModel): platform: Optional[Dict[str, str]] = None components: Optional[List[ServerVersionComponent]] = None version: Optional[str] = None - if pydantic.VERSION.startswith("1."): - api_version: Optional[str] = None - else: - api_version: Annotated[ - Optional[str], - pydantic.Field( - validation_alias=pydantic.AliasChoices("APIVersion", "ApiVersion") - ), - ] = None + api_version: Annotated[ + Optional[str], + pydantic.Field( + validation_alias=pydantic.AliasChoices("APIVersion", "ApiVersion") + ), + ] = None min_api_version: Optional[str] = None git_commit: Optional[str] = None go_version: Optional[str] = None os: Optional[str] = None arch: Optional[str] = None kernel_version: Optional[str] = None - if pydantic.VERSION.startswith("1."): - build_time: Optional[str] = None - else: - build_time: Annotated[ - Optional[str], - pydantic.Field( - validation_alias=pydantic.AliasChoices("BuildTime", "BuiltTime") - ), - ] = None + build_time: Annotated[ + Optional[str], + pydantic.Field( + validation_alias=pydantic.AliasChoices("BuildTime", "BuiltTime") + ), + ] = None class Version(DockerCamelModel): diff --git a/requirements.txt b/requirements.txt index 19bd041f..59ed2b33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pydantic>=1.9,<3,!=2.0.* +pydantic>=2,<3,!=2.0.* requests tqdm typer>=0.4.1