DiamondLightSource/blueapi

Fix pydantic 2 depreciations

DominicOram opened this issue · 0 comments

When I try and import blueapi I get the following issue:

ImportError while loading conftest '/mx_bluesky_hyperion_merge/mx-bluesky/tests/conftest.py'.
tests/conftest.py:64: in <module>
    from mx_bluesky.hyperion.experiment_plans.flyscan_xray_centre_plan import (
src/mx_bluesky/hyperion/experiment_plans/__init__.py:6: in <module>
    from mx_bluesky.hyperion.experiment_plans.flyscan_xray_centre_plan import (
src/mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py:13: in <module>
    from blueapi.core import MsgGenerator
.venv/lib/python3.11/site-packages/blueapi/core/__init__.py:14: in <module>
    from .context import BlueskyContext
.venv/lib/python3.11/site-packages/blueapi/core/context.py:17: in <module>
    from blueapi.config import EnvironmentConfig, SourceKind
.venv/lib/python3.11/site-packages/blueapi/config.py:26: in <module>
    class BasicAuthentication(BaseModel):
.venv/lib/python3.11/site-packages/blueapi/config.py:37: in BasicAuthentication
    @validator("username", "passcode")
.venv/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py:112: in validator
    warn(
E   pydantic.warnings.PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/

Forcing me to do "ignore::DeprecationWarning:blueapi",.

Acceptance Criteria

  • I no longer get depreciation warnings on importing blueapi