duckrun 0.2.12__py3-none-any.whl → 0.2.13.dev0__py3-none-any.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.
Potentially problematic release.
This version of duckrun might be problematic. Click here for more details.
- duckrun/auth.py +38 -14
- {duckrun-0.2.12.dist-info → duckrun-0.2.13.dev0.dist-info}/METADATA +1 -1
- {duckrun-0.2.12.dist-info → duckrun-0.2.13.dev0.dist-info}/RECORD +6 -6
- {duckrun-0.2.12.dist-info → duckrun-0.2.13.dev0.dist-info}/WHEEL +0 -0
- {duckrun-0.2.12.dist-info → duckrun-0.2.13.dev0.dist-info}/licenses/LICENSE +0 -0
- {duckrun-0.2.12.dist-info → duckrun-0.2.13.dev0.dist-info}/top_level.txt +0 -0
duckrun/auth.py
CHANGED
|
@@ -38,21 +38,16 @@ def get_token() -> Optional[str]:
|
|
|
38
38
|
except Exception as e:
|
|
39
39
|
print(f"⚠️ Fabric notebook authentication failed: {e}")
|
|
40
40
|
|
|
41
|
-
#
|
|
41
|
+
# Try local/VS Code authentication (Azure CLI + browser)
|
|
42
|
+
print("🖥️ Trying local authentication (Azure CLI + browser fallback)...")
|
|
43
|
+
token = _get_local_token()
|
|
44
|
+
if token:
|
|
45
|
+
return token
|
|
46
|
+
|
|
47
|
+
# If local auth failed, fall back to device code flow
|
|
48
|
+
print("🔐 Falling back to device code flow for remote/headless environment...")
|
|
42
49
|
try:
|
|
43
|
-
|
|
44
|
-
try:
|
|
45
|
-
import google.colab
|
|
46
|
-
print("🚀 Google Colab detected - using device code flow")
|
|
47
|
-
return _get_device_code_token()
|
|
48
|
-
except ImportError:
|
|
49
|
-
pass
|
|
50
|
-
|
|
51
|
-
# For all other environments (including VS Code), try Azure CLI first
|
|
52
|
-
# This includes local development, VS Code notebooks, etc.
|
|
53
|
-
print("🖥️ Local/VS Code environment detected - trying Azure CLI first, then browser fallback")
|
|
54
|
-
return _get_local_token()
|
|
55
|
-
|
|
50
|
+
return _get_device_code_token()
|
|
56
51
|
except Exception as e:
|
|
57
52
|
print(f"❌ Authentication failed: {e}")
|
|
58
53
|
print("💡 Try refreshing and running again, or check your Azure permissions")
|
|
@@ -82,6 +77,35 @@ def _get_device_code_token() -> Optional[str]:
|
|
|
82
77
|
return None
|
|
83
78
|
|
|
84
79
|
|
|
80
|
+
def _is_databricks() -> bool:
|
|
81
|
+
"""Check if we're running in a Databricks environment"""
|
|
82
|
+
# Databricks sets specific environment variables
|
|
83
|
+
return (
|
|
84
|
+
os.environ.get("DATABRICKS_RUNTIME_VERSION") is not None or
|
|
85
|
+
os.environ.get("DB_HOME") is not None or
|
|
86
|
+
"databricks" in os.environ.get("SPARK_HOME", "").lower()
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _get_databricks_token() -> Optional[str]:
|
|
91
|
+
"""Get token using DefaultAzureCredential for Databricks environments"""
|
|
92
|
+
try:
|
|
93
|
+
from azure.identity import DefaultAzureCredential
|
|
94
|
+
|
|
95
|
+
# DefaultAzureCredential will automatically use Databricks managed identity
|
|
96
|
+
credential = DefaultAzureCredential()
|
|
97
|
+
token_obj = credential.get_token("https://storage.azure.com/.default")
|
|
98
|
+
|
|
99
|
+
os.environ["AZURE_STORAGE_TOKEN"] = token_obj.token
|
|
100
|
+
print("✅ Databricks authentication successful!")
|
|
101
|
+
return token_obj.token
|
|
102
|
+
|
|
103
|
+
except Exception as e:
|
|
104
|
+
print(f"❌ Databricks authentication failed: {e}")
|
|
105
|
+
print("💡 Make sure your Databricks cluster has the required Azure permissions")
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
|
|
85
109
|
def _get_local_token() -> Optional[str]:
|
|
86
110
|
"""Get token using CLI first, then browser fallback for local environments"""
|
|
87
111
|
# First try Azure CLI directly
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
duckrun/__init__.py,sha256=cTj6KQ6hKmgu1z7k9nhDcO5lct049luxjx1V0QnymCo,235
|
|
2
|
-
duckrun/auth.py,sha256=
|
|
2
|
+
duckrun/auth.py,sha256=WjRpbB60lB7z3MTDyBMb0FqoHEesiC3nRiW2moAsrrs,10490
|
|
3
3
|
duckrun/core.py,sha256=3usRl9SetUytVFzCzbpiFXppTjHzwTqFlSEKnUSbcK8,52460
|
|
4
4
|
duckrun/files.py,sha256=Fvdjg3DyHJzIVzKo8M_j-eGz4zU61lOB38Y_onbQJkI,10137
|
|
5
5
|
duckrun/lakehouse.py,sha256=j--Z3zo8AOWt1GF9VzRosmmTAy6ey2D0LVubti58twU,14109
|
|
@@ -7,8 +7,8 @@ duckrun/runner.py,sha256=yrDxfy1RVkb8iK9GKGmIFZHzCvcO_0GVQlbng7Vw_iM,14171
|
|
|
7
7
|
duckrun/semantic_model.py,sha256=obzlN2-dbEW3JmDop-vrZGGGLi9u3ThhTbgtDjou7uY,29509
|
|
8
8
|
duckrun/stats.py,sha256=oKIjZ7u5cFVT63FuOl5UqoDsOG3098woSCn-uI6i_sQ,11084
|
|
9
9
|
duckrun/writer.py,sha256=svUuPCYOhrz299NgnpTKhARKjfej0PxnoND2iPDSypk,8098
|
|
10
|
-
duckrun-0.2.
|
|
11
|
-
duckrun-0.2.
|
|
12
|
-
duckrun-0.2.
|
|
13
|
-
duckrun-0.2.
|
|
14
|
-
duckrun-0.2.
|
|
10
|
+
duckrun-0.2.13.dev0.dist-info/licenses/LICENSE,sha256=-DeQQwdbCbkB4507ZF3QbocysB-EIjDtaLexvqRkGZc,1083
|
|
11
|
+
duckrun-0.2.13.dev0.dist-info/METADATA,sha256=dgJzGSr1W2XaHsPbHbE2Vc9T03DKofX4DAC3lNRAh3I,20771
|
|
12
|
+
duckrun-0.2.13.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
duckrun-0.2.13.dev0.dist-info/top_level.txt,sha256=BknMEwebbUHrVAp3SC92ps8MPhK7XSYsaogTvi_DmEU,8
|
|
14
|
+
duckrun-0.2.13.dev0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|