From 6c19baaed7f9f0ca3eb2729587dd478b40ebcaa9 Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Thu, 6 Jul 2023 15:24:12 +0200 Subject: [PATCH] fix: upgrade to pydantic 2 Closes #274 --- popmon/config.py | 5 +++-- pyproject.toml | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/popmon/config.py b/popmon/config.py index a85feba1..51169cee 100644 --- a/popmon/config.py +++ b/popmon/config.py @@ -21,7 +21,8 @@ import pandas as pd from histogrammar.dfinterface.make_histograms import get_time_axes -from pydantic import BaseModel, BaseSettings +from pydantic import BaseModel +from pydantic_settings import BaseSettings from typing_extensions import Literal # Global configuration for the joblib parallelization. Could be used to change the number of jobs, and/or change @@ -32,7 +33,7 @@ class ValidatedSettings(BaseSettings): class Config: - validate_all = True + validate_default = True validate_assignment = True diff --git a/pyproject.toml b/pyproject.toml index 61b0083b..d56712fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,8 +31,10 @@ dependencies = [ "plotly>=5.8.0", "joblib>=0.14.0", "htmlmin", - "pydantic", - "typing_extensions" + "pydantic>=2", + "pydantic-settings", + "typing_extensions", + "tomli >= 1.1.0 ; python_version < '3.11'" ] classifiers = [ "Programming Language :: Python :: 3", @@ -105,6 +107,10 @@ ignore = [ "TRY003", "E501", "DTZ", + "PERF203", # `try`-`except` within a loop incurs performance overhead + + # False positive + "PERF401", # Use a list comprehension to create a transformed list # Prefer autofix "PD011", # .to_numpy() instead of values @@ -153,6 +159,10 @@ ignore = [ "INP001", ] +"popmon/config.py" = [ + "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` +] + # Notebooks & NBQA "popmon/notebooks/*" = [ # Imports cannot be checked properly with NBQA