Skip to content

Commit 54b365a

Browse files
committed
Remove custom pyatlan/validate.py, switch legacy code to pydantic v1 validate_arguments
Delete the custom validate_arguments wrapper and _is_model_instance utility. All legacy client, model, and UI code now uses pydantic.v1's validate_arguments directly. Also removes the msgspec cross-type encoder registration from model/core.py and _is_msgspec_cross_type_match from utils.py, and updates the batch __track method to support v9 models via getattr type_name check. Made-with: Cursor
1 parent 1262dfa commit 54b365a

48 files changed

Lines changed: 280 additions & 460 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pyatlan/client/admin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# Copyright 2025 Atlan Pte. Ltd.
33

4+
from pydantic.v1 import validate_arguments
5+
46
from pyatlan.client.common import AdminGetAdminEvents, AdminGetKeycloakEvents, ApiCaller
57
from pyatlan.errors import ErrorCode
68
from pyatlan.model.keycloak_events import (
@@ -9,7 +11,6 @@
911
KeycloakEventRequest,
1012
KeycloakEventResponse,
1113
)
12-
from pyatlan.validate import validate_arguments
1314

1415

1516
class AdminClient:

pyatlan/client/aio/admin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# Copyright 2025 Atlan Pte. Ltd.
33

4+
from pydantic.v1 import validate_arguments
5+
46
from pyatlan.client.common import (
57
AdminGetAdminEvents,
68
AdminGetKeycloakEvents,
@@ -12,7 +14,6 @@
1214
AsyncKeycloakEventResponse,
1315
)
1416
from pyatlan.model.keycloak_events import AdminEventRequest, KeycloakEventRequest
15-
from pyatlan.validate import validate_arguments
1617

1718

1819
class AsyncAdminClient:

pyatlan/client/aio/asset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
overload,
1818
)
1919

20-
from pydantic.v1 import StrictStr, constr
20+
from pydantic.v1 import StrictStr, constr, validate_arguments
2121
from tenacity import (
2222
retry,
2323
retry_if_exception_type,
@@ -84,7 +84,6 @@
8484
from pyatlan.model.fields.atlan_fields import AtlanField
8585
from pyatlan.model.response import AssetMutationResponse
8686
from pyatlan.model.search import IndexSearchRequest, Query
87-
from pyatlan.validate import validate_arguments
8887

8988
if TYPE_CHECKING:
9089
from pyatlan.model.search import IndexSearchRequest

pyatlan/client/aio/audit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
import logging
66

7+
from pydantic.v1 import validate_arguments
8+
79
from pyatlan.client.common import AsyncApiCaller, AuditSearch
810
from pyatlan.errors import ErrorCode
911
from pyatlan.model.aio.audit import AsyncAuditSearchResults
1012
from pyatlan.model.audit import AuditSearchRequest
11-
from pyatlan.validate import validate_arguments
1213

1314
LOGGER = logging.getLogger(__name__)
1415

pyatlan/client/aio/batch.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING, Dict, List, Optional, cast
66

7+
from pydantic.v1 import validate_arguments
8+
79
from pyatlan.client.asset import (
810
AssetCreationHandling,
911
AssetIdentity,
@@ -15,7 +17,6 @@
1517
from pyatlan.model.fluent_search import FluentSearch
1618
from pyatlan.model.response import AssetMutationResponse
1719
from pyatlan.model.search import DSL
18-
from pyatlan.validate import _is_model_instance, validate_arguments
1920

2021
if TYPE_CHECKING:
2122
from pyatlan.client.aio.client import AsyncAtlanClient
@@ -409,10 +410,11 @@ def _track_response(self, response: AssetMutationResponse, sent: list[Asset]):
409410

410411
@staticmethod
411412
def __track(tracker: List[Asset], candidate: Asset):
412-
if _is_model_instance(candidate, AtlasGlossaryTerm):
413-
# trim_to_required for AtlasGlossaryTerm requires anchor
414-
# which is not include in AssetMutationResponse
415-
asset = cast(Asset, AtlasGlossaryTerm.ref_by_guid(candidate.guid))
413+
if (
414+
isinstance(candidate, AtlasGlossaryTerm)
415+
or getattr(candidate, "type_name", None) == "AtlasGlossaryTerm"
416+
):
417+
asset = cast(Asset, type(candidate).ref_by_guid(candidate.guid))
416418
else:
417419
asset = candidate.trim_to_required()
418420
asset.name = candidate.name

pyatlan/client/aio/contract.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
from typing import Optional
66

7+
from pydantic.v1 import validate_arguments
8+
79
from pyatlan.client.common import AsyncApiCaller, ContractInit
810
from pyatlan.client.constants import CONTRACT_INIT_API
911
from pyatlan.errors import ErrorCode
1012
from pyatlan.model.assets import Asset
11-
from pyatlan.validate import validate_arguments
1213

1314

1415
class AsyncContractClient:

pyatlan/client/aio/credential.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING, Any, Dict, Optional
66

7+
from pydantic.v1 import validate_arguments
8+
79
from pyatlan.client.common import (
810
AsyncApiCaller,
911
CredentialCreate,
@@ -21,7 +23,6 @@
2123
CredentialResponse,
2224
CredentialTestResponse,
2325
)
24-
from pyatlan.validate import validate_arguments
2526

2627
if TYPE_CHECKING:
2728
pass

pyatlan/client/aio/file.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Copyright 2025 Atlan Pte. Ltd.
33
from __future__ import annotations
44

5+
from pydantic.v1 import validate_arguments
6+
57
from pyatlan.client.common import (
68
AsyncApiCaller,
79
FileDownload,
@@ -10,7 +12,6 @@
1012
)
1113
from pyatlan.errors import ErrorCode
1214
from pyatlan.model.file import PresignedURLRequest
13-
from pyatlan.validate import validate_arguments
1415

1516

1617
class AsyncFileClient:

pyatlan/client/aio/group.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from typing import List, Optional
66

7-
from pydantic.v1 import parse_obj_as
7+
from pydantic.v1 import parse_obj_as, validate_arguments
88

99
from pyatlan.client.common import (
1010
AsyncApiCaller,
@@ -20,7 +20,6 @@
2020
from pyatlan.model.aio.user import AsyncUserResponse
2121
from pyatlan.model.group import AtlanGroup, CreateGroupResponse
2222
from pyatlan.model.user import UserRequest
23-
from pyatlan.validate import validate_arguments
2423

2524

2625
class AsyncGroupClient:

pyatlan/client/aio/oauth_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from typing import List, Optional
77

8+
from pydantic.v1 import validate_arguments
9+
810
from pyatlan.client.common import (
911
AsyncApiCaller,
1012
OAuthClientCreate,
@@ -17,7 +19,6 @@
1719
from pyatlan.errors import ErrorCode
1820
from pyatlan.model.aio.oauth_client import AsyncOAuthClientListResponse
1921
from pyatlan.model.oauth_client import OAuthClientCreateResponse, OAuthClientResponse
20-
from pyatlan.validate import validate_arguments
2122

2223

2324
class AsyncOAuthClient:

0 commit comments

Comments
 (0)