lkr-dev-cli 0.0.39__tar.gz → 0.0.40__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.
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/PKG-INFO +1 -1
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/extended_sdk_methods/classes.py +12 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/extended_sdk_methods/main.py +35 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/pyproject.toml +1 -1
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/tests/test_codemode.py +23 -1
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/tests/test_extended_sdk_methods.py +55 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/.github/workflows/ci.yml +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/.github/workflows/release.yml +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/.gitignore +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/.python-version +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/.vscode/launch.json +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/.vscode/settings.json +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/Dockerfile +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/LICENSE +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/Makefile +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/README.md +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/cloudbuild.yaml +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/codemode.md +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/__init__.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/auth/__init__.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/auth/main.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/auth/oauth.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/auth_service.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/classes.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/LOCAL.md +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/__init__.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/constant.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/download_swagger.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/examples.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/help.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/main.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/readme.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/swagger.json +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/codemode/type.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/constants.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/custom_types.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/exceptions.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/extended_sdk_methods/__init__.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/logger.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/main.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/mcp/classes.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/mcp/main.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/mcp/utils.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/observability/classes.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/observability/embed_container.html +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/observability/main.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/observability/utils.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/tools/classes.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/tools/main.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr/tools/permission_deprecation.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/lkr.md +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/tests/TESTING.md +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/tests/test_dependency_resolution.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/tests/test_deps.sh +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/tests/test_oauth_account.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/tests/test_permission_deprecation.py +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/ty.toml +0 -0
- {lkr_dev_cli-0.0.39 → lkr_dev_cli-0.0.40}/uv.lock +0 -0
|
@@ -13,6 +13,7 @@ __all__ = [
|
|
|
13
13
|
"GenerateLookMLParameters",
|
|
14
14
|
"SelectedTable",
|
|
15
15
|
"GenerateLookMLWithNewFilesResponse",
|
|
16
|
+
"ProjectCommitRequest",
|
|
16
17
|
]
|
|
17
18
|
|
|
18
19
|
|
|
@@ -84,3 +85,14 @@ class GenerateLookMLWithNewFilesResponse(BaseModel):
|
|
|
84
85
|
|
|
85
86
|
generate_lookml: str = Field(..., description="The API response from generating LookML, typically an empty string on success.")
|
|
86
87
|
new_files: list[Any] = Field(..., description="List of newly created files.")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class ProjectCommitRequest(BaseModel):
|
|
91
|
+
"""Request body for LookML project commit."""
|
|
92
|
+
|
|
93
|
+
files: Optional[list[str]] = Field(
|
|
94
|
+
None,
|
|
95
|
+
description="List of files to commit. If omitted or passed as None, Looker automatically stages and commits all modified, newly added, and deleted LookML files in the project's current development workspace.",
|
|
96
|
+
)
|
|
97
|
+
message: Optional[str] = Field(None, description="Commit message")
|
|
98
|
+
amend: Optional[bool] = Field(None, description="Amend the last commit")
|
|
@@ -13,6 +13,7 @@ from lkr.extended_sdk_methods.classes import (
|
|
|
13
13
|
ProjectGeneratorColumn,
|
|
14
14
|
ProjectGeneratorTable,
|
|
15
15
|
SelectedTable,
|
|
16
|
+
ProjectCommitRequest,
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
__all__ = [
|
|
@@ -26,6 +27,7 @@ __all__ = [
|
|
|
26
27
|
"GenerateLookMLParameters",
|
|
27
28
|
"SelectedTable",
|
|
28
29
|
"GenerateLookMLWithNewFilesResponse",
|
|
30
|
+
"ProjectCommitRequest",
|
|
29
31
|
]
|
|
30
32
|
|
|
31
33
|
|
|
@@ -310,3 +312,36 @@ class ExtendedLooker40SDK(Looker40SDK):
|
|
|
310
312
|
return GenerateLookMLWithNewFilesResponse(
|
|
311
313
|
generate_lookml=response, new_files=new_files
|
|
312
314
|
)
|
|
315
|
+
|
|
316
|
+
def commit(
|
|
317
|
+
self,
|
|
318
|
+
project_id: str,
|
|
319
|
+
body: Optional[Union[ProjectCommitRequest, dict, Any]] = None,
|
|
320
|
+
transport_options: Optional[transport.TransportOptions] = None,
|
|
321
|
+
) -> str:
|
|
322
|
+
"""Commit changes to the project's git repository.
|
|
323
|
+
|
|
324
|
+
If you do not specify an array of files in the body (or pass None),
|
|
325
|
+
Looker automatically stages and commits all modified, newly added,
|
|
326
|
+
and deleted LookML files in the project's current development workspace.
|
|
327
|
+
|
|
328
|
+
Args:
|
|
329
|
+
project_id: Id of project.
|
|
330
|
+
body: Optional commit parameters.
|
|
331
|
+
transport_options: Optional transport options.
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
str: API response.
|
|
335
|
+
"""
|
|
336
|
+
project_id = self.encode_path_param(project_id)
|
|
337
|
+
path = f"/projects/{project_id}/commit"
|
|
338
|
+
request_body = self._prepare_body(body)
|
|
339
|
+
return cast(
|
|
340
|
+
str,
|
|
341
|
+
self.post(
|
|
342
|
+
path=path,
|
|
343
|
+
structure=str,
|
|
344
|
+
body=request_body,
|
|
345
|
+
transport_options=transport_options,
|
|
346
|
+
),
|
|
347
|
+
)
|
|
@@ -198,7 +198,7 @@ return "\\n".join(res)
|
|
|
198
198
|
|
|
199
199
|
def test_extended_sdk_methods_present():
|
|
200
200
|
code = """
|
|
201
|
-
methods = ['all_project_files', 'get_file_content', 'create_file', 'update_file', 'delete_file', 'create_project_directory', 'delete_project_directory', 'generate_lookml', 'generate_lookml_with_new_files']
|
|
201
|
+
methods = ['all_project_files', 'get_file_content', 'create_file', 'update_file', 'delete_file', 'create_project_directory', 'delete_project_directory', 'generate_lookml', 'generate_lookml_with_new_files', 'commit']
|
|
202
202
|
for m in methods:
|
|
203
203
|
if m not in dir():
|
|
204
204
|
return "Missing " + m
|
|
@@ -225,4 +225,26 @@ return lookup('ProjectGeneratorTable')
|
|
|
225
225
|
assert "primary_key: string" in result_lookup
|
|
226
226
|
|
|
227
227
|
|
|
228
|
+
def test_commit_help_and_lookup():
|
|
229
|
+
code_help = """
|
|
230
|
+
return help('commit')
|
|
231
|
+
"""
|
|
232
|
+
result = run_python_code(code_help)
|
|
233
|
+
assert "Function: commit" in result or "Type: ProjectCommitRequest" in result
|
|
234
|
+
|
|
235
|
+
code_lookup = """
|
|
236
|
+
return lookup('commit')
|
|
237
|
+
"""
|
|
238
|
+
result_lookup = run_python_code(code_lookup)
|
|
239
|
+
assert "Function: commit" in result_lookup
|
|
240
|
+
assert "Looker automatically stages and commits all modified" in result_lookup
|
|
241
|
+
|
|
242
|
+
code_lookup_model = """
|
|
243
|
+
return lookup('ProjectCommitRequest')
|
|
244
|
+
"""
|
|
245
|
+
result_model = run_python_code(code_lookup_model)
|
|
246
|
+
assert "Type: ProjectCommitRequest" in result_model
|
|
247
|
+
assert "Looker automatically stages and commits" in result_model
|
|
248
|
+
|
|
249
|
+
|
|
228
250
|
|
|
@@ -8,6 +8,7 @@ from lkr.extended_sdk_methods.main import (
|
|
|
8
8
|
ProjectGeneratorColumn,
|
|
9
9
|
ProjectGeneratorTable,
|
|
10
10
|
SelectedTable,
|
|
11
|
+
ProjectCommitRequest,
|
|
11
12
|
)
|
|
12
13
|
|
|
13
14
|
|
|
@@ -186,3 +187,57 @@ def test_generate_lookml_with_new_files():
|
|
|
186
187
|
assert isinstance(result, GenerateLookMLWithNewFilesResponse)
|
|
187
188
|
assert result.generate_lookml == "generated"
|
|
188
189
|
assert result.new_files == [FakeFile("c")]
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def test_project_commit_request_model():
|
|
193
|
+
req = ProjectCommitRequest(files=["a.lkml"], message="fix bug", amend=False)
|
|
194
|
+
assert req.files == ["a.lkml"]
|
|
195
|
+
assert req.message == "fix bug"
|
|
196
|
+
assert req.amend is False
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def test_commit():
|
|
200
|
+
mock_auth = MagicMock()
|
|
201
|
+
mock_auth.settings.base_url = "https://example.looker.com"
|
|
202
|
+
sdk = ExtendedLooker40SDK(
|
|
203
|
+
auth=mock_auth,
|
|
204
|
+
deserialize=MagicMock(),
|
|
205
|
+
serialize=MagicMock(),
|
|
206
|
+
transport=MagicMock(),
|
|
207
|
+
api_version="4.0",
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
with patch.object(sdk, "post") as mock_post:
|
|
211
|
+
mock_post.return_value = "commit hash or project"
|
|
212
|
+
|
|
213
|
+
req = ProjectCommitRequest(files=["model.lkml"], message="initial commit")
|
|
214
|
+
res = sdk.commit(project_id="test_proj", body=req)
|
|
215
|
+
|
|
216
|
+
assert res == "commit hash or project"
|
|
217
|
+
mock_post.assert_called_once()
|
|
218
|
+
_, kwargs = mock_post.call_args
|
|
219
|
+
assert kwargs["path"] == "/projects/test_proj/commit"
|
|
220
|
+
assert kwargs["body"] == req.model_dump()
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def test_commit_no_body():
|
|
224
|
+
mock_auth = MagicMock()
|
|
225
|
+
mock_auth.settings.base_url = "https://example.looker.com"
|
|
226
|
+
sdk = ExtendedLooker40SDK(
|
|
227
|
+
auth=mock_auth,
|
|
228
|
+
deserialize=MagicMock(),
|
|
229
|
+
serialize=MagicMock(),
|
|
230
|
+
transport=MagicMock(),
|
|
231
|
+
api_version="4.0",
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
with patch.object(sdk, "post") as mock_post:
|
|
235
|
+
mock_post.return_value = "commit success"
|
|
236
|
+
|
|
237
|
+
res = sdk.commit(project_id="test_proj")
|
|
238
|
+
|
|
239
|
+
assert res == "commit success"
|
|
240
|
+
mock_post.assert_called_once()
|
|
241
|
+
_, kwargs = mock_post.call_args
|
|
242
|
+
assert kwargs["path"] == "/projects/test_proj/commit"
|
|
243
|
+
assert kwargs["body"] is None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|