Skip to content

Removed pydantic V2 protected messages to avoid unnecessary warnings to users #1796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class RasterData(BaseModel, ABC):
uid: Optional[str] = None
global_key: Optional[str] = None
arr: Optional[TypedArray[Literal['uint8']]] = None
model_config = ConfigDict(extra="forbid", copy_on_model_validation="none")

model_config = ConfigDict(extra="forbid")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was copy_on_model_validation removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Pydantic V2 removed it :( with no alternative

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It throws a warning to users if you import this library and technically does nothing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
This is what it used to do. We don't have a way to add this behavior anymore but Im not sure why the original author added this setting it is the only place that includes this in the config settings


@classmethod
def from_2D_arr(cls, arr: Union[TypedArray[Literal['uint8']],
Expand Down
6 changes: 5 additions & 1 deletion libs/labelbox/src/labelbox/data/annotation_types/mmc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC
from typing import ClassVar, List, Union

from pydantic import field_validator
from pydantic import ConfigDict, field_validator

from labelbox.utils import _CamelCaseMixin
from labelbox.data.annotation_types.annotation import BaseAnnotation
Expand All @@ -10,6 +10,8 @@
class MessageInfo(_CamelCaseMixin):
message_id: str
model_config_name: str

model_config = ConfigDict(protected_namespaces=())


class OrderedMessageInfo(MessageInfo):
Expand All @@ -19,6 +21,8 @@ class OrderedMessageInfo(MessageInfo):
class _BaseMessageEvaluationTask(_CamelCaseMixin, ABC):
format: ClassVar[str]
parent_message_id: str

model_config = ConfigDict(protected_namespaces=())


class MessageSingleSelectionTask(_BaseMessageEvaluationTask, MessageInfo):
Expand Down
2 changes: 2 additions & 0 deletions libs/labelbox/src/labelbox/schema/foundry/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class App(_CamelCaseMixin):
class_to_schema_id: Dict[str, str]
ontology_id: str
created_by: Optional[str] = None

model_config = ConfigDict(protected_namespaces=())

@classmethod
def type_name(cls):
Expand Down