diff --git a/changelog.d/pr-41.md b/changelog.d/pr-41.md new file mode 100644 index 0000000..5736493 --- /dev/null +++ b/changelog.d/pr-41.md @@ -0,0 +1,3 @@ +### 🔩 Dependencies + +- Update for Pydantic 2.0. [PR #41](https://github.com/datalad/release-action/pull/41) (by [@jwodder](https://github.com/jwodder)) diff --git a/datalad_release_action/config.py b/datalad_release_action/config.py index 6bdceb8..3911ab1 100644 --- a/datalad_release_action/config.py +++ b/datalad_release_action/config.py @@ -11,7 +11,7 @@ class Category(BaseModel): bump: Bump = Bump.PATCH label: Optional[str] = None label_color: Optional[str] = Field( - None, alias="label-color", regex=r"^[0-9A-Fa-f]{6}$" + None, alias="label-color", pattern=r"^[0-9A-Fa-f]{6}$" ) label_description: Optional[str] = Field(None, alias="label-description") @@ -28,7 +28,7 @@ def get_label(self) -> Optional[Label]: class Label(BaseModel): name: str - color: Optional[str] = Field(None, regex=r"^[0-9A-Fa-f]{6}$") + color: Optional[str] = Field(None, pattern=r"^[0-9A-Fa-f]{6}$") description: Optional[str] = None @@ -40,4 +40,4 @@ class Config(BaseModel): @classmethod def load_yaml(cls, infile: IO[str]) -> Config: - return cls.parse_obj(YAML(typ="safe").load(infile)) + return cls.model_validate(YAML(typ="safe").load(infile)) diff --git a/requirements.txt b/requirements.txt index 08b2d05..4c762a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ click >= 8.0 ghrepo ~= 0.1 -pydantic ~= 1.9 +pydantic ~= 2.0 requests ~= 2.20 ruamel.yaml ~= 0.15 diff --git a/setup.cfg b/setup.cfg index 9c2b464..d4c8cc0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,4 +36,3 @@ plugins = pydantic.mypy [pydantic-mypy] init_forbid_extra = True -warn_untypes_fields = True