Skip to content

Commit

Permalink
Fix pydantic models by dropping importing v1 (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkay authored Aug 9, 2024
1 parent e8e66b6 commit 2afc6d7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/charms/grafana_agent/v0/cos_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,14 @@ def __init__(self, *args):
Union,
)

import pydantic
from cosl import GrafanaDashboard, JujuTopology
from cosl.rules import AlertRules
from ops.charm import RelationChangedEvent
from ops.framework import EventBase, EventSource, Object, ObjectEvents
from ops.model import ModelError, Relation
from ops.testing import CharmType

try:
import pydantic.v1 as pydantic
except ImportError:
import pydantic

if TYPE_CHECKING:
try:
from typing import TypedDict
Expand All @@ -253,7 +249,7 @@ class _MetricsEndpointDict(TypedDict):

LIBID = "dc15fa84cef84ce58155fb84f6c6213a"
LIBAPI = 0
LIBPATCH = 9
LIBPATCH = 10

PYDEPS = ["cosl", "pydantic"]

Expand Down Expand Up @@ -408,6 +404,7 @@ class DatabagModel(pydantic.BaseModel):
# Custom config key: whether to nest the whole datastructure (as json)
# under a field or spread it out at the toplevel.
_NEST_UNDER=None, # type: ignore
arbitrary_types_allowed=True,
)
"""Pydantic config."""

Expand Down

0 comments on commit 2afc6d7

Please sign in to comment.