gitlab-api 27.3.20__tar.gz → 27.3.22__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.
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/PKG-INFO +2 -2
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_projects.py +5 -1
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_users_groups.py +5 -1
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/gitlab_gql.py +38 -2
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/gitlab_response_models.py +158 -92
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/certification.json +1 -1
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api.egg-info/PKG-INFO +2 -2
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api.egg-info/SOURCES.txt +2 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api.egg-info/requires.txt +1 -1
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/pyproject.toml +2 -2
- gitlab_api-27.3.22/tests/test_graphql_error_category.py +79 -0
- gitlab_api-27.3.22/tests/test_response_models_hide_secrets.py +103 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/LICENSE +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/README.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/__init__.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/__main__.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/__init__.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_base.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_environments.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_issues.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_merge_requests.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_other.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_pipelines.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_repositories.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_system.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api/api_client_vulnerabilities.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/api_client.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/auth.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/connector_contracts.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/connector_prep.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/connector_sources.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/gitlab_input_models.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/instances.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/kg_ingest.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/mcp_config.json +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/mcp_server.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/__init__.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/access_contracts.ttl +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/fixtures/records.json +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/gitlab.ttl +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/mappings/source.yaml +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/migrations/manifest.json +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/ontology/shapes/connector.shacl.ttl +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-operator.json +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-project-administrator.json +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-release-manager.json +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/prompts/gitlab-mcp-triage-lead.json +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-api-development/SKILL.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-api-operations/SKILL.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-issues/SKILL.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-merge-request-create/SKILL.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-merge-request-review/SKILL.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-pipelines/SKILL.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api/skills/gitlab-vulnerabilities/SKILL.md +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api.egg-info/dependency_links.txt +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api.egg-info/entry_points.txt +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/gitlab_api.egg-info/top_level.txt +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/scripts/check_import_safety.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/scripts/security_contract.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/setup.cfg +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/__init__.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/conftest.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_access_contracts.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_api_wrapper.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_auth.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_catalog_edges.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_connector_prep.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_cq_paths.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_fleet_name.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_gitlab_a2a_validation.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_gitlab_api_brute_force_coverage.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_gitlab_api_development_skill.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_gitlab_gql.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_gitlab_mcp_validation.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_gitlab_models.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_identity_context_scoping.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_ingest_sources.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_init_dynamics.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_instances.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_kg_ingest.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_mock_coverage.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_ontology_parent_link.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_paged_models_have_paging_fields.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_pages_workflow.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_startup.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_tool_modes.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/test_verify_agent.py +0 -0
- {gitlab_api-27.3.20 → gitlab_api-27.3.22}/tests/verify_a2a_queries.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitlab-api
|
|
3
|
-
Version: 27.3.
|
|
3
|
+
Version: 27.3.22
|
|
4
4
|
Summary: GitLab API + MCP Server
|
|
5
5
|
Author-email: Repository Maintainers <maintainers@knuckles.team>
|
|
6
6
|
License: MIT
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: scion-sdk[graphql,mcp]>=0.
|
|
15
|
+
Requires-Dist: scion-sdk[graphql,mcp]>=0.10.1
|
|
16
16
|
Requires-Dist: python-dotenv>=1.2.4
|
|
17
17
|
Provides-Extra: mcp
|
|
18
18
|
Provides-Extra: all
|
|
@@ -26,6 +26,7 @@ from gitlab_api.gitlab_input_models import (
|
|
|
26
26
|
)
|
|
27
27
|
from gitlab_api.gitlab_response_models import (
|
|
28
28
|
ApprovalRule,
|
|
29
|
+
CreatedDeployToken,
|
|
29
30
|
DeployToken,
|
|
30
31
|
Group,
|
|
31
32
|
Job,
|
|
@@ -184,6 +185,9 @@ class GitLabApiProjects(GitLabApiBase):
|
|
|
184
185
|
"""
|
|
185
186
|
Create a deploy token for a project.
|
|
186
187
|
|
|
188
|
+
Returns a secret: the new token string is returned once, at creation, and never
|
|
189
|
+
by any read call. Store it now.
|
|
190
|
+
|
|
187
191
|
Args:
|
|
188
192
|
**kwargs: Additional parameters for the request (e.g., project_id, name, scopes).
|
|
189
193
|
|
|
@@ -224,7 +228,7 @@ class GitLabApiProjects(GitLabApiBase):
|
|
|
224
228
|
json=deploy_token.model_dump(exclude_none=True),
|
|
225
229
|
)
|
|
226
230
|
response.raise_for_status()
|
|
227
|
-
parsed_data =
|
|
231
|
+
parsed_data = CreatedDeployToken(**response.json())
|
|
228
232
|
return Response(response=response, data=parsed_data)
|
|
229
233
|
except ValidationError as e:
|
|
230
234
|
raise ParameterError(f"Invalid parameters: {e.errors()}") from e
|
|
@@ -23,6 +23,7 @@ from gitlab_api.gitlab_input_models import (
|
|
|
23
23
|
UserModel,
|
|
24
24
|
)
|
|
25
25
|
from gitlab_api.gitlab_response_models import (
|
|
26
|
+
CreatedDeployToken,
|
|
26
27
|
DeployToken,
|
|
27
28
|
Group,
|
|
28
29
|
Membership,
|
|
@@ -179,6 +180,9 @@ class GitLabApiUsersGroups(GitLabApiBase):
|
|
|
179
180
|
"""
|
|
180
181
|
Create a deploy token for a group.
|
|
181
182
|
|
|
183
|
+
Returns a secret: the new token string is returned once, at creation, and never
|
|
184
|
+
by any read call. Store it now.
|
|
185
|
+
|
|
182
186
|
Args:
|
|
183
187
|
**kwargs: Additional parameters for the request (e.g., group_id, name, scopes).
|
|
184
188
|
|
|
@@ -219,7 +223,7 @@ class GitLabApiUsersGroups(GitLabApiBase):
|
|
|
219
223
|
json=deploy_token.model_dump(exclude_none=True),
|
|
220
224
|
)
|
|
221
225
|
response.raise_for_status()
|
|
222
|
-
parsed_data =
|
|
226
|
+
parsed_data = CreatedDeployToken(**response.json())
|
|
223
227
|
return Response(response=response, data=parsed_data)
|
|
224
228
|
except ValidationError as e:
|
|
225
229
|
raise ParameterError(f"Invalid parameters: {e.errors()}") from e
|
|
@@ -12,7 +12,11 @@ from scion_sdk.exceptions import (
|
|
|
12
12
|
)
|
|
13
13
|
from scion_sdk.tls.profile import ResolvedTLSProfile
|
|
14
14
|
from scion_sdk.tls.resolve import resolve_tls_profile
|
|
15
|
-
from scion_sdk.transports.graphql import
|
|
15
|
+
from scion_sdk.transports.graphql import (
|
|
16
|
+
GraphQLAuth,
|
|
17
|
+
GraphQLClient,
|
|
18
|
+
GraphQLExecutionError,
|
|
19
|
+
)
|
|
16
20
|
|
|
17
21
|
from gitlab_api.api.api_client_base import request_timeout
|
|
18
22
|
from gitlab_api.gitlab_input_models import (
|
|
@@ -35,6 +39,34 @@ from gitlab_api.gitlab_input_models import (
|
|
|
35
39
|
)
|
|
36
40
|
|
|
37
41
|
|
|
42
|
+
def classify_gitlab_errors(entries: list[dict[str, Any]]) -> str:
|
|
43
|
+
"""Map GitLab's stable query-error answers to one closed category.
|
|
44
|
+
|
|
45
|
+
Pure: reads the entries' text only to choose a category and returns
|
|
46
|
+
the category alone, so no GitLab text reaches the caller.
|
|
47
|
+
"""
|
|
48
|
+
text = " ".join(str(entry.get("message", "")) for entry in entries).lower()
|
|
49
|
+
if "does not exist" in text or "not found" in text:
|
|
50
|
+
return "not_found"
|
|
51
|
+
if "permission" in text or "forbidden" in text:
|
|
52
|
+
return "forbidden"
|
|
53
|
+
if "invalid" in text or "argument" in text or "variable" in text:
|
|
54
|
+
return "invalid_input"
|
|
55
|
+
return "unknown"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _mutation_errors_failure() -> GraphQLExecutionError:
|
|
59
|
+
"""The typed failure for a mutation that answers its own ``errors`` list."""
|
|
60
|
+
from gql.transport.exceptions import TransportQueryError
|
|
61
|
+
|
|
62
|
+
return GraphQLExecutionError(
|
|
63
|
+
TransportQueryError(
|
|
64
|
+
"mutation errors",
|
|
65
|
+
errors=[{"extensions": {"code": "BAD_USER_INPUT"}}],
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
38
70
|
@dataclass
|
|
39
71
|
class ProjectListFilters:
|
|
40
72
|
"""Optional filters for a `projects` GraphQL list query."""
|
|
@@ -127,6 +159,7 @@ class GraphQL:
|
|
|
127
159
|
tls_service="gitlab",
|
|
128
160
|
timeout=request_timeout(),
|
|
129
161
|
fetch_schema=True,
|
|
162
|
+
error_classifier=classify_gitlab_errors,
|
|
130
163
|
)
|
|
131
164
|
|
|
132
165
|
@require_auth
|
|
@@ -1248,7 +1281,10 @@ class GraphQL:
|
|
|
1248
1281
|
variables["input"] = {
|
|
1249
1282
|
k: v for k, v in variables["input"].items() if v is not None
|
|
1250
1283
|
}
|
|
1251
|
-
|
|
1284
|
+
result = self.execute_gql(query, variables=variables)
|
|
1285
|
+
if (result.get("mergeRequestUpdate") or {}).get("errors"):
|
|
1286
|
+
raise _mutation_errors_failure()
|
|
1287
|
+
return result
|
|
1252
1288
|
|
|
1253
1289
|
@require_auth
|
|
1254
1290
|
def delete_merge_request(
|