atlan-application-sdk-api 3.58.0__tar.gz → 3.59.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/.gitignore +4 -2
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/PKG-INFO +4 -4
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/api-files.txt +2 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_context_errors.py +25 -15
- atlan_application_sdk_api-3.59.0/application_sdk/_deprecation.py +195 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_env.py +50 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_obstore_config.py +4 -4
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_runtime/cgroup.py +1 -1
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_runtime/offload.py +7 -3
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/base.py +11 -9
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/sql.py +133 -6
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/sql_errors.py +38 -15
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/sql_typecasters.py +3 -3
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/__init__.py +2 -1
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/_listing.py +1 -1
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/aws_utils.py +3 -3
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/backoff.py +4 -2
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/sql_filters.py +54 -11
- atlan_application_sdk_api-3.59.0/application_sdk/common/sql_filters_errors.py +34 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/utils.py +8 -15
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/constants.py +43 -30
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/contracts/base.py +67 -52
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/contracts/types.py +17 -11
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/errors.py +63 -87
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/types.py +7 -7
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/utils.py +10 -9
- atlan_application_sdk_api-3.59.0/application_sdk/errors/__init__.py +413 -0
- atlan_application_sdk_api-3.59.0/application_sdk/errors/_legacy_codes.py +181 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/errors/base.py +100 -3
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/_dispatch.py +1 -1
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/base.py +32 -21
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/contracts.py +40 -90
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/metadata_routes.py +7 -7
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/object_routes.py +298 -15
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/request_contract.py +40 -10
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/routes.py +7 -4
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/templates/contracts/incremental_sql.py +1 -1
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/version.py +2 -2
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/pyproject.toml +4 -4
- atlan_application_sdk_api-3.58.0/application_sdk/common/sql_filters_errors.py +0 -17
- atlan_application_sdk_api-3.58.0/application_sdk/errors/__init__.py +0 -228
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/README.md +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_build_info.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_install.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_logging.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_runtime/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_runtime/progress.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/_interface.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/_sql_failure_classifier.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/http_errors.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/models.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/clients/ssl_utils.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/_generated_tree.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/aws_utils_errors.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/build_identity.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/concurrency.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/errors.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/filter_matching.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/logger.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/models.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/ssl_utils.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/task_queue.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/common/types.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/contracts/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/contracts/events.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/contracts/types_errors.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/extra.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/ingress.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/ref.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/requirements.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/credentials/spec.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/errors/categories.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/errors/http.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/errors/leaves.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/errors/wire.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/_warmup.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/asgi.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/context.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/manifest.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/handler/service_errors.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/server/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/server/fastapi/models.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/templates/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/templates/contracts/__init__.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/templates/contracts/base_metadata_extraction.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/templates/contracts/sql_metadata.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/templates/contracts/sql_query.py +0 -0
- {atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/hatch_build.py +0 -0
|
@@ -167,8 +167,10 @@ docstring-cov.md
|
|
|
167
167
|
# vscode settings
|
|
168
168
|
.vscode
|
|
169
169
|
|
|
170
|
-
# local
|
|
171
|
-
|
|
170
|
+
# local (local/temporal-auth/ is the tracked Docker JWT-auth Temporal stack;
|
|
171
|
+
# its keys stay ignored by its own .gitignore)
|
|
172
|
+
local/*
|
|
173
|
+
!local/temporal-auth/
|
|
172
174
|
temporal.db
|
|
173
175
|
|
|
174
176
|
# Claude Code worktrees
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: atlan-application-sdk-api
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.59.0
|
|
4
4
|
Summary: Experimental: the handler surface of the Atlan Application SDK, for the consolidated API host
|
|
5
5
|
Project-URL: Homepage, https://github.com/atlanhq/application-sdk
|
|
6
6
|
Project-URL: Source, https://github.com/atlanhq/application-sdk/tree/main/packages/api
|
|
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
20
20
|
Requires-Python: >=3.11
|
|
21
21
|
Requires-Dist: certifi>=2026.10.19
|
|
22
|
-
Requires-Dist: fastapi<0.
|
|
22
|
+
Requires-Dist: fastapi<0.166.0,>=0.165.0
|
|
23
23
|
Requires-Dist: httpx<0.29.0,>=0.27.0
|
|
24
24
|
Requires-Dist: orjson<4.0.0,>=3.11.6
|
|
25
25
|
Requires-Dist: pydantic<3.0.0,>=2.10.6
|
|
@@ -34,8 +34,8 @@ Requires-Dist: obstore<0.13.0,>=0.12.0; extra == 'obstore'
|
|
|
34
34
|
Provides-Extra: pandas
|
|
35
35
|
Requires-Dist: pandas<4.0.0,>=2.2.3; extra == 'pandas'
|
|
36
36
|
Provides-Extra: pyatlan
|
|
37
|
-
Requires-Dist: authlib<2,>=1.9.
|
|
38
|
-
Requires-Dist: pyatlan<12,>=11.
|
|
37
|
+
Requires-Dist: authlib<2,>=1.9.9; extra == 'pyatlan'
|
|
38
|
+
Requires-Dist: pyatlan<12,>=11.8.0; extra == 'pyatlan'
|
|
39
39
|
Provides-Extra: sql
|
|
40
40
|
Requires-Dist: httpx<0.29.0,>=0.27.0; extra == 'sql'
|
|
41
41
|
Requires-Dist: python-dotenv<2.0.0,>=1.2.2; extra == 'sql'
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
application_sdk/__init__.py
|
|
5
5
|
application_sdk/_build_info.py
|
|
6
6
|
application_sdk/_context_errors.py
|
|
7
|
+
application_sdk/_deprecation.py
|
|
7
8
|
application_sdk/_env.py
|
|
8
9
|
application_sdk/_install.py
|
|
9
10
|
application_sdk/_logging.py
|
|
@@ -56,6 +57,7 @@ application_sdk/credentials/spec.py
|
|
|
56
57
|
application_sdk/credentials/types.py
|
|
57
58
|
application_sdk/credentials/utils.py
|
|
58
59
|
application_sdk/errors/__init__.py
|
|
60
|
+
application_sdk/errors/_legacy_codes.py
|
|
59
61
|
application_sdk/errors/base.py
|
|
60
62
|
application_sdk/errors/categories.py
|
|
61
63
|
application_sdk/errors/http.py
|
|
@@ -10,7 +10,10 @@ from __future__ import annotations
|
|
|
10
10
|
from dataclasses import dataclass
|
|
11
11
|
from typing import ClassVar
|
|
12
12
|
|
|
13
|
-
from application_sdk
|
|
13
|
+
from application_sdk import _deprecation
|
|
14
|
+
from application_sdk.errors import _legacy_codes
|
|
15
|
+
from application_sdk.errors._legacy_codes import ErrorCode
|
|
16
|
+
from application_sdk.errors.base import _LegacyErrorCodeMixin
|
|
14
17
|
from application_sdk.errors.leaves import InternalError as _InternalError
|
|
15
18
|
from application_sdk.errors.leaves import PreconditionError
|
|
16
19
|
|
|
@@ -38,7 +41,8 @@ class SecretStoreNotConfiguredError(PreconditionError):
|
|
|
38
41
|
expected_state: str | None = "configured"
|
|
39
42
|
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
@dataclass(kw_only=True)
|
|
45
|
+
class AppContextError(_LegacyErrorCodeMixin, _InternalError):
|
|
42
46
|
"""Raised when App or task context is accessed outside of valid execution scope.
|
|
43
47
|
|
|
44
48
|
This is a programming error — it indicates that context-dependent methods
|
|
@@ -46,20 +50,26 @@ class AppContextError(_InternalError):
|
|
|
46
50
|
workflow run or @task execution.
|
|
47
51
|
"""
|
|
48
52
|
|
|
49
|
-
DEFAULT_ERROR_CODE: ClassVar[ErrorCode] = APP_CONTEXT_ERROR
|
|
50
53
|
code: ClassVar[str] = "INTERNAL_APP_CONTEXT"
|
|
51
54
|
|
|
52
55
|
def __init__(self, message: str, *, error_code: ErrorCode | None = None) -> None:
|
|
53
56
|
_InternalError.__init__(self, message=message)
|
|
54
|
-
self.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
self._set_legacy_error_code(error_code)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#: The AAF-* constants this module imported before FND-4299, kept importable
|
|
61
|
+
#: from here with a warning until v4.0.0. Literal per entry: the surface gate
|
|
62
|
+
#: and gen-deprecations read this table statically.
|
|
63
|
+
_DEPRECATED_CONSTANTS: dict[str, tuple[str, str]] = {
|
|
64
|
+
"APP_CONTEXT_ERROR": (
|
|
65
|
+
"the code ClassVar of a typed application_sdk.errors.AppError subclass",
|
|
66
|
+
"AAF-* codes are a second error vocabulary beside code",
|
|
67
|
+
),
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
__getattr__ = _deprecation.deprecated_module_getattr(
|
|
71
|
+
__name__,
|
|
72
|
+
_DEPRECATED_CONSTANTS,
|
|
73
|
+
remove_in="4.0.0",
|
|
74
|
+
resolve=lambda name: getattr(_legacy_codes, name),
|
|
75
|
+
)
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"""The one deprecation mechanism the SDK uses.
|
|
2
|
+
|
|
3
|
+
Three shapes cover every deprecation, and each has one helper here:
|
|
4
|
+
|
|
5
|
+
* **A def or a class** — :func:`deprecated` (PEP 702, re-exported from
|
|
6
|
+
``typing_extensions``). Type checkers flag the call site and Python warns on
|
|
7
|
+
use.
|
|
8
|
+
* **A deprecated way of calling something** (a parameter, a default, a mode) —
|
|
9
|
+
:func:`warn_deprecated`. It builds the notice in one fixed format, so every
|
|
10
|
+
notice names a replacement and a removal version.
|
|
11
|
+
* **A module-level name** (a moved or removed constant, a re-export) —
|
|
12
|
+
:func:`deprecated_module_getattr`, a PEP 562 ``__getattr__`` built from a
|
|
13
|
+
``_DEPRECATED_CONSTANTS`` table.
|
|
14
|
+
|
|
15
|
+
Standard library and ``typing_extensions`` only: ``application_sdk.constants``
|
|
16
|
+
uses the module-level shim, so nothing here may import from the SDK.
|
|
17
|
+
|
|
18
|
+
The conformance suite reads these statically. A ``warn_deprecated(...)`` call
|
|
19
|
+
and a ``__getattr__ = deprecated_module_getattr(...)`` assignment are both
|
|
20
|
+
graded by B002/B003 and recorded in the deprecated-symbol manifest, so pass the
|
|
21
|
+
name, replacement and ``remove_in`` as literals. A value held in a variable
|
|
22
|
+
cannot be read without running the code. See ``docs/standards/symbols.md``.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
import importlib
|
|
28
|
+
import re
|
|
29
|
+
import warnings
|
|
30
|
+
from collections.abc import Callable, Mapping
|
|
31
|
+
|
|
32
|
+
from typing_extensions import deprecated
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"deprecated",
|
|
36
|
+
"deprecated_module_getattr",
|
|
37
|
+
"deprecation_message",
|
|
38
|
+
"lazy_resolver",
|
|
39
|
+
"warn_deprecated",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
#: A removal version is a full ``major.minor.patch``. ``4.0`` and ``4.0.0``
|
|
43
|
+
#: name the same release, and allowing both made the SDK use both.
|
|
44
|
+
_VERSION_RE = re.compile(r"\d+\.\d+\.\d+")
|
|
45
|
+
|
|
46
|
+
#: One ``_DEPRECATED_CONSTANTS`` entry: ``(replacement, why)``, or a complete
|
|
47
|
+
#: notice string for a name with no replacement to point at.
|
|
48
|
+
DeprecatedName = tuple[str, str] | str
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _check_version(remove_in: str) -> None:
|
|
52
|
+
if not _VERSION_RE.fullmatch(remove_in):
|
|
53
|
+
raise ValueError(
|
|
54
|
+
f"remove_in must be a full major.minor.patch version such as "
|
|
55
|
+
f"'4.0.0', not {remove_in!r}"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def deprecation_message(
|
|
60
|
+
name: str, replacement: str, remove_in: str, *, note: str | None = None
|
|
61
|
+
) -> str:
|
|
62
|
+
"""The notice text :func:`warn_deprecated` emits.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
name: What is deprecated, as the caller wrote it.
|
|
66
|
+
replacement: What to use instead.
|
|
67
|
+
remove_in: The release that removes it, as ``major.minor.patch``.
|
|
68
|
+
note: Why, or what changes; appended after the replacement.
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
ValueError: *remove_in* is not a ``major.minor.patch`` version.
|
|
72
|
+
"""
|
|
73
|
+
_check_version(remove_in)
|
|
74
|
+
why = f" — {note.rstrip(' .')}" if note else ""
|
|
75
|
+
return (
|
|
76
|
+
f"{name} is deprecated; use {replacement} instead{why}. "
|
|
77
|
+
f"Will be removed in v{remove_in}."
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _emit(message: str, stacklevel: int) -> None:
|
|
82
|
+
# The notice is graded where warn_deprecated / deprecated_module_getattr is
|
|
83
|
+
# called with literals; this call only forwards it.
|
|
84
|
+
# conformance: ignore[B002] forwards a notice graded at its call site
|
|
85
|
+
warnings.warn(message, DeprecationWarning, stacklevel=stacklevel + 1)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def warn_deprecated(
|
|
89
|
+
name: str,
|
|
90
|
+
replacement: str,
|
|
91
|
+
remove_in: str,
|
|
92
|
+
*,
|
|
93
|
+
note: str | None = None,
|
|
94
|
+
stacklevel: int = 2,
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Emit a ``DeprecationWarning`` in the SDK's one notice format.
|
|
97
|
+
|
|
98
|
+
*stacklevel* means what it means to :func:`warnings.warn` called from the
|
|
99
|
+
same place: the default ``2`` points at the caller of the function that
|
|
100
|
+
calls this.
|
|
101
|
+
|
|
102
|
+
Raises:
|
|
103
|
+
ValueError: *remove_in* is not a ``major.minor.patch`` version.
|
|
104
|
+
"""
|
|
105
|
+
_emit(deprecation_message(name, replacement, remove_in, note=note), stacklevel + 1)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _import_dotted(path: str) -> object:
|
|
109
|
+
"""Resolve ``package.module.Attr[.attr]`` by importing the longest module prefix."""
|
|
110
|
+
parts = path.split(".")
|
|
111
|
+
for split in range(len(parts) - 1, 0, -1):
|
|
112
|
+
candidate = ".".join(parts[:split])
|
|
113
|
+
try:
|
|
114
|
+
target: object = importlib.import_module(candidate)
|
|
115
|
+
except ModuleNotFoundError as exc:
|
|
116
|
+
# Only the candidate (or a package above it) being absent means
|
|
117
|
+
# "try a shorter prefix"; a missing dependency of a module that
|
|
118
|
+
# exists is the real error.
|
|
119
|
+
if exc.name is None or not (
|
|
120
|
+
candidate == exc.name or candidate.startswith(exc.name + ".")
|
|
121
|
+
):
|
|
122
|
+
raise
|
|
123
|
+
continue
|
|
124
|
+
for attr in parts[split:]:
|
|
125
|
+
target = getattr(target, attr)
|
|
126
|
+
return target
|
|
127
|
+
raise ImportError(f"cannot resolve {path!r} to an importable object")
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def lazy_resolver(lazy: Mapping[str, tuple[str, str]]) -> Callable[[str], object]:
|
|
131
|
+
"""A *resolve* for :func:`deprecated_module_getattr` that reads a ``_LAZY`` map.
|
|
132
|
+
|
|
133
|
+
*lazy* maps each name to ``(module, attribute)``; the module is imported on
|
|
134
|
+
first access, so serving a deprecated name costs nothing until it is used.
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
def resolve(name: str) -> object:
|
|
138
|
+
module, attr = lazy[name]
|
|
139
|
+
return getattr(importlib.import_module(module), attr)
|
|
140
|
+
|
|
141
|
+
return resolve
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def deprecated_module_getattr(
|
|
145
|
+
module: str,
|
|
146
|
+
table: Mapping[str, DeprecatedName],
|
|
147
|
+
*,
|
|
148
|
+
remove_in: str,
|
|
149
|
+
resolve: Callable[[str], object] | None = None,
|
|
150
|
+
fallback: Callable[[str], object] | None = None,
|
|
151
|
+
) -> Callable[[str], object]:
|
|
152
|
+
"""Build a module ``__getattr__`` (PEP 562) that serves deprecated names.
|
|
153
|
+
|
|
154
|
+
Use it as ``__getattr__ = deprecated_module_getattr(__name__,
|
|
155
|
+
_DEPRECATED_CONSTANTS, remove_in="4.0.0")``. Each access to a name in
|
|
156
|
+
*table* warns at the caller's line and returns the value. A real binding of
|
|
157
|
+
the same name at module scope would resolve first and never warn, so do not
|
|
158
|
+
keep one.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
module: The module's ``__name__``, for the ``AttributeError`` message.
|
|
162
|
+
table: ``_DEPRECATED_CONSTANTS``. A ``(replacement, why)`` entry is
|
|
163
|
+
formatted by :func:`deprecation_message`. A string entry is the
|
|
164
|
+
complete notice, for a name with nothing to replace it; it starts
|
|
165
|
+
with the name, and is emitted qualified by *module*.
|
|
166
|
+
remove_in: The release that removes every name in *table*.
|
|
167
|
+
resolve: Returns the value for a name. Defaults to importing the
|
|
168
|
+
entry's replacement as a dotted path, which fits a name that moved.
|
|
169
|
+
fallback: Called for a name not in *table*, for a module whose
|
|
170
|
+
``__getattr__`` also serves lazy imports. Without one, such a
|
|
171
|
+
name raises ``AttributeError``.
|
|
172
|
+
|
|
173
|
+
Raises:
|
|
174
|
+
ValueError: *remove_in* is not a ``major.minor.patch`` version.
|
|
175
|
+
"""
|
|
176
|
+
_check_version(remove_in)
|
|
177
|
+
|
|
178
|
+
def __getattr__(name: str) -> object:
|
|
179
|
+
entry = table.get(name)
|
|
180
|
+
if entry is None:
|
|
181
|
+
if fallback is not None:
|
|
182
|
+
return fallback(name)
|
|
183
|
+
raise AttributeError(f"module {module!r} has no attribute {name!r}")
|
|
184
|
+
if isinstance(entry, str):
|
|
185
|
+
_emit(f"{module}.{entry}", 2)
|
|
186
|
+
if resolve is None:
|
|
187
|
+
raise AssertionError(f"{module}.{name} has no resolver")
|
|
188
|
+
return resolve(name)
|
|
189
|
+
replacement, note = entry
|
|
190
|
+
_emit(deprecation_message(name, replacement, remove_in, note=note), 2)
|
|
191
|
+
if resolve is not None:
|
|
192
|
+
return resolve(name)
|
|
193
|
+
return _import_dotted(replacement)
|
|
194
|
+
|
|
195
|
+
return __getattr__
|
{atlan_application_sdk_api-3.58.0 → atlan_application_sdk_api-3.59.0}/application_sdk/_env.py
RENAMED
|
@@ -23,12 +23,19 @@ logging is not configured yet. A caller that runs after logging is up passes
|
|
|
23
23
|
``report`` to route the message to its logger instead;
|
|
24
24
|
:mod:`application_sdk.common._env` does that for SDK modules that can import the
|
|
25
25
|
logger.
|
|
26
|
+
|
|
27
|
+
A warning alone would bypass OTel, and Python shows each one once per process.
|
|
28
|
+
So every default-path message is also handed to the SDK logger: the logger
|
|
29
|
+
module installs itself with :func:`set_log_sink` once it exists, and the
|
|
30
|
+
messages from before that (``constants``' import-time reads) are held until
|
|
31
|
+
then and logged in order.
|
|
26
32
|
"""
|
|
27
33
|
|
|
28
34
|
from __future__ import annotations
|
|
29
35
|
|
|
30
36
|
import math
|
|
31
37
|
import os
|
|
38
|
+
import threading
|
|
32
39
|
import warnings
|
|
33
40
|
from collections.abc import Callable, Collection
|
|
34
41
|
|
|
@@ -50,6 +57,48 @@ def _raw(key: str) -> str | None:
|
|
|
50
57
|
return stripped or None
|
|
51
58
|
|
|
52
59
|
|
|
60
|
+
#: Default-path messages from before :func:`set_log_sink` ran, oldest first.
|
|
61
|
+
_pending: list[str] = []
|
|
62
|
+
_log_sink: Reporter | None = None
|
|
63
|
+
#: Held while reading the sink and holding a message, and while installing the
|
|
64
|
+
#: sink and draining, so a message held during installation is still drained.
|
|
65
|
+
_sink_lock = threading.Lock()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def set_log_sink(sink: Reporter) -> None:
|
|
69
|
+
"""Log every default-path rejection through *sink*, starting with the held ones.
|
|
70
|
+
|
|
71
|
+
Called once by the SDK logger module when it is imported, so a malformed
|
|
72
|
+
value read while ``constants`` was importing still reaches the logs.
|
|
73
|
+
"""
|
|
74
|
+
global _log_sink
|
|
75
|
+
with _sink_lock:
|
|
76
|
+
_log_sink = sink
|
|
77
|
+
held = list(_pending)
|
|
78
|
+
_pending.clear()
|
|
79
|
+
for message in held:
|
|
80
|
+
sink(message)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _to_log(message: str) -> None:
|
|
84
|
+
with _sink_lock:
|
|
85
|
+
sink = _log_sink
|
|
86
|
+
if sink is None:
|
|
87
|
+
_pending.append(message)
|
|
88
|
+
return
|
|
89
|
+
sink(message)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def warn_rejected(message: str, category: type[Warning] = RuntimeWarning) -> None:
|
|
93
|
+
"""Report a rejected setting the way the ``env_*`` readers do.
|
|
94
|
+
|
|
95
|
+
For a module that parses a value itself: warns at the caller's caller (as
|
|
96
|
+
``warnings.warn(stacklevel=2)`` from the caller would) and logs it.
|
|
97
|
+
"""
|
|
98
|
+
warnings.warn(message, category, stacklevel=3)
|
|
99
|
+
_to_log(message)
|
|
100
|
+
|
|
101
|
+
|
|
53
102
|
def _reject(message: str, report: Reporter | None) -> None:
|
|
54
103
|
if report is not None:
|
|
55
104
|
report(message)
|
|
@@ -57,6 +106,7 @@ def _reject(message: str, report: Reporter | None) -> None:
|
|
|
57
106
|
# stacklevel 3: point at the line that called env_int/env_float/..., not
|
|
58
107
|
# at this helper or the env_* function itself.
|
|
59
108
|
warnings.warn(message, RuntimeWarning, stacklevel=3)
|
|
109
|
+
_to_log(message)
|
|
60
110
|
|
|
61
111
|
|
|
62
112
|
def env_int(
|
|
@@ -101,7 +101,7 @@ def _default_user_agent() -> str:
|
|
|
101
101
|
module into circular-import paths during package init.
|
|
102
102
|
"""
|
|
103
103
|
try:
|
|
104
|
-
from application_sdk.version import ( #
|
|
104
|
+
from application_sdk.version import ( # noqa: PLC0415
|
|
105
105
|
__version__,
|
|
106
106
|
)
|
|
107
107
|
|
|
@@ -236,7 +236,7 @@ def make_s3_store(
|
|
|
236
236
|
)
|
|
237
237
|
if credential_provider is not None:
|
|
238
238
|
kw["credential_provider"] = credential_provider
|
|
239
|
-
return S3Store(**kw) #
|
|
239
|
+
return S3Store(**kw) # pyright: ignore[reportArgumentType]
|
|
240
240
|
|
|
241
241
|
|
|
242
242
|
# obstore-rs reads ``AZURE_*`` from the environment at AzureStore construction
|
|
@@ -335,7 +335,7 @@ def make_azure_store(
|
|
|
335
335
|
_azure_config_has_explicit_credential(config) or credential_provider is not None
|
|
336
336
|
)
|
|
337
337
|
with _suppress_ambient_azure_env(isolate):
|
|
338
|
-
return AzureStore(**kw) #
|
|
338
|
+
return AzureStore(**kw) # pyright: ignore[reportArgumentType]
|
|
339
339
|
|
|
340
340
|
|
|
341
341
|
def make_gcs_store(
|
|
@@ -365,7 +365,7 @@ def make_gcs_store(
|
|
|
365
365
|
)
|
|
366
366
|
if credential_provider is not None:
|
|
367
367
|
kw["credential_provider"] = credential_provider
|
|
368
|
-
return GCSStore(**kw) #
|
|
368
|
+
return GCSStore(**kw) # pyright: ignore[reportArgumentType]
|
|
369
369
|
|
|
370
370
|
|
|
371
371
|
def log_obstore_config(
|
|
@@ -77,7 +77,7 @@ def cpu_quota_cores(cpu_max_v2: str, quota_v1: str, period_v1: str) -> float | N
|
|
|
77
77
|
def _affinity_count() -> int:
|
|
78
78
|
"""CPUs in this process's affinity mask, or the node's count without one."""
|
|
79
79
|
try:
|
|
80
|
-
return len(os.sched_getaffinity(0)) or 1
|
|
80
|
+
return len(os.sched_getaffinity(0)) or 1
|
|
81
81
|
except AttributeError:
|
|
82
82
|
# No affinity API (macOS, Windows): the node's count is all there is.
|
|
83
83
|
return os.cpu_count() or 1
|
|
@@ -239,7 +239,7 @@ class CancelHandle:
|
|
|
239
239
|
if not self._requested and self._action is action:
|
|
240
240
|
self._action = previous
|
|
241
241
|
if fire_previous:
|
|
242
|
-
_fire_cancel_action(previous) #
|
|
242
|
+
_fire_cancel_action(previous) # pyright: ignore[reportArgumentType]
|
|
243
243
|
|
|
244
244
|
def request(self) -> None:
|
|
245
245
|
"""Request a cancel: fire the registered action, if any, at most once.
|
|
@@ -762,7 +762,11 @@ def _ensure_stranded_gauge() -> None:
|
|
|
762
762
|
_INSTRUMENTS["stranded"] = None
|
|
763
763
|
except Exception:
|
|
764
764
|
_INSTRUMENTS["stranded"] = None
|
|
765
|
-
logger.
|
|
765
|
+
logger.warning(
|
|
766
|
+
"Could not register offload.stranded_threads; stranded "
|
|
767
|
+
"run_in_thread calls will be logged but not gauged",
|
|
768
|
+
exc_info=True,
|
|
769
|
+
)
|
|
766
770
|
|
|
767
771
|
|
|
768
772
|
def _on_offload_done(slot: _OffloadSlot) -> None:
|
|
@@ -1686,7 +1690,7 @@ async def run_best_effort(
|
|
|
1686
1690
|
timeout,
|
|
1687
1691
|
exc_info=True,
|
|
1688
1692
|
)
|
|
1689
|
-
except Exception: #
|
|
1693
|
+
except Exception: # best-effort work must never break the caller
|
|
1690
1694
|
logger.warning("%s skipped due to an unexpected error", label, exc_info=True)
|
|
1691
1695
|
return None
|
|
1692
1696
|
|
|
@@ -13,6 +13,7 @@ from httpx._types import (
|
|
|
13
13
|
RequestFiles,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
+
from application_sdk import _deprecation
|
|
16
17
|
from application_sdk._logging import get_logger
|
|
17
18
|
from application_sdk.clients._interface import ClientInterface
|
|
18
19
|
from application_sdk.clients.http_errors import HttpClientSourceUnavailableError
|
|
@@ -115,7 +116,7 @@ class _EnvProxyHTTPTransport(httpx.AsyncHTTPTransport):
|
|
|
115
116
|
for transport in proxied:
|
|
116
117
|
try:
|
|
117
118
|
await transport.aclose()
|
|
118
|
-
except BaseException as exc: # includes CancelledError; re-
|
|
119
|
+
except BaseException as exc: # noqa: BLE001 — includes CancelledError; the first close error is returned to __aexit__, which re-raises it
|
|
119
120
|
if first_error is None:
|
|
120
121
|
first_error = exc
|
|
121
122
|
return first_error
|
|
@@ -456,7 +457,7 @@ class BaseClient(ClientInterface):
|
|
|
456
457
|
auth=auth if auth is not None else httpx.USE_CLIENT_DEFAULT,
|
|
457
458
|
)
|
|
458
459
|
return response
|
|
459
|
-
except Exception as exc: #
|
|
460
|
+
except Exception as exc: # noqa: BLE001 — _request_failed logs with exc_info or raises typed
|
|
460
461
|
# conformance: ignore[E007] deprecated None-on-failure contract until v4.0
|
|
461
462
|
return _request_failed("GET", url, exc, raise_on_error)
|
|
462
463
|
|
|
@@ -597,7 +598,7 @@ class BaseClient(ClientInterface):
|
|
|
597
598
|
follow_redirects=follow_redirects,
|
|
598
599
|
)
|
|
599
600
|
return response
|
|
600
|
-
except Exception as exc: #
|
|
601
|
+
except Exception as exc: # noqa: BLE001 — _request_failed logs with exc_info or raises typed
|
|
601
602
|
# conformance: ignore[E007] deprecated None-on-failure contract until v4.0
|
|
602
603
|
return _request_failed("POST", url, exc, raise_on_error)
|
|
603
604
|
|
|
@@ -607,12 +608,13 @@ def _warn_if_raise_on_error_unset(
|
|
|
607
608
|
) -> None:
|
|
608
609
|
"""Warn a caller still relying on the deprecated ``None``-on-failure default."""
|
|
609
610
|
if raise_on_error is None:
|
|
610
|
-
|
|
611
|
-
f"BaseClient.{method_name}
|
|
612
|
-
"raise_on_error=True
|
|
613
|
-
"
|
|
614
|
-
"
|
|
615
|
-
|
|
611
|
+
_deprecation.warn_deprecated(
|
|
612
|
+
f"BaseClient.{method_name} without raise_on_error",
|
|
613
|
+
"raise_on_error=True, which raises SourceUnavailableError when a "
|
|
614
|
+
"request fails (or raise_on_error=False to keep None)",
|
|
615
|
+
"4.0.0",
|
|
616
|
+
note="it returns None when a request fails; the None default goes "
|
|
617
|
+
"and raise_on_error=True becomes the default",
|
|
616
618
|
stacklevel=3,
|
|
617
619
|
)
|
|
618
620
|
|