gitlab-api 25.23.0__tar.gz → 25.24.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 (39) hide show
  1. {gitlab_api-25.23.0/gitlab_api.egg-info → gitlab_api-25.24.0}/PKG-INFO +6 -5
  2. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/README.md +1 -1
  3. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/agent_server.py +1 -1
  4. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/api_client.py +30 -0
  5. gitlab_api-25.24.0/gitlab_api/auth.py +78 -0
  6. gitlab_api-25.24.0/gitlab_api/mcp_server.py +2336 -0
  7. {gitlab_api-25.23.0 → gitlab_api-25.24.0/gitlab_api.egg-info}/PKG-INFO +6 -5
  8. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api.egg-info/SOURCES.txt +1 -0
  9. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api.egg-info/requires.txt +4 -3
  10. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api.egg-info/top_level.txt +1 -0
  11. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/pyproject.toml +8 -5
  12. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/test_setup.py +8 -6
  13. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/test_gitlab_a2a_validation.py +2 -0
  14. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/test_gitlab_mcp_validation.py +2 -1
  15. gitlab_api-25.24.0/tests/test_startup.py +13 -0
  16. gitlab_api-25.23.0/gitlab_api/auth.py +0 -93
  17. gitlab_api-25.23.0/gitlab_api/mcp_server.py +0 -7339
  18. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/LICENSE +0 -0
  19. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/MANIFEST.in +0 -0
  20. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/__init__.py +0 -0
  21. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/__main__.py +0 -0
  22. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/gitlab_gql.py +0 -0
  23. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/gitlab_input_models.py +0 -0
  24. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/gitlab_response_models.py +0 -0
  25. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api/mcp_config.json +0 -0
  26. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api.egg-info/dependency_links.txt +0 -0
  27. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/gitlab_api.egg-info/entry_points.txt +0 -0
  28. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/requirements.txt +0 -0
  29. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/scripts/validate_a2a_agent.py +0 -0
  30. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/scripts/validate_agent.py +0 -0
  31. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/setup.cfg +0 -0
  32. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/__init__.py +0 -0
  33. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/conftest.py +0 -0
  34. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/test_api_wrapper.py +0 -0
  35. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/test_concept_parity.py +0 -0
  36. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/test_gitlab_api_brute_force_coverage.py +0 -0
  37. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/test_gitlab_models.py +0 -0
  38. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/test_verify_agent.py +0 -0
  39. {gitlab_api-25.23.0 → gitlab_api-25.24.0}/tests/verify_a2a_queries.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlab-api
3
- Version: 25.23.0
3
+ Version: 25.24.0
4
4
  Summary: GitLab API + MCP Server + A2A Server
5
5
  Author-email: Audel Rouhi <knucklessg1@gmail.com>
6
6
  License: MIT
@@ -12,11 +12,11 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: <3.14,>=3.11
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: agent-utilities>=0.9.0
15
+ Requires-Dist: agent-utilities>=0.11.0
16
16
  Provides-Extra: mcp
17
- Requires-Dist: agent-utilities[mcp]>=0.9.0; extra == "mcp"
17
+ Requires-Dist: agent-utilities[mcp]>=0.11.0; extra == "mcp"
18
18
  Provides-Extra: agent
19
- Requires-Dist: agent-utilities[agent,logfire]>=0.9.0; extra == "agent"
19
+ Requires-Dist: agent-utilities[agent,logfire]>=0.11.0; extra == "agent"
20
20
  Provides-Extra: gql
21
21
  Requires-Dist: gql>=4.0.0; extra == "gql"
22
22
  Provides-Extra: all
@@ -24,6 +24,7 @@ Requires-Dist: gitlab-api[agent,gql,logfire,mcp]>=25.15.56; extra == "all"
24
24
  Provides-Extra: test
25
25
  Requires-Dist: pytest; extra == "test"
26
26
  Requires-Dist: pytest-asyncio; extra == "test"
27
+ Requires-Dist: pytest-cov; extra == "test"
27
28
  Dynamic: license-file
28
29
 
29
30
  # GitLab API - A2A | AG-UI | MCP
@@ -49,7 +50,7 @@ Dynamic: license-file
49
50
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/gitlab-api)
50
51
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/gitlab-api)
51
52
 
52
- *Version: 25.23.0*
53
+ *Version: 25.24.0*
53
54
 
54
55
  ## Overview
55
56
 
@@ -21,7 +21,7 @@
21
21
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/gitlab-api)
22
22
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/gitlab-api)
23
23
 
24
- *Version: 25.23.0*
24
+ *Version: 25.24.0*
25
25
 
26
26
  ## Overview
27
27
 
@@ -12,7 +12,7 @@ from agent_utilities import (
12
12
  load_identity,
13
13
  )
14
14
 
15
- __version__ = "25.23.0"
15
+ __version__ = "25.24.0"
16
16
 
17
17
  logging.basicConfig(
18
18
  level=logging.INFO,
@@ -3456,6 +3456,36 @@ class Api:
3456
3456
  except ValidationError as e:
3457
3457
  raise ParameterError(f"Invalid parameters: {e.errors()}") from e
3458
3458
 
3459
+ @require_auth
3460
+ def delete_shared_project_link(self, **kwargs) -> Response:
3461
+ """
3462
+ Unshare a specific project from a group.
3463
+
3464
+ Args:
3465
+ **kwargs: Additional parameters for the request (e.g., project_id, group_id).
3466
+
3467
+ Returns:
3468
+ Response: A wrapper containing the original response (no data for successful deletion).
3469
+
3470
+ Raises:
3471
+ MissingParameterError: If the project_id or group_id is missing.
3472
+ ParameterError: If invalid parameters are provided.
3473
+ """
3474
+ project = ProjectModel(**kwargs)
3475
+ if project.project_id is None or project.group_id is None:
3476
+ raise MissingParameterError
3477
+ try:
3478
+ response = self._session.delete(
3479
+ url=f"{self.url}/projects/{project.project_id}/share/{project.group_id}",
3480
+ headers=self.headers,
3481
+ verify=self.verify,
3482
+ proxies=self.proxies,
3483
+ )
3484
+ response.raise_for_status()
3485
+ return Response(response=response)
3486
+ except ValidationError as e:
3487
+ raise ParameterError(f"Invalid parameters: {e.errors()}") from e
3488
+
3459
3489
  @require_auth
3460
3490
  def get_protected_branches(self, **kwargs) -> Response:
3461
3491
  """
@@ -0,0 +1,78 @@
1
+ """GitLab Authentication Module.
2
+
3
+ Authentication priority:
4
+ 1. **OIDC Delegation** — If ``ENABLE_DELEGATION`` is active, exchanges
5
+ the IdP-issued user token for a downstream GitLab access token
6
+ via RFC 8693 Token Exchange using the shared ``delegated_auth`` helper.
7
+ 2. **Fixed Credentials** — Falls back to ``GITLAB_TOKEN`` env var.
8
+
9
+ See ``docs/guides/oauth_sso.md`` in agent-utilities for full details.
10
+ """
11
+
12
+ import os
13
+ import threading
14
+
15
+ from agent_utilities.base_utilities import get_logger, to_boolean
16
+ from agent_utilities.core.exceptions import AuthError, UnauthorizedError
17
+
18
+ from gitlab_api.api_client import Api
19
+
20
+ local = threading.local()
21
+ logger = get_logger(__name__)
22
+
23
+
24
+ def get_client(
25
+ instance: str = os.getenv("GITLAB_URL", "https://gitlab.com"),
26
+ token: str | None = os.getenv("GITLAB_TOKEN", None),
27
+ verify: bool = to_boolean(string=os.getenv("GITLAB_SSL_VERIFY", "True")),
28
+ config: dict | None = None,
29
+ ) -> Api:
30
+ """Factory function to create the GitLab Api client.
31
+
32
+ Supports OIDC delegation and fixed credentials (token).
33
+ Uses the shared ``delegated_auth`` helper from agent-utilities.
34
+ """
35
+ from agent_utilities.mcp.delegated_auth import (
36
+ get_delegated_token,
37
+ get_user_identity,
38
+ is_delegation_enabled,
39
+ )
40
+
41
+ # Resolve delegation config — prefer shared mcp_auth_config
42
+ delegation_enabled = is_delegation_enabled(config)
43
+
44
+ # --- Path 1: OIDC Delegation (RFC 8693 Token Exchange) ---
45
+ if delegation_enabled:
46
+ try:
47
+ delegated_token = get_delegated_token(
48
+ config=config,
49
+ audience=(config or {}).get("audience", instance),
50
+ scopes=(config or {}).get("delegated_scopes", "api"),
51
+ verify=verify,
52
+ )
53
+ identity = get_user_identity()
54
+ logger.info(
55
+ "Using OIDC delegated token for GitLab API",
56
+ extra={
57
+ "user_email": identity.get("email"),
58
+ "instance": instance,
59
+ },
60
+ )
61
+ return Api(url=instance, token=delegated_token, verify=verify)
62
+ except Exception as e:
63
+ logger.error(
64
+ "OIDC delegation failed for GitLab",
65
+ extra={"error_type": type(e).__name__, "error_message": str(e)},
66
+ )
67
+ raise RuntimeError(f"Token exchange failed: {str(e)}") from e
68
+
69
+ # --- Path 2: Fixed Credentials (GITLAB_TOKEN) ---
70
+ logger.info("Using fixed credentials for GitLab API")
71
+ try:
72
+ return Api(url=instance, token=token, verify=verify)
73
+ except (AuthError, UnauthorizedError) as e:
74
+ raise RuntimeError(
75
+ f"AUTHENTICATION ERROR: The GitLab credentials provided are not valid for '{instance}'. "
76
+ f"Please check your GITLAB_TOKEN and GITLAB_URL environment variables. "
77
+ f"Error details: {str(e)}"
78
+ ) from e