semblance-databricks 0.1.0__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.
- semblance_databricks/__init__.py +19 -0
- semblance_databricks/app.py +104 -0
- semblance_databricks/auth.py +145 -0
- semblance_databricks/cli.py +112 -0
- semblance_databricks/compatibility.py +30 -0
- semblance_databricks/compatibility.yaml +269 -0
- semblance_databricks/config.py +52 -0
- semblance_databricks/errors.py +72 -0
- semblance_databricks/fixtures/__init__.py +5 -0
- semblance_databricks/fixtures/defaults/__init__.py +0 -0
- semblance_databricks/fixtures/defaults/acme.yaml +47 -0
- semblance_databricks/fixtures/loaders.py +196 -0
- semblance_databricks/http.py +34 -0
- semblance_databricks/ids.py +88 -0
- semblance_databricks/models/__init__.py +1 -0
- semblance_databricks/pagination.py +48 -0
- semblance_databricks/py.typed +0 -0
- semblance_databricks/registry.py +29 -0
- semblance_databricks/services/__init__.py +1 -0
- semblance_databricks/services/clusters/__init__.py +3 -0
- semblance_databricks/services/clusters/routes.py +191 -0
- semblance_databricks/services/dbfs/__init__.py +3 -0
- semblance_databricks/services/dbfs/routes.py +126 -0
- semblance_databricks/services/dbsql/__init__.py +3 -0
- semblance_databricks/services/dbsql/routes.py +163 -0
- semblance_databricks/services/deps.py +37 -0
- semblance_databricks/services/jobs/__init__.py +3 -0
- semblance_databricks/services/jobs/routes.py +168 -0
- semblance_databricks/services/permissions/__init__.py +5 -0
- semblance_databricks/services/permissions/routes.py +50 -0
- semblance_databricks/services/secrets/__init__.py +3 -0
- semblance_databricks/services/secrets/routes.py +53 -0
- semblance_databricks/services/workspace/__init__.py +3 -0
- semblance_databricks/services/workspace/routes.py +39 -0
- semblance_databricks/state.py +253 -0
- semblance_databricks/testing.py +66 -0
- semblance_databricks-0.1.0.dist-info/METADATA +126 -0
- semblance_databricks-0.1.0.dist-info/RECORD +42 -0
- semblance_databricks-0.1.0.dist-info/WHEEL +5 -0
- semblance_databricks-0.1.0.dist-info/entry_points.txt +2 -0
- semblance_databricks-0.1.0.dist-info/licenses/LICENSE.md +21 -0
- semblance_databricks-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: semblance-databricks
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unofficial local HTTP simulation of selected Databricks workspace REST operations
|
|
5
|
+
Author: Semblance Contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://semblance.readthedocs.io/en/latest/guides/databricks/
|
|
8
|
+
Project-URL: Repository, https://github.com/eddiethedean/semblance
|
|
9
|
+
Project-URL: Changelog, https://github.com/eddiethedean/semblance/blob/main/packages/semblance-databricks/CHANGELOG.md
|
|
10
|
+
Keywords: databricks,mock,simulation,testing,fastapi
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE.md
|
|
21
|
+
Requires-Dist: semblance<0.8,>=0.7.0
|
|
22
|
+
Requires-Dist: pydantic>=2.0.0
|
|
23
|
+
Requires-Dist: pyyaml>=6.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: httpx>=0.25.0; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff>=0.16.0; extra == "dev"
|
|
28
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
|
|
30
|
+
Provides-Extra: sdk
|
|
31
|
+
Requires-Dist: databricks-sdk==0.57.0; extra == "sdk"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# semblance-databricks
|
|
35
|
+
|
|
36
|
+
**Unofficial** local HTTP simulation of selected [Databricks workspace REST](https://docs.databricks.com/api/workspace/) operations (clusters, jobs, warehouses, secrets metadata, DBFS stubs, permissions, SQL statements).
|
|
37
|
+
|
|
38
|
+
This package is **not affiliated with, endorsed by, or equivalent to Databricks**. It does not run Spark, jobs, or SQL engines. It is a test double for client development and CI.
|
|
39
|
+
|
|
40
|
+
Verified against public workspace REST documentation dated **2026-08-19**. See `compatibility.yaml` (also served at `/.well-known/semblance-databricks-compat.json`).
|
|
41
|
+
|
|
42
|
+
Requires `semblance` 0.7.x.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install semblance-databricks
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
From a clone of this repository:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install -e ".[dev]"
|
|
54
|
+
pip install -e "packages/semblance-databricks[dev]"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Optional official SDK extra (not installed in default CI):
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install "semblance-databricks[sdk]"
|
|
61
|
+
pytest packages/semblance-databricks/tests -m sdk
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Pinned SDK: `databricks-sdk==0.57.0`. Untested SDK versions are not implied compatible.
|
|
65
|
+
|
|
66
|
+
## Quick start (HTTP)
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from semblance_databricks import DatabricksMock, DatabricksMockConfig
|
|
70
|
+
from semblance_databricks.testing import databricks_test_client
|
|
71
|
+
|
|
72
|
+
dbx = DatabricksMock(DatabricksMockConfig(seed=42, auth="optional"))
|
|
73
|
+
dbx.load_bundled_fixture()
|
|
74
|
+
client = databricks_test_client(dbx)
|
|
75
|
+
|
|
76
|
+
r = client.get("/api/2.1/clusters/list?page_size=2")
|
|
77
|
+
assert r.status_code == 200
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
CLI:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
semblance-databricks fixture init --output databricks.yaml
|
|
84
|
+
semblance-databricks validate databricks.yaml
|
|
85
|
+
semblance-databricks operations
|
|
86
|
+
semblance-databricks serve --fixture databricks.yaml --port 8766
|
|
87
|
+
# or: semblance-databricks serve # bundled acme fixture
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Environment variables for local clients (not Databricks credentials): `SEMBLANCE_DATABRICKS_HOST`, `SEMBLANCE_DATABRICKS_TOKEN`.
|
|
91
|
+
|
|
92
|
+
## Auth modes
|
|
93
|
+
|
|
94
|
+
- `disabled` — ignore `Authorization`
|
|
95
|
+
- `optional` (default) — missing token is OK; malformed `Bearer` values return 401
|
|
96
|
+
- `strict` — token must be in `DatabricksMockConfig.tokens`
|
|
97
|
+
|
|
98
|
+
Authentication errors never echo the token. This is not an OAuth server.
|
|
99
|
+
|
|
100
|
+
## Fixtures
|
|
101
|
+
|
|
102
|
+
YAML/JSON version 1. Extra fields are rejected. Fixtures are **data only**. Secret **values** are never returned on REST (list and put only; there is no get-key).
|
|
103
|
+
|
|
104
|
+
`load_bundled_fixture()` loads the shipped `acme` workspace. Use `load_fixture(path)` for your own files. Advance cluster/run state with `dbx.tick()`.
|
|
105
|
+
|
|
106
|
+
## Pagination
|
|
107
|
+
|
|
108
|
+
List endpoints use `page_size` or `limit` plus `page_token` / `next_page_token`. Tokens are opaque and checksummed. Tampering returns 400 `INVALID_PARAMETER_VALUE`.
|
|
109
|
+
|
|
110
|
+
## Known unsupported (0.1.0)
|
|
111
|
+
|
|
112
|
+
- Unity Catalog, Model Serving, DLT / Spark Declarative Pipelines
|
|
113
|
+
- Jobs API 2.0 as primary (optional 2.1 aliases are representative)
|
|
114
|
+
- Real Spark/SQL execution (statements use fixture or allow-listed callbacks)
|
|
115
|
+
|
|
116
|
+
Unknown paths return Databricks-style 404. Known stubs such as `clusters/permanent-delete` and `dbfs/add-block` return 501 only when `auth=strict`.
|
|
117
|
+
|
|
118
|
+
## Security
|
|
119
|
+
|
|
120
|
+
- Do not put production secrets in fixtures or tokens used with this mock
|
|
121
|
+
- Tokens are compared in-process and never written to error bodies
|
|
122
|
+
- Query/SQL/run-output behavior must be allow-listed Python, never YAML eval
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT. Databricks is a trademark of its respective owners.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
semblance_databricks/__init__.py,sha256=YRrm2_pCljJfLlwazJTSdQKqv3tFnvqYoS24z4AkQHM,604
|
|
2
|
+
semblance_databricks/app.py,sha256=PsGD-zpoJxRxOOOV8wTqHP_DDae2A53w70EtvxuPN-w,4004
|
|
3
|
+
semblance_databricks/auth.py,sha256=X__Xcb4HycYnkJI_nSHGhla7g_t2cjL4BSRWOUjkJFQ,4984
|
|
4
|
+
semblance_databricks/cli.py,sha256=u1OGkE7ebAjdP6QrFzmyREW0NMDQFI6g8fIgoOae0r8,3746
|
|
5
|
+
semblance_databricks/compatibility.py,sha256=60WcHZA7lRmwTGwyVPUpq5HPKncOamfKTeZjHQuSvy0,789
|
|
6
|
+
semblance_databricks/compatibility.yaml,sha256=cSbC-TyTgnOWpCE-1uFA5937Fvrh9RHOvYhacw-ABYI,9624
|
|
7
|
+
semblance_databricks/config.py,sha256=JoNaBS5Z_zXQpqXvOJazPjEMf26lRwEM5XO9kBuMeLc,1644
|
|
8
|
+
semblance_databricks/errors.py,sha256=n2ar51SahIAeps8Fb_ndjuHmdVnLZB-OGf8t4M6ZGB0,2405
|
|
9
|
+
semblance_databricks/http.py,sha256=buPaC68pSXfSfQFXzavuB7q-3tKB4MehLz3XgRE_P1g,956
|
|
10
|
+
semblance_databricks/ids.py,sha256=k2uY1X0EY3w9noDg9DJWBI-h8buV1F0N_fP6UEZS36M,2869
|
|
11
|
+
semblance_databricks/pagination.py,sha256=Gb61Jo-DmLgnBPZSTJAp3e5RP7VsSOOKORfLtfbK8dM,1338
|
|
12
|
+
semblance_databricks/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
semblance_databricks/registry.py,sha256=bGGjKn4HZbWjGcOGHKoRxxoNDXytWScZx5ojfGCm6hs,783
|
|
14
|
+
semblance_databricks/state.py,sha256=uqKWP8kYP7UdWpDQfNoTQm6nuRsNgyKNq1OQPuPn7tg,8296
|
|
15
|
+
semblance_databricks/testing.py,sha256=SR5OteJ065UBRfYCYU6O-EA24FkUiFYMnEV_2MzOWBE,2100
|
|
16
|
+
semblance_databricks/fixtures/__init__.py,sha256=2Lrgm7cKpkqVil-prJqBwursSD1P-3kvdDTz6fYNRHI,165
|
|
17
|
+
semblance_databricks/fixtures/loaders.py,sha256=Lp-rVRFovgcUiUt2slTdsj5iSp9s73Kct27Ku-rqILc,6105
|
|
18
|
+
semblance_databricks/fixtures/defaults/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
semblance_databricks/fixtures/defaults/acme.yaml,sha256=Pwy4hpGICRgRQpMgWGTKZxBHJGNuoD1I7vnh4pvUXeo,1003
|
|
20
|
+
semblance_databricks/models/__init__.py,sha256=-G3mJBUgjAoaDXKsmHU_o7zBHPt3XREprbDNMnt2RNQ,21
|
|
21
|
+
semblance_databricks/services/__init__.py,sha256=g5bgRNKr_gg_6fLxuy-ociPo630HOXL7U1vbUM-Ya3g,34
|
|
22
|
+
semblance_databricks/services/deps.py,sha256=PQn6CO8y6UO4qYQS3WxiT0fXRGpZtg7ltvS5xljohqk,1148
|
|
23
|
+
semblance_databricks/services/clusters/__init__.py,sha256=ZjpuN9wF24uILNYNt2ZsCSJVDEgBs6R1A6htaPJ0Co8,119
|
|
24
|
+
semblance_databricks/services/clusters/routes.py,sha256=6ql8EUv8Ll3yGa5J1thGI9hILTvHQJxD16XzFhvBdns,7414
|
|
25
|
+
semblance_databricks/services/dbfs/__init__.py,sha256=Afhji_fzuUkd1YXV4zb6OShVs1x2D8-r_zGw23gYm98,107
|
|
26
|
+
semblance_databricks/services/dbfs/routes.py,sha256=XopRHH4tXwUVeFrJbwAWqJX5KWkLffws5iNG9D2kKqc,4546
|
|
27
|
+
semblance_databricks/services/dbsql/__init__.py,sha256=kXwHdaRLCSvzzSmSXJcBHNdT3b8MoqKYtlu4MCGM264,110
|
|
28
|
+
semblance_databricks/services/dbsql/routes.py,sha256=7smQQaJj419qv8sw57Y1mhlBegvZWbZU4FmQYGBCSyk,5964
|
|
29
|
+
semblance_databricks/services/jobs/__init__.py,sha256=jX8CZKyoMSp9IXDdAd-NmeG__NTRrjI1ZFYwoS-IJf0,107
|
|
30
|
+
semblance_databricks/services/jobs/routes.py,sha256=pZjgY4k4fhSgrUnCvc42_xszoSUTijywJLMNdChZUDI,6910
|
|
31
|
+
semblance_databricks/services/permissions/__init__.py,sha256=8Ud8t7Js8abRotNDPGYFwXYdDYWDYvqBgsIiK-r7VSU,137
|
|
32
|
+
semblance_databricks/services/permissions/routes.py,sha256=waM1B6da8C8JvXC2HsO0iKLX6_78-gSsavJ4rBriWF4,1579
|
|
33
|
+
semblance_databricks/services/secrets/__init__.py,sha256=mCf-YRlphVw9jOB23p30-0s11IaMmIyDPyN0iP9xcX4,116
|
|
34
|
+
semblance_databricks/services/secrets/routes.py,sha256=28CYn-LevWk6Xy5GRcMHTGoSB8LD9iVud_hdzXFxu2E,1892
|
|
35
|
+
semblance_databricks/services/workspace/__init__.py,sha256=427FBIzmE29Jp1C8q5icALDkDRQ1WZQdUV4FKQNZpWs,122
|
|
36
|
+
semblance_databricks/services/workspace/routes.py,sha256=1ffVHMpEgRNU1UCMGhxDMdvYzk_qF4Yb0hg7bHyCTFc,1161
|
|
37
|
+
semblance_databricks-0.1.0.dist-info/licenses/LICENSE.md,sha256=FAk7E17XygPXI2ryakEqlgZkpLlwY25EMlV7VEIFJ_k,1079
|
|
38
|
+
semblance_databricks-0.1.0.dist-info/METADATA,sha256=9vp2zCT7H9Lwa3bBM7sxM4wat2C-0t6Rhas5F6xcayk,4742
|
|
39
|
+
semblance_databricks-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
40
|
+
semblance_databricks-0.1.0.dist-info/entry_points.txt,sha256=bDxtD3uxlrYhauGjOh_-EsAX4-Wd4FkFK6bqrT4zTbw,71
|
|
41
|
+
semblance_databricks-0.1.0.dist-info/top_level.txt,sha256=gXTlFe5MHYCa7KqmYHk9kIeUWj1NNnu-ThQzma2z8AY,21
|
|
42
|
+
semblance_databricks-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Semblance Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
semblance_databricks
|