pipeloom-databricks 0.5.0__tar.gz → 0.6.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.
Files changed (62) hide show
  1. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/PKG-INFO +3 -3
  2. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/pyproject.toml +2 -2
  3. pipeloom_databricks-0.6.0/src/pipeloom_databricks/api.py +77 -0
  4. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/client/connect.py +27 -2
  5. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_connect.py +25 -0
  6. pipeloom_databricks-0.5.0/src/pipeloom_databricks/api.py +0 -45
  7. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/.gitignore +0 -0
  8. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/LICENSE +0 -0
  9. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/NOTICE +0 -0
  10. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/README.md +0 -0
  11. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/__init__.py +0 -0
  12. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/bundle.py +0 -0
  13. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/cli.py +0 -0
  14. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/client/__init__.py +0 -0
  15. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/client/sdk.py +0 -0
  16. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/deploy.py +0 -0
  17. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/finalize_states.py +0 -0
  18. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/grouping.py +0 -0
  19. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/jobs_model.py +0 -0
  20. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/keys.py +0 -0
  21. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/options.py +0 -0
  22. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/py.typed +0 -0
  23. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/render.py +0 -0
  24. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/repair.py +0 -0
  25. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/run.py +0 -0
  26. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/secrets.py +0 -0
  27. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/serialize.py +0 -0
  28. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/spec.py +0 -0
  29. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/task.py +0 -0
  30. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/task_values.py +0 -0
  31. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/testing/__init__.py +0 -0
  32. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/testing/fake.py +0 -0
  33. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/testing/jobsim.py +0 -0
  34. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/unity.py +0 -0
  35. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/src/pipeloom_databricks/upload.py +0 -0
  36. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/conftest.py +0 -0
  37. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/by_folder.json +0 -0
  38. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/by_folder.yml +0 -0
  39. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/by_tag.json +0 -0
  40. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/by_tag.yml +0 -0
  41. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/job_cluster.json +0 -0
  42. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/job_cluster.yml +0 -0
  43. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/serverless.json +0 -0
  44. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/serverless.yml +0 -0
  45. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/goldens/submit.json +0 -0
  46. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_bundle.py +0 -0
  47. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_deploy.py +0 -0
  48. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_deploy_cli.py +0 -0
  49. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_finalize_states.py +0 -0
  50. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_grouping.py +0 -0
  51. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_jobsim.py +0 -0
  52. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_keys.py +0 -0
  53. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_options.py +0 -0
  54. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_render.py +0 -0
  55. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_repair.py +0 -0
  56. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_run.py +0 -0
  57. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_run_cli.py +0 -0
  58. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_sdk_client.py +0 -0
  59. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_secrets.py +0 -0
  60. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_spec_import.py +0 -0
  61. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_task.py +0 -0
  62. {pipeloom_databricks-0.5.0 → pipeloom_databricks-0.6.0}/tests/test_unity.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pipeloom-databricks
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Databricks renderer for pipeloom: a compiled plan as Jobs settings JSON and bundle YAML.
5
5
  Project-URL: Repository, https://github.com/emanuel-luis/pipeloom
6
6
  Project-URL: Documentation, https://emanuel-luis.github.io/pipeloom/
@@ -21,8 +21,8 @@ Classifier: Programming Language :: Python :: 3.14
21
21
  Classifier: Typing :: Typed
22
22
  Requires-Python: >=3.11
23
23
  Requires-Dist: databricks-sdk<1,>=0.50
24
- Requires-Dist: pipeloom-spark~=0.5.0
25
- Requires-Dist: pipeloom~=0.5.0
24
+ Requires-Dist: pipeloom-spark~=0.6.0
25
+ Requires-Dist: pipeloom~=0.6.0
26
26
  Description-Content-Type: text/markdown
27
27
 
28
28
  # pipeloom-databricks
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pipeloom-databricks"
7
- version = "0.5.0"
7
+ version = "0.6.0"
8
8
  description = "Databricks renderer for pipeloom: a compiled plan as Jobs settings JSON and bundle YAML."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -23,7 +23,7 @@ classifiers = [
23
23
  "Programming Language :: Python :: 3.14",
24
24
  "Typing :: Typed",
25
25
  ]
26
- dependencies = ["pipeloom~=0.5.0", "pipeloom-spark~=0.5.0", "databricks-sdk>=0.50,<1"]
26
+ dependencies = ["pipeloom~=0.6.0", "pipeloom-spark~=0.6.0", "databricks-sdk>=0.50,<1"]
27
27
 
28
28
  [project.urls]
29
29
  Repository = "https://github.com/emanuel-luis/pipeloom"
@@ -0,0 +1,77 @@
1
+ """The stable surface other pipeloom distributions (such as an Airflow renderer) may call.
2
+
3
+ Importing it loads no SDK: `connect` and `connect_explicit` import `databricks.sdk` only when they
4
+ run.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Literal
10
+
11
+ from pipeloom_databricks.bundle import Runtime
12
+ from pipeloom_databricks.client import (
13
+ ApiError,
14
+ ConnectionNotConfigured,
15
+ DatabricksClient,
16
+ JobSummary,
17
+ RunInfo,
18
+ TaskRunInfo,
19
+ connect,
20
+ )
21
+ from pipeloom_databricks.deploy import DeployResult, DuplicateJobs, api_errors, deploy, find_job
22
+ from pipeloom_databricks.finalize_states import task_states
23
+ from pipeloom_databricks.grouping import task_key_map
24
+ from pipeloom_databricks.keys import FINALIZE_KEY
25
+ from pipeloom_databricks.render import deploy_options, job_name, render_job
26
+ from pipeloom_databricks.repair import repair, rerun_set
27
+ from pipeloom_databricks.run import TERMINAL, RunStarted, SelectionError, find_run, run_job
28
+
29
+ __all__ = [
30
+ "FINALIZE_KEY",
31
+ "TERMINAL",
32
+ "ApiError",
33
+ "ConnectionNotConfigured",
34
+ "DatabricksClient",
35
+ "DeployResult",
36
+ "DuplicateJobs",
37
+ "JobSummary",
38
+ "RunInfo",
39
+ "RunStarted",
40
+ "Runtime",
41
+ "SelectionError",
42
+ "TaskRunInfo",
43
+ "api_errors",
44
+ "connect",
45
+ "connect_explicit",
46
+ "deploy",
47
+ "deploy_options",
48
+ "find_job",
49
+ "find_run",
50
+ "job_name",
51
+ "render_job",
52
+ "repair",
53
+ "rerun_set",
54
+ "run_job",
55
+ "task_key_map",
56
+ "task_states",
57
+ ]
58
+
59
+
60
+ def connect_explicit(
61
+ *,
62
+ host: str,
63
+ auth_type: Literal["pat", "oauth-m2m"],
64
+ token: str | None = None,
65
+ client_id: str | None = None,
66
+ client_secret: str | None = None,
67
+ ) -> DatabricksClient:
68
+ """A client from explicit credentials only; see `client.connect.connect_explicit`."""
69
+ from pipeloom_databricks.client.connect import connect_explicit as _connect
70
+
71
+ return _connect(
72
+ host=host,
73
+ auth_type=auth_type,
74
+ token=token,
75
+ client_id=client_id,
76
+ client_secret=client_secret,
77
+ )
@@ -13,7 +13,7 @@ import importlib
13
13
  import tempfile
14
14
  from collections.abc import Mapping
15
15
  from pathlib import Path
16
- from typing import Any, Final
16
+ from typing import Any, Final, Literal
17
17
 
18
18
  from pipeloom.secrets.redaction import Redactor
19
19
  from pipeloom_databricks.client import ConnectionNotConfigured, DatabricksClient
@@ -61,11 +61,36 @@ def connect(
61
61
  "DATABRICKS_HOST with credentials, or run on a Databricks runtime"
62
62
  )
63
63
 
64
+ return _build(kwargs, with_file=bool(profile))
65
+
66
+
67
+ def connect_explicit(
68
+ *,
69
+ host: str,
70
+ auth_type: Literal["pat", "oauth-m2m"],
71
+ token: str | None = None,
72
+ client_id: str | None = None,
73
+ client_secret: str | None = None,
74
+ ) -> DatabricksClient:
75
+ """A client from explicit credentials only (an orchestrator's connection, ADR-0039).
76
+
77
+ The SDK gets the auth type and a `config_file` that does not exist, so neither
78
+ `~/.databrickscfg` nor a `DATABRICKS_*` variable of the process can change the auth.
79
+ """
80
+ kwargs: dict[str, Any] = {"host": host, "auth_type": auth_type}
81
+ if auth_type == "pat":
82
+ kwargs["token"] = token
83
+ else:
84
+ kwargs.update(client_id=client_id, client_secret=client_secret)
85
+ return _build(kwargs, with_file=False)
86
+
87
+
88
+ def _build(kwargs: dict[str, Any], *, with_file: bool) -> DatabricksClient:
64
89
  from databricks.sdk import WorkspaceClient
65
90
  from databricks.sdk.core import Config
66
91
 
67
92
  try:
68
- if profile:
93
+ if with_file:
69
94
  config = Config(**kwargs)
70
95
  else:
71
96
  with tempfile.TemporaryDirectory(prefix="pipeloom-") as folder:
@@ -154,3 +154,28 @@ def test_factory_skips_every_rule(sdk: Recorder) -> None:
154
154
  def test_a_bad_factory_is_pld010(spec: str) -> None:
155
155
  with pytest.raises(ConnectionNotConfigured):
156
156
  connect(profile=None, env={}, factory=spec)
157
+
158
+
159
+ def test_explicit_credentials_ignore_profiles_and_variables(
160
+ sdk: Recorder, monkeypatch: pytest.MonkeyPatch
161
+ ) -> None:
162
+ from pipeloom_databricks.api import connect_explicit
163
+
164
+ monkeypatch.setenv("DATABRICKS_CONFIG_PROFILE", "someone-elses")
165
+ monkeypatch.setenv("DATABRICKS_TOKEN", "env-token")
166
+ client = connect_explicit(host="https://h.example", auth_type="pat", token="t")
167
+ connect_explicit(
168
+ host="https://h.example", auth_type="oauth-m2m", client_id="id", client_secret="s"
169
+ )
170
+ first, second = sdk.configs
171
+ for kwargs in (first, second):
172
+ cfg = Path(kwargs.pop("config_file"))
173
+ assert not cfg.exists() and not cfg.parent.exists()
174
+ assert first == {"host": "https://h.example", "auth_type": "pat", "token": "t"}
175
+ assert second == {
176
+ "host": "https://h.example",
177
+ "auth_type": "oauth-m2m",
178
+ "client_id": "id",
179
+ "client_secret": "s",
180
+ }
181
+ assert isinstance(client, SdkClient)
@@ -1,45 +0,0 @@
1
- """The stable surface other pipeloom distributions (such as an Airflow renderer) may call.
2
-
3
- Importing it loads no SDK: `connect` imports `databricks.sdk` only when it runs.
4
- """
5
-
6
- from __future__ import annotations
7
-
8
- from pipeloom_databricks.client import (
9
- ApiError,
10
- ConnectionNotConfigured,
11
- DatabricksClient,
12
- JobSummary,
13
- RunInfo,
14
- TaskRunInfo,
15
- connect,
16
- )
17
- from pipeloom_databricks.deploy import DeployResult, DuplicateJobs, deploy, find_job
18
- from pipeloom_databricks.finalize_states import task_states
19
- from pipeloom_databricks.grouping import task_key_map
20
- from pipeloom_databricks.render import deploy_options, render_job
21
- from pipeloom_databricks.repair import repair
22
- from pipeloom_databricks.run import RunStarted, SelectionError, find_run, run_job
23
-
24
- __all__ = [
25
- "ApiError",
26
- "ConnectionNotConfigured",
27
- "DatabricksClient",
28
- "DeployResult",
29
- "DuplicateJobs",
30
- "JobSummary",
31
- "RunInfo",
32
- "RunStarted",
33
- "SelectionError",
34
- "TaskRunInfo",
35
- "connect",
36
- "deploy",
37
- "deploy_options",
38
- "find_job",
39
- "find_run",
40
- "render_job",
41
- "repair",
42
- "run_job",
43
- "task_key_map",
44
- "task_states",
45
- ]