clear-skies-gitlab 2.0.1__tar.gz → 2.0.2__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 (101) hide show
  1. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/CHANGELOG.md +9 -0
  2. clear_skies_gitlab-2.0.2/LATEST_CHANGELOG.md +6 -0
  3. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/PKG-INFO +2 -2
  4. clear_skies_gitlab-2.0.2/local.py +70 -0
  5. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/pyproject.toml +2 -3
  6. clear_skies_gitlab-2.0.2/ruff.toml +117 -0
  7. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/__init__.py +3 -0
  8. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/defaults/__init__.py +9 -0
  9. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/src/clearskies_gitlab/defaults/gitlab_default_auth.py +3 -0
  10. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/defaults/gitlab_default_host.py +10 -0
  11. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/defaults/gitlab_graphql_client.py +18 -0
  12. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/src/clearskies_gitlab/exceptions/gitlab_error.py +1 -0
  13. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/__init__.py +3 -0
  14. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/backends/__init__.py +7 -0
  15. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/backends/gitlab_graphql_backend.py +38 -0
  16. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/__init__.py +13 -0
  17. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_container_repository.py +34 -0
  18. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_container_repository_reference.py +8 -0
  19. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_container_repository_tag.py +32 -0
  20. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_container_repository_tag_reference.py +8 -0
  21. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_group.py +24 -0
  22. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_group_reference.py +8 -0
  23. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_project.py +25 -0
  24. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/graphql/models/gitlab_project_reference.py +8 -0
  25. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/__init__.py +12 -0
  26. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/backends/__init__.py +3 -0
  27. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest}/backends/gitlab_rest_backend.py +17 -12
  28. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/gitlab_branch_rule.py +21 -0
  29. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest}/gitlab_cicd_variable.py +0 -3
  30. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest}/gitlab_member.py +0 -3
  31. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/__init__.py +49 -0
  32. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_advanced_search.py +7 -7
  33. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_advanced_search_blob.py +1 -4
  34. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_current_user.py +7 -4
  35. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_group.py → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_group.py +68 -5
  36. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_group_access_token.py +8 -6
  37. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_group_member.py +7 -6
  38. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_group_member_reference.py +8 -0
  39. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_group_project.py +16 -0
  40. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_group_project_reference.py +8 -0
  41. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_group_reference.py +9 -0
  42. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_group_search.py +2 -3
  43. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_group_search_blob.py +1 -1
  44. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_group_subgroup.py +52 -0
  45. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_group_subgroup_reference.py +8 -0
  46. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_group_variable.py +7 -5
  47. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_namespace.py +28 -9
  48. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_project.py → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project.py +129 -36
  49. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_config.py +34 -0
  50. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_config_reference.py +8 -0
  51. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_rule.py +42 -0
  52. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_rule_reference.py +8 -0
  53. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_member.py +29 -0
  54. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_member_reference.py +8 -0
  55. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_protected_branch.py +35 -0
  56. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_protected_branch_reference.py +8 -0
  57. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_reference.py +9 -0
  58. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_project_repository_commit.py +15 -5
  59. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_project_repository_commit_diff.py +6 -4
  60. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_contributor.py +34 -0
  61. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_contributor_reference.py +8 -0
  62. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_file.py +39 -0
  63. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_file_raw.py +31 -0
  64. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_file_reference.py +8 -0
  65. {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models}/gitlab_rest_project_variable.py +7 -5
  66. clear_skies_gitlab-2.0.2/src/clearskies_gitlab/rest/models/gitlab_rest_project_variable_reference.py +8 -0
  67. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/uv.lock +650 -270
  68. clear_skies_gitlab-2.0.1/LATEST_CHANGELOG.md +0 -15
  69. clear_skies_gitlab-2.0.1/ruff.toml +0 -29
  70. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/__init__.py +0 -3
  71. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/backends/__init__.py +0 -9
  72. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/defaults/__init__.py +0 -7
  73. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/defaults/gitlab_default_url.py +0 -7
  74. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/__init__.py +0 -19
  75. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_gql_model.py +0 -9
  76. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_namespace.py +0 -32
  77. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_rest_model.py +0 -11
  78. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/__init__.py +0 -35
  79. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group.py +0 -75
  80. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_member_reference.py +0 -6
  81. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_project.py +0 -37
  82. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_reference.py +0 -6
  83. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_subgroup.py +0 -65
  84. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_subgroup_reference.py +0 -6
  85. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_project.py +0 -81
  86. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_project_reference.py +0 -6
  87. clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_project_variable_refence.py +0 -6
  88. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.copier-answers.yml +0 -0
  89. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.editorconfig +0 -0
  90. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.github/workflows/create-version.yaml +0 -0
  91. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.github/workflows/docs.yaml +0 -0
  92. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.github/workflows/run-tests.yml +0 -0
  93. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.github/workflows/tests-matrix.yaml +0 -0
  94. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.github/workflows/tests.yaml +0 -0
  95. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.gitignore +0 -0
  96. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.pre-commit-config.yaml +0 -0
  97. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/.python-version +0 -0
  98. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/LICENSE +0 -0
  99. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/README.md +0 -0
  100. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/cliff.toml +0 -0
  101. {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.2}/src/clearskies_gitlab/exceptions/__init__.py +0 -0
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.2] - 2026-01-07
9
+
10
+ ### Changed
11
+ - Rewrite modules
12
+ - More models
13
+
8
14
  ## [2.0.1] - 2025-10-20
9
15
 
10
16
  ### Added
@@ -12,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
18
  - Add first models and backends
13
19
 
14
20
  ### Changed
21
+ - Bump version to v2.0.1 by @github-actions[bot]
15
22
  - Initial project setup
16
23
 
17
24
  ### Fixed
@@ -19,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
26
  - Circular import
20
27
 
21
28
  ## New Contributors
29
+ * @github-actions[bot] made their first contribution
22
30
  * @ made their first contribution
31
+ [2.0.2]: https://github.com/clearskies-py/gitlab/compare/v2.0.1..v2.0.2
23
32
 
24
33
  <!-- generated by git-cliff -->
@@ -0,0 +1,6 @@
1
+ ## [2.0.2] - 2026-01-07
2
+
3
+ ### Changed
4
+ - Rewrite modules
5
+ - More models
6
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clear-skies-gitlab
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Gitlab module for Clearskies
5
5
  Project-URL: Docs, https://https://clearskies.info/modules/clear-skies-gitlab
6
6
  Project-URL: Repository, https://github.com/clearskies-py/gitlab
@@ -15,7 +15,7 @@ Classifier: License :: OSI Approved :: MIT License
15
15
  Classifier: Programming Language :: Python :: 3
16
16
  Requires-Python: <4.0,>=3.11
17
17
  Requires-Dist: clear-skies>=2.0.0
18
- Requires-Dist: gql>=4.0.0
18
+ Requires-Dist: gql[all]>=4.0.0
19
19
  Requires-Dist: requests>=2.32.5
20
20
  Provides-Extra: dev
21
21
  Requires-Dist: types-requests>=2.32.4; extra == 'dev'
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/python3
2
+ import logging
3
+ from typing import Any
4
+
5
+ import akeyless
6
+ import clearskies
7
+
8
+ import clearskies_gitlab
9
+ from clearskies_gitlab.graphql import models as graphql
10
+ from clearskies_gitlab.rest import models as rest
11
+
12
+ logging.basicConfig(level=logging.WARN)
13
+
14
+
15
+ def get_project(
16
+ gitlab_rest_projects: rest.GitlabRestProject, gitlab_gql_projects: graphql.GitlabProject
17
+ ) -> dict[str, Any]:
18
+ """Local test for projects."""
19
+ project = gitlab_rest_projects.find("id=Cimpress-Technology/cimsec/cimsec-pypi")
20
+ # print(f"Parent group: {project.group.name}")
21
+ # print(f"Count: {len(search_projects)}")
22
+ for variable in project.variables.paginate_all():
23
+ print(f"Variable: {variable.key} = {variable.value}")
24
+
25
+ gql_project = gitlab_gql_projects.find("id=278964")
26
+ print(f"GQL Parent group ID: {gql_project.id}")
27
+ print(f"GGL data: {gql_project.get_columns_data()}")
28
+ return project.group.id
29
+ # for project in search_projects.paginate_all():
30
+ # print(project.name)
31
+
32
+
33
+ def get_group(gitlab_rest_group: rest.GitlabRestGroup) -> dict[str, Any]:
34
+ """Local test for groups."""
35
+ group = gitlab_rest_group.find("id=Cimpress-Technology/cimsec")
36
+ # print(f"Group name: {group.name}")
37
+ # print(f"Count: {len(search_groups)}")
38
+ for variable in group.variables.paginate_all():
39
+ print(f"Variable: {variable.key} = {variable.value}")
40
+ for project in group.projects.limit(5):
41
+ print(f"Project: {project.name}")
42
+ for member in group.members.limit(5):
43
+ print(f"Member: {member.name}")
44
+ return group.id
45
+
46
+
47
+ cli = clearskies.contexts.Cli(
48
+ clearskies.EndpointGroup(
49
+ [
50
+ clearskies.endpoints.Callable(
51
+ get_project,
52
+ url="/project",
53
+ return_standard_response=False,
54
+ ),
55
+ clearskies.endpoints.Callable(
56
+ get_group,
57
+ url="/group",
58
+ return_standard_response=False,
59
+ ),
60
+ ]
61
+ ),
62
+ modules=[clearskies_gitlab],
63
+ bindings={
64
+ "akeyless_sdk": akeyless,
65
+ "secrets": clearskies.secrets.Akeyless(access_id="p-je7a0rik2ptf", access_type="saml", profile="default"),
66
+ },
67
+ )
68
+
69
+ if __name__ == "__main__":
70
+ cli()
@@ -1,14 +1,14 @@
1
1
  [project]
2
2
  name = "clear-skies-gitlab"
3
3
  description = "Gitlab module for Clearskies"
4
- version = "2.0.1"
4
+ version = "2.0.2"
5
5
  license = "MIT"
6
6
  readme = "./README.md"
7
7
  authors = [{name = "Tom Nijboer", email = "tom.nijboer@cimpress.com"}]
8
8
  requires-python = ">=3.11,<4.0"
9
9
  dependencies = [
10
10
  "clear-skies>=2.0.0",
11
- "gql>=4.0.0",
11
+ "gql[all]>=4.0.0",
12
12
  "requests>=2.32.5",
13
13
  ]
14
14
  classifiers = [
@@ -69,7 +69,6 @@ pythonpath = [
69
69
  "src"
70
70
  ]
71
71
 
72
-
73
72
  # This is the dedicated section for uv"s configuration
74
73
  [dependency-groups]
75
74
  dev = [
@@ -0,0 +1,117 @@
1
+ #fixes
2
+ fix = true
3
+ show-fixes = true
4
+
5
+ # Exclude a variety of commonly ignored directories.
6
+ extend-exclude = [
7
+ ".bzr",
8
+ ".direnv",
9
+ ".eggs",
10
+ ".git",
11
+ ".hg",
12
+ ".mypy_cache",
13
+ ".nox",
14
+ ".pants.d",
15
+ ".pytype",
16
+ ".ruff_cache",
17
+ ".svn",
18
+ ".tox",
19
+ ".venv",
20
+ "__pypackages__",
21
+ "_build",
22
+ "buck-out",
23
+ "build",
24
+ "dist",
25
+ "node_modules",
26
+ "venv",
27
+ "docs",
28
+ ]
29
+
30
+ # Same as Black.
31
+ line-length = 120
32
+ indent-width = 4
33
+
34
+ # Assume Python 3.13
35
+ target-version = "py313"
36
+
37
+ output-format = "gitlab"
38
+
39
+ [lint]
40
+ # Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
41
+ select = [
42
+ #"B", # flake8-bugbear
43
+ "C4", # flake8-comprehensions
44
+ "D", # pydocstyle
45
+ "E", # Error
46
+ "F", # pyflakes
47
+ "I", # isort
48
+ "ISC", # flake8-implicit-str-concat
49
+ "N", # pep8-naming
50
+ "PGH", # pygrep-hooks
51
+ "PTH", # flake8-use-pathlib
52
+ "Q", # flake8-quotes
53
+ "S", # bandit
54
+ "SIM", # flake8-simplify
55
+ "TRY", # tryceratops
56
+ "UP", # pyupgrade
57
+ "W", # Warning
58
+ "YTT", # flake8-2020
59
+ ]
60
+ ignore = [
61
+ "E501",
62
+ "D100",
63
+ "D104",
64
+ "D300", #triple double quotes
65
+ "D107",
66
+ "TRY003",
67
+ ]
68
+
69
+ # Allow autofix for all enabled rules (when `--fix`) is provided.
70
+ # fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
71
+ fixable = ["ALL"]
72
+ unfixable = []
73
+
74
+ # Allow unused variables when underscore-prefixed.
75
+ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
76
+
77
+ [lint.mccabe]
78
+ # Unlike Flake8, default to a complexity level of 10.
79
+ max-complexity = 10
80
+
81
+ [lint.pydocstyle]
82
+ convention = "pep257"
83
+
84
+ [lint.per-file-ignores]
85
+ "tests/*.py" = [
86
+ "D100",
87
+ "D101",
88
+ "D102",
89
+ "D103",
90
+ "D104",
91
+ "D105",
92
+ "D106",
93
+ "D107",
94
+ "S101", # use of "assert"
95
+ "S102", # use of "exec"
96
+ "S106", # possible hardcoded password.
97
+ "PGH001", # use of "eval"
98
+ ]
99
+
100
+ [lint.pep8-naming]
101
+ staticmethod-decorators = [
102
+ "pydantic.validator",
103
+ "pydantic.root_validator",
104
+ ]
105
+
106
+ [format]
107
+ # Like Black, use double quotes for strings.
108
+ quote-style = "double"
109
+
110
+ # Like Black, indent with spaces, rather than tabs.
111
+ indent-style = "space"
112
+
113
+ # Like Black, respect magic trailing commas.
114
+ skip-magic-trailing-comma = false
115
+
116
+ # Like Black, automatically detect the appropriate line ending.
117
+ line-ending = "auto"
@@ -0,0 +1,3 @@
1
+ from clearskies_gitlab import defaults, exceptions, graphql, rest
2
+
3
+ __all__ = ["rest", "graphql", "defaults", "exceptions"]
@@ -0,0 +1,9 @@
1
+ from clearskies_gitlab.defaults.gitlab_default_auth import GitlabDefaultAuth
2
+ from clearskies_gitlab.defaults.gitlab_default_host import GitlabDefaultHost
3
+ from clearskies_gitlab.defaults.gitlab_graphql_client import GitlabDefaultGraphqlClient
4
+
5
+ __all__ = [
6
+ "GitlabDefaultAuth",
7
+ "GitlabDefaultHost",
8
+ "GitlabDefaultGraphqlClient",
9
+ ]
@@ -2,6 +2,9 @@ import clearskies
2
2
 
3
3
 
4
4
  class GitlabDefaultAuth(clearskies.di.AdditionalConfigAutoImport):
5
+ """Provide default Gitlab authentication from environment."""
6
+
5
7
  def provide_gitlab_auth(self, environment: clearskies.Environment):
8
+ """Provide the Gitlab authentication from environment."""
6
9
  secret_key = environment.get("GITLAB_AUTH_KEY", True)
7
10
  return clearskies.authentication.SecretBearer(secret_key=secret_key, header_prefix="Bearer ")
@@ -0,0 +1,10 @@
1
+ import clearskies
2
+
3
+
4
+ class GitlabDefaultHost(clearskies.di.AdditionalConfigAutoImport):
5
+ """Provide default GitLab Host from environment."""
6
+
7
+ def provide_gitlab_host(self, environment: clearskies.Environment):
8
+ """Provide the GitLab host from environment or default."""
9
+ gitlab_host = environment.get("GITLAB_HOST", True)
10
+ return gitlab_host if gitlab_host else "https://gitlab.com/"
@@ -0,0 +1,18 @@
1
+ import clearskies
2
+
3
+
4
+ class GitlabDefaultGraphqlClient(clearskies.di.AdditionalConfigAutoImport):
5
+ """Provide default Gitlab authentication from environment."""
6
+
7
+ def provide_gitlab_graphql_client(
8
+ self,
9
+ gitlab_auth: clearskies.authentication.Authentication,
10
+ gitlab_host: str,
11
+ environment: clearskies.Environment,
12
+ ):
13
+ """Provide the Gitlab authentication from environment."""
14
+ return clearskies.clients.GraphqlClient(
15
+ endpoint=f"{gitlab_host.rstrip('/')}/api/graphql",
16
+ authentication=gitlab_auth,
17
+ timeout=30,
18
+ )
@@ -47,4 +47,5 @@ class GitlabParamMissingError(ValueError):
47
47
  """Error if param is missing."""
48
48
 
49
49
  def __init__(self, param_name: str, table_name: str) -> None:
50
+ """Create error with param and table name."""
50
51
  super().__init__(f"Must provide the {param_name} to add the member to when updating a {table_name}")
@@ -0,0 +1,3 @@
1
+ from clearskies_gitlab.graphql import backends, models
2
+
3
+ __all__ = ["backends", "models"]
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from clearskies_gitlab.graphql.backends.gitlab_graphql_backend import GitlabGraphqlBackend
4
+
5
+ __all__ = [
6
+ "GitlabGraphqlBackend",
7
+ ]
@@ -0,0 +1,38 @@
1
+ from __future__ import annotations
2
+
3
+ from clearskies import configs, decorators
4
+ from clearskies.backends import GraphqlBackend
5
+ from clearskies.clients.graphql_client import GraphqlClient
6
+ from clearskies.di import inject
7
+
8
+
9
+ class GitlabGraphqlBackend(GraphqlBackend):
10
+ """Backend to gitlab using graphql."""
11
+
12
+ graphql_client_name = configs.String(default="gitlab_graphql_client")
13
+
14
+ api_to_model_map = configs.AnyDict(default={})
15
+ pagination_parameter_name = configs.String(default="page")
16
+ api_casing = configs.String(default="camelCase")
17
+ model_casing = configs.String(default="snake_case")
18
+
19
+ di = inject.Di()
20
+
21
+ @decorators.parameters_to_properties
22
+ def __init__(
23
+ self,
24
+ graphql_client: GraphqlClient | None = None,
25
+ graphql_client_name: str = "gitlab_graphql_client",
26
+ root_field: str = "",
27
+ pagination_style: str = "cursor",
28
+ api_case: str = "camelCase",
29
+ model_case: str = "snake_case",
30
+ is_collection: bool | None = None,
31
+ max_relationship_depth: int = 2,
32
+ relationship_limit: int = 10,
33
+ use_connection_for_relationships: bool = True,
34
+ id_argument_name: str | None = None,
35
+ id_argument_is_array: bool = False,
36
+ id_format_pattern: str = "",
37
+ ):
38
+ self.finalize_and_validate_configuration()
@@ -0,0 +1,13 @@
1
+ from __future__ import annotations
2
+
3
+ from clearskies_gitlab.graphql.models.gitlab_container_repository import GitlabContainerRepository
4
+ from clearskies_gitlab.graphql.models.gitlab_container_repository_tag import GitlabContainerRepositoryTag
5
+ from clearskies_gitlab.graphql.models.gitlab_group import GitlabGroup
6
+ from clearskies_gitlab.graphql.models.gitlab_project import GitlabProject
7
+
8
+ __all__ = [
9
+ "GitlabContainerRepository",
10
+ "GitlabContainerRepositoryTag",
11
+ "GitlabProject",
12
+ "GitlabGroup",
13
+ ]
@@ -0,0 +1,34 @@
1
+ from clearskies import Model
2
+ from clearskies.columns import BelongsToId, BelongsToModel, Datetime, HasMany, String
3
+
4
+ from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
5
+ from clearskies_gitlab.graphql.models import gitlab_container_repository_tag_reference, gitlab_project_reference
6
+
7
+
8
+ class GitlabContainerRepository(Model):
9
+ """Model for gitlab container repositories via GQL."""
10
+
11
+ id_column_name: str = "id"
12
+
13
+ backend = GitlabGraphqlBackend(
14
+ root_field="containerRepositories",
15
+ id_argument_is_array=True,
16
+ id_format_pattern="gid://gitlab/ContainerRepository/{id}",
17
+ id_argument_name="ids",
18
+ )
19
+
20
+ @classmethod
21
+ def destination_name(cls) -> str:
22
+ """Return the slug of the api endpoint for this model."""
23
+ return "containerRepository"
24
+
25
+ name = String()
26
+ location = String()
27
+ path = String()
28
+ created_at = Datetime()
29
+ project_id = BelongsToId(gitlab_project_reference.GitlabProjectReference)
30
+ project = BelongsToModel("project_id")
31
+ tags = HasMany(
32
+ gitlab_container_repository_tag_reference.GitlabContainerRepositoryTagReference,
33
+ foreign_column_name="containerRepositoryId",
34
+ )
@@ -0,0 +1,8 @@
1
+ class GitlabContainerRepositoryReference:
2
+ """Reference to GitlabContainerRepository model."""
3
+
4
+ def get_model_class(self) -> type:
5
+ """Return the model class this reference points to."""
6
+ from clearskies_gitlab.graphql.models import gitlab_container_repository
7
+
8
+ return gitlab_container_repository.GitlabContainerRepository
@@ -0,0 +1,32 @@
1
+ from clearskies import Model
2
+ from clearskies.columns import BelongsToId, BelongsToModel, Datetime, String
3
+
4
+ from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
5
+ from clearskies_gitlab.graphql.models import gitlab_container_repository_reference
6
+
7
+
8
+ class GitlabContainerRepositoryTag(Model):
9
+ """Model for gitlab container repositories via GQL."""
10
+
11
+ id_column_name: str = "name"
12
+
13
+ backend = GitlabGraphqlBackend(
14
+ root_field="containerRepositories",
15
+ id_argument_is_array=True,
16
+ id_format_pattern="gid://gitlab/ContainerRepository/{id}",
17
+ id_argument_name="ids",
18
+ )
19
+
20
+ @classmethod
21
+ def destination_name(cls) -> str:
22
+ """Return the slug of the api endpoint for this model."""
23
+ return "tag"
24
+
25
+ name = String()
26
+ digest = String()
27
+ location = String()
28
+ path = String()
29
+ created_at = Datetime()
30
+ published_at = Datetime()
31
+ container_repository_id = BelongsToId(gitlab_container_repository_reference.GitlabContainerRepositoryReference)
32
+ container_repository = BelongsToModel("container_repository_id")
@@ -0,0 +1,8 @@
1
+ class GitlabContainerRepositoryTagReference:
2
+ """Reference to GitlabContainerRepositoryTag model."""
3
+
4
+ def get_model_class(self) -> type:
5
+ """Return the model class this reference points to."""
6
+ from clearskies_gitlab.graphql.models import gitlab_container_repository_tag
7
+
8
+ return gitlab_container_repository_tag.GitlabContainerRepositoryTag
@@ -0,0 +1,24 @@
1
+ from __future__ import annotations
2
+
3
+ from clearskies import Model
4
+
5
+ from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
6
+
7
+
8
+ class GitlabGroup(Model):
9
+ """Model for gitlab projects via GQL."""
10
+
11
+ gitlab_id_pattern: str = "gid://gitlab/Group/[ID]"
12
+
13
+ id_column_name: str = "id"
14
+ backend = GitlabGraphqlBackend(
15
+ root_field="groups",
16
+ id_argument_is_array=True,
17
+ id_format_pattern="gid://gitlab/Project/{id}",
18
+ id_argument_name="ids",
19
+ )
20
+
21
+ @classmethod
22
+ def destination_name(cls) -> str:
23
+ """Return the slug of the api endpoint for this model."""
24
+ return "group"
@@ -0,0 +1,8 @@
1
+ class GitlabGroupReference:
2
+ """Reference to GitlabGroup model."""
3
+
4
+ def get_model_class(self) -> type:
5
+ """Return the model class this reference points to."""
6
+ from clearskies_gitlab.graphql.models import gitlab_group
7
+
8
+ return gitlab_group.GitlabGroup
@@ -0,0 +1,25 @@
1
+ from __future__ import annotations
2
+
3
+ from clearskies import Model
4
+ from clearskies.columns import String
5
+
6
+ from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
7
+
8
+
9
+ class GitlabProject(Model):
10
+ """Model for gitlab projects via GQL."""
11
+
12
+ id_column_name: str = "id"
13
+ backend = GitlabGraphqlBackend(
14
+ root_field="projects",
15
+ id_argument_is_array=True,
16
+ id_format_pattern="gid://gitlab/Project/{id}",
17
+ id_argument_name="ids",
18
+ )
19
+
20
+ @classmethod
21
+ def destination_name(cls) -> str:
22
+ """Return the slug of the api endpoint for this model."""
23
+ return "projects"
24
+
25
+ id = String()
@@ -0,0 +1,8 @@
1
+ class GitlabProjectReference:
2
+ """Reference to GitlabProject model."""
3
+
4
+ def get_model_class(self) -> type:
5
+ """Return the model class this reference points to."""
6
+ from clearskies_gitlab.graphql.models import gitlab_project
7
+
8
+ return gitlab_project.GitlabProject
@@ -0,0 +1,12 @@
1
+ from __future__ import annotations
2
+
3
+ from clearskies_gitlab.rest import backends, models
4
+ from clearskies_gitlab.rest.gitlab_cicd_variable import GitlabCICDVariable
5
+ from clearskies_gitlab.rest.gitlab_member import GitlabMember
6
+
7
+ __all__ = [
8
+ "backends",
9
+ "models",
10
+ "GitlabMember",
11
+ "GitlabCICDVariable",
12
+ ]
@@ -0,0 +1,3 @@
1
+ from clearskies_gitlab.rest.backends.gitlab_rest_backend import GitlabRestBackend
2
+
3
+ __all__ = ["GitlabRestBackend"]
@@ -1,23 +1,16 @@
1
1
  from __future__ import annotations
2
2
 
3
- import logging
4
3
  import urllib
5
- from collections.abc import Callable
6
- from typing import TYPE_CHECKING, Any, cast
4
+ from typing import TYPE_CHECKING, Any
7
5
 
8
- import requests
9
- from clearskies import Column, Model, configs
6
+ from clearskies import configs
10
7
  from clearskies.backends import ApiBackend
11
8
  from clearskies.decorators import parameters_to_properties
12
9
  from clearskies.di import inject
13
- from clearskies.functional import string
14
10
  from clearskies.query import Query
15
11
  from requests.structures import CaseInsensitiveDict
16
12
 
17
- from clearskies_gitlab.exceptions import gitlab_error
18
-
19
13
  if TYPE_CHECKING:
20
- from clearskies import model
21
14
  from clearskies.authentication import Authentication
22
15
  from clearskies.query import Query
23
16
 
@@ -25,8 +18,8 @@ if TYPE_CHECKING:
25
18
  class GitlabRestBackend(ApiBackend):
26
19
  """Backend for Gitlab.com."""
27
20
 
28
- base_url = inject.ByName("gitlab_url", cache=True)
29
- authentication = inject.ByName("gitlab_auth", cache=False)
21
+ gitlab_host = inject.ByName("gitlab_host", cache=True) # type: ignore[assignment]
22
+ authentication = inject.ByName("gitlab_auth", cache=False) # type: ignore[assignment]
30
23
  requests = inject.Requests()
31
24
  _auth_headers: dict[str, str] = {}
32
25
 
@@ -47,6 +40,17 @@ class GitlabRestBackend(ApiBackend):
47
40
  ):
48
41
  self.finalize_and_validate_configuration()
49
42
 
43
+ @property
44
+ def base_url(self) -> str:
45
+ """
46
+ Docstring for base_url.
47
+
48
+ :param self: Description
49
+ :return: Description
50
+ :rtype: str
51
+ """
52
+ return f"{self.gitlab_host.rstrip('/')}/api/v4"
53
+
50
54
  def count_method(self, query: Query) -> str:
51
55
  """Return the request method to use when making a request for a record count."""
52
56
  return "HEAD"
@@ -90,6 +94,7 @@ class GitlabRestBackend(ApiBackend):
90
94
  def conditions_to_request_parameters(
91
95
  self, query: Query, used_routing_parameters: list[str]
92
96
  ) -> tuple[str, dict[str, str], dict[str, Any]]:
97
+ """Convert query conditions to request parameters."""
93
98
  route_id = ""
94
99
 
95
100
  url_parameters = {}
@@ -111,7 +116,7 @@ class GitlabRestBackend(ApiBackend):
111
116
  # self,
112
117
  # next_page_data: dict[str, Any],
113
118
  # query: Query,
114
- # response: requests.Response, # type: ignore
119
+ # response: requests.Response,
115
120
  # ) -> None:
116
121
  # """
117
122
  # Update the next_page_data dictionary with the appropriate data needed to fetch the next page of records.