cocoindex 0.1.69__cp313-cp313-macosx_10_12_x86_64.whl → 0.1.70__cp313-cp313-macosx_10_12_x86_64.whl
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.
- cocoindex/__init__.py +2 -1
- cocoindex/_engine.cpython-313-darwin.so +0 -0
- cocoindex/auth_registry.py +24 -2
- cocoindex/sources.py +9 -0
- {cocoindex-0.1.69.dist-info → cocoindex-0.1.70.dist-info}/METADATA +1 -1
- {cocoindex-0.1.69.dist-info → cocoindex-0.1.70.dist-info}/RECORD +9 -9
- {cocoindex-0.1.69.dist-info → cocoindex-0.1.70.dist-info}/WHEEL +0 -0
- {cocoindex-0.1.69.dist-info → cocoindex-0.1.70.dist-info}/entry_points.txt +0 -0
- {cocoindex-0.1.69.dist-info → cocoindex-0.1.70.dist-info}/licenses/LICENSE +0 -0
cocoindex/__init__.py
CHANGED
@@ -6,7 +6,7 @@ from . import functions, sources, targets, cli, utils
|
|
6
6
|
|
7
7
|
from . import targets as storages # Deprecated: Use targets instead
|
8
8
|
|
9
|
-
from .auth_registry import AuthEntryReference, add_auth_entry,
|
9
|
+
from .auth_registry import AuthEntryReference, add_auth_entry, add_transient_auth_entry
|
10
10
|
from .flow import FlowBuilder, DataScope, DataSlice, Flow, transform_flow
|
11
11
|
from .flow import flow_def
|
12
12
|
from .flow import EvaluateAndDumpOptions, GeneratedField
|
@@ -42,6 +42,7 @@ __all__ = [
|
|
42
42
|
# Auth registry
|
43
43
|
"AuthEntryReference",
|
44
44
|
"add_auth_entry",
|
45
|
+
"add_transient_auth_entry",
|
45
46
|
"ref_auth_entry",
|
46
47
|
# Flow
|
47
48
|
"FlowBuilder",
|
Binary file
|
cocoindex/auth_registry.py
CHANGED
@@ -4,20 +4,42 @@ Auth registry is used to register and reference auth entries.
|
|
4
4
|
|
5
5
|
from dataclasses import dataclass
|
6
6
|
from typing import Generic, TypeVar
|
7
|
+
import threading
|
7
8
|
|
8
9
|
from . import _engine # type: ignore
|
9
10
|
from .convert import dump_engine_object
|
10
11
|
|
11
12
|
T = TypeVar("T")
|
12
13
|
|
14
|
+
# Global atomic counter for generating unique auth entry keys
|
15
|
+
_counter_lock = threading.Lock()
|
16
|
+
_auth_key_counter = 0
|
17
|
+
|
18
|
+
|
19
|
+
def _generate_auth_key() -> str:
|
20
|
+
"""Generate a unique auth entry key using a global atomic counter."""
|
21
|
+
global _auth_key_counter # pylint: disable=global-statement
|
22
|
+
with _counter_lock:
|
23
|
+
_auth_key_counter += 1
|
24
|
+
return f"__auth_{_auth_key_counter}"
|
25
|
+
|
13
26
|
|
14
27
|
@dataclass
|
15
|
-
class
|
16
|
-
"""Reference an auth entry
|
28
|
+
class TransientAuthEntryReference(Generic[T]):
|
29
|
+
"""Reference an auth entry, may or may not have a stable key."""
|
17
30
|
|
18
31
|
key: str
|
19
32
|
|
20
33
|
|
34
|
+
class AuthEntryReference(TransientAuthEntryReference[T]):
|
35
|
+
"""Reference an auth entry, with a key stable across ."""
|
36
|
+
|
37
|
+
|
38
|
+
def add_transient_auth_entry(value: T) -> TransientAuthEntryReference[T]:
|
39
|
+
"""Add an auth entry to the registry. Returns its reference."""
|
40
|
+
return add_auth_entry(_generate_auth_key(), value)
|
41
|
+
|
42
|
+
|
21
43
|
def add_auth_entry(key: str, value: T) -> AuthEntryReference[T]:
|
22
44
|
"""Add an auth entry to the registry. Returns its reference."""
|
23
45
|
_engine.add_auth_entry(key, dump_engine_object(value))
|
cocoindex/sources.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"""All builtin sources."""
|
2
2
|
|
3
3
|
from . import op
|
4
|
+
from .auth_registry import TransientAuthEntryReference
|
4
5
|
import datetime
|
5
6
|
|
6
7
|
|
@@ -48,6 +49,11 @@ class AmazonS3(op.SourceSpec):
|
|
48
49
|
class AzureBlob(op.SourceSpec):
|
49
50
|
"""
|
50
51
|
Import data from an Azure Blob Storage container. Supports optional prefix and file filtering by glob patterns.
|
52
|
+
|
53
|
+
Authentication mechanisms taken in the following order:
|
54
|
+
- SAS token (if provided)
|
55
|
+
- Account access key (if provided)
|
56
|
+
- Default Azure credential
|
51
57
|
"""
|
52
58
|
|
53
59
|
_op_category = op.OpCategory.SOURCE
|
@@ -58,3 +64,6 @@ class AzureBlob(op.SourceSpec):
|
|
58
64
|
binary: bool = False
|
59
65
|
included_patterns: list[str] | None = None
|
60
66
|
excluded_patterns: list[str] | None = None
|
67
|
+
|
68
|
+
sas_token: TransientAuthEntryReference[str] | None = None
|
69
|
+
account_access_key: TransientAuthEntryReference[str] | None = None
|
@@ -1,10 +1,10 @@
|
|
1
|
-
cocoindex-0.1.
|
2
|
-
cocoindex-0.1.
|
3
|
-
cocoindex-0.1.
|
4
|
-
cocoindex-0.1.
|
5
|
-
cocoindex/__init__.py,sha256=
|
6
|
-
cocoindex/_engine.cpython-313-darwin.so,sha256=
|
7
|
-
cocoindex/auth_registry.py,sha256=
|
1
|
+
cocoindex-0.1.70.dist-info/METADATA,sha256=Gdw3w3VA6RIZKs3UF0U_zOQegTF3yr37rEdg4bRgkEU,11216
|
2
|
+
cocoindex-0.1.70.dist-info/WHEEL,sha256=wSGr6OIJgwRPWZnPAVOrHij4aC8ZJCcq6TxNvrljOp4,106
|
3
|
+
cocoindex-0.1.70.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
|
4
|
+
cocoindex-0.1.70.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
5
|
+
cocoindex/__init__.py,sha256=fwYRpqZjdJmsYVQU2eWw4tGzqwikBy-D1RQW-5KAAXk,2104
|
6
|
+
cocoindex/_engine.cpython-313-darwin.so,sha256=Pvye36aJwdY5zScKTTpVq2WLUPS_qT0K5whM-ZuAUEo,67668444
|
7
|
+
cocoindex/auth_registry.py,sha256=PE1-kVkcyC1G2C_V7b1kvYzeq73OFQehWKQP7ln7fJ8,1478
|
8
8
|
cocoindex/cli.py,sha256=-gp639JSyQN6YjnhGqCakIzYoSSqXxQMbxbkcYGP0QY,22359
|
9
9
|
cocoindex/convert.py,sha256=RYfRUungabr-dHakG4k2kDvYambxHFljAmTuPQeQths,13117
|
10
10
|
cocoindex/flow.py,sha256=XS63KkRr8JV8Mxg3KzW2Y7Y-GyUlaFTdRrw_sc7l0H4,36046
|
@@ -17,7 +17,7 @@ cocoindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
cocoindex/runtime.py,sha256=povilB3HH3y1JF-yxKwU-pD8n2WnAqyQxIgvXXHNc60,1080
|
18
18
|
cocoindex/setting.py,sha256=ADuv7RaWd9k-m3V0Cfy2jmaCt6DupJCviWdOm0CTiVw,4734
|
19
19
|
cocoindex/setup.py,sha256=7uIHKN4FOCuoidPXcKyGTrkqpkl9luL49-6UcnMxYzw,3068
|
20
|
-
cocoindex/sources.py,sha256=
|
20
|
+
cocoindex/sources.py,sha256=69COA4qbZDipzGYfXv-WJSmicFkA509xIShRGDh6A0A,2083
|
21
21
|
cocoindex/targets.py,sha256=Nfh_tpFd1goTnS_cxBjIs4j9zl3Z4Z1JomAQ1dl3Sic,2796
|
22
22
|
cocoindex/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
23
|
cocoindex/tests/test_convert.py,sha256=48-fnWKv02gmFETV3b-8IC89SKMUZfJLEH-ucRtXGuI,45450
|
@@ -25,4 +25,4 @@ cocoindex/tests/test_optional_database.py,sha256=snAmkNa6wtOSaxoZE1HgjvL5v_ylitt
|
|
25
25
|
cocoindex/tests/test_typing.py,sha256=NB4nUzoumOF_wGFa4D2Xf6d0bUVtOiSXyb78M1pYSG4,14827
|
26
26
|
cocoindex/typing.py,sha256=MO9HkrNpargvMPvpkd7jgSu2R-21KE_NaB9-WI4YOZA,13241
|
27
27
|
cocoindex/utils.py,sha256=hUhX-XV6XGCtJSEIpBOuDv6VvqImwPlgBxztBTw7u0U,598
|
28
|
-
cocoindex-0.1.
|
28
|
+
cocoindex-0.1.70.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|