gitlab-projects-settings 2.0.1__tar.gz → 2.1.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 (40) hide show
  1. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.gitlab-ci.yml +1 -0
  2. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/CHANGELOG.md +29 -0
  3. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/PKG-INFO +5 -1
  4. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/README.md +4 -0
  5. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/gitlab_projects_settings.egg-info/PKG-INFO +5 -1
  6. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/cli/entrypoint.py +39 -22
  7. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/cli/main.py +5 -0
  8. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.chglog/CHANGELOG.tpl.md +0 -0
  9. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.chglog/changelog.sh +0 -0
  10. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.chglog/config.yml +0 -0
  11. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.gitignore +0 -0
  12. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.markdownlint.json +0 -0
  13. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.style.yapf +0 -0
  14. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.vscode/extensions.json +0 -0
  15. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/.vscode/settings.json +0 -0
  16. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/LICENSE +0 -0
  17. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/gitlab_projects_settings.egg-info/SOURCES.txt +0 -0
  18. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/gitlab_projects_settings.egg-info/dependency_links.txt +0 -0
  19. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/gitlab_projects_settings.egg-info/entry_points.txt +0 -0
  20. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/gitlab_projects_settings.egg-info/requires.txt +0 -0
  21. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/gitlab_projects_settings.egg-info/top_level.txt +0 -0
  22. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/mypy.ini +0 -0
  23. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/requirements/build.txt +0 -0
  24. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/requirements/deploy.txt +0 -0
  25. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/requirements/quality.txt +0 -0
  26. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/requirements/runtime.txt +0 -0
  27. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/setup.cfg +0 -0
  28. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/setup.py +0 -0
  29. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/__init__.py +0 -0
  30. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/__main__.py +0 -0
  31. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/cli/__init__.py +0 -0
  32. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/features/__init__.py +0 -0
  33. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/features/gitlab.py +0 -0
  34. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/package/__init__.py +0 -0
  35. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/package/bundle.py +0 -0
  36. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/package/version.py +0 -0
  37. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/prints/__init__.py +0 -0
  38. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/prints/colors.py +0 -0
  39. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/system/__init__.py +0 -0
  40. {gitlab_projects_settings-2.0.1 → gitlab_projects_settings-2.1.0}/src/system/platform.py +0 -0
@@ -137,6 +137,7 @@ typings:
137
137
  stage: prepare
138
138
  image: registry.gitlab.com/adriandc/gitlabci-local/gitlabci-local:codestyle
139
139
  variables:
140
+ MYPY_CACHE_DIR: /dev/null
140
141
  MYPY_FORCE_COLOR: 1
141
142
  TERM: ansi
142
143
  script:
@@ -1,4 +1,33 @@
1
1
 
2
+ <a name="2.1.0"></a>
3
+ ## [2.1.0](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/2.0.2...2.1.0) (2024-04-28)
4
+
5
+ ### Bug Fixes
6
+
7
+ * **entrypoint:** fix project '--update-description' logs output
8
+
9
+ ### Features
10
+
11
+ * **entrypoint:** sort groups and projects recursively
12
+ * **entrypoint:** keep description if already contains group
13
+
14
+
15
+ <a name="2.0.2"></a>
16
+ ## [2.0.2](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/2.0.1...2.0.2) (2024-04-28)
17
+
18
+ ### Ci
19
+
20
+ * **gitlab-ci:** disable 'typing' mypy caching with 'MYPY_CACHE_DIR'
21
+
22
+ ### Documentation
23
+
24
+ * **readme:** document GitLab tokens' creation instructions
25
+
26
+ ### Features
27
+
28
+ * **main:** limit '--help' width to terminal width or 120 chars
29
+
30
+
2
31
  <a name="2.0.1"></a>
3
32
  ## [2.0.1](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/2.0.0...2.0.1) (2024-04-28)
4
33
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gitlab-projects-settings
3
- Version: 2.0.1
3
+ Version: 2.1.0
4
4
  Summary: Configure GitLab groups and projects settings automatically
5
5
  Home-page: https://gitlab.com/AdrianDC/gitlab-projects-settings
6
6
  Author: Adrian DC
@@ -50,6 +50,10 @@ of groups, subgroups and projects, using multiple available options.
50
50
  Repetitive tasks can be performed accross multiple projects at once,
51
51
  for example protecting tags and branches, or setting a new avatar recursively.
52
52
 
53
+ The following step is required before using the tool:
54
+
55
+ - The GitLab user tokens must be created with an `api` scope (a short expiration date is recommended)
56
+
53
57
  ---
54
58
 
55
59
  ## Usage
@@ -16,6 +16,10 @@ of groups, subgroups and projects, using multiple available options.
16
16
  Repetitive tasks can be performed accross multiple projects at once,
17
17
  for example protecting tags and branches, or setting a new avatar recursively.
18
18
 
19
+ The following step is required before using the tool:
20
+
21
+ - The GitLab user tokens must be created with an `api` scope (a short expiration date is recommended)
22
+
19
23
  ---
20
24
 
21
25
  ## Usage
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gitlab-projects-settings
3
- Version: 2.0.1
3
+ Version: 2.1.0
4
4
  Summary: Configure GitLab groups and projects settings automatically
5
5
  Home-page: https://gitlab.com/AdrianDC/gitlab-projects-settings
6
6
  Author: Adrian DC
@@ -50,6 +50,10 @@ of groups, subgroups and projects, using multiple available options.
50
50
  Repetitive tasks can be performed accross multiple projects at once,
51
51
  for example protecting tags and branches, or setting a new avatar recursively.
52
52
 
53
+ The following step is required before using the tool:
54
+
55
+ - The GitLab user tokens must be created with an `api` scope (a short expiration date is recommended)
56
+
53
57
  ---
54
58
 
55
59
  ## Usage
@@ -76,11 +76,14 @@ class Entrypoint:
76
76
 
77
77
  # Iterate through subgroups
78
78
  if not options.exclude_subgroups:
79
- for group_subgroup in group.descendant_groups.list(
80
- get_all=True,
81
- include_subgroups=True,
82
- order_by='path',
83
- sort='asc',
79
+ for group_subgroup in sorted(
80
+ group.descendant_groups.list(
81
+ get_all=True,
82
+ include_subgroups=True,
83
+ order_by='path',
84
+ sort='asc',
85
+ ),
86
+ key=lambda item: item.full_path,
84
87
  ):
85
88
  Entrypoint.group(
86
89
  options,
@@ -91,11 +94,14 @@ class Entrypoint:
91
94
 
92
95
  # Iterate through projects
93
96
  if not options.exclude_projects:
94
- for group_project in group.projects.list(
95
- get_all=True,
96
- include_subgroups=not options.exclude_subgroups,
97
- order_by='path',
98
- sort='asc',
97
+ for group_project in sorted(
98
+ group.projects.list(
99
+ get_all=True,
100
+ include_subgroups=not options.exclude_subgroups,
101
+ order_by='path',
102
+ sort='asc',
103
+ ),
104
+ key=lambda item: item.path_with_namespace,
99
105
  ):
100
106
  Entrypoint.project(
101
107
  options,
@@ -152,12 +158,18 @@ class Entrypoint:
152
158
  parent_description,
153
159
  parent_name,
154
160
  )
155
- description = f'{GitLabFeature.Helper.capitalize(group.name)}' \
156
- f'{parent_description_text}'
157
- gitlab.group_set_description(criteria, description)
158
- print(f'{Colors.BOLD} - Updated description: '
159
- f'{Colors.CYAN}{description}'
160
- f'{Colors.RESET}')
161
+ if not parent_description_text or not group.description.endswith(
162
+ f'{parent_description_text}'):
163
+ description = f'{GitLabFeature.Helper.capitalize(group.name)}' \
164
+ f'{parent_description_text}'
165
+ gitlab.group_set_description(criteria, description)
166
+ print(f'{Colors.BOLD} - Updated description: '
167
+ f'{Colors.CYAN}{description}'
168
+ f'{Colors.RESET}')
169
+ else:
170
+ print(f'{Colors.BOLD} - Kept description: '
171
+ f'{Colors.GREEN}{group.description}'
172
+ f'{Colors.RESET}')
161
173
 
162
174
  # Reset group members
163
175
  if options.reset_members:
@@ -210,12 +222,17 @@ class Entrypoint:
210
222
  group.description,
211
223
  group.name,
212
224
  )
213
- description = f'{GitLabFeature.Helper.capitalize(project.name)}' \
214
- f' - {group_description}'
215
- gitlab.project_set_description(criteria, description)
216
- print(f'{Colors.BOLD} - Updated description: '
217
- f'{Colors.CYAN}{group_description}'
218
- f'{Colors.RESET}')
225
+ if not project.description.endswith(f' - {group_description}'):
226
+ description = f'{GitLabFeature.Helper.capitalize(project.name)}' \
227
+ f' - {group_description}'
228
+ gitlab.project_set_description(criteria, description)
229
+ print(f'{Colors.BOLD} - Updated description: '
230
+ f'{Colors.CYAN}{description}'
231
+ f'{Colors.RESET}')
232
+ else:
233
+ print(f'{Colors.BOLD} - Kept description: '
234
+ f'{Colors.GREEN}{project.description}'
235
+ f'{Colors.RESET}')
219
236
 
220
237
  # Reset project features
221
238
  if options.reset_features:
@@ -3,6 +3,7 @@
3
3
  # Standard libraries
4
4
  from argparse import (_ArgumentGroup, ArgumentParser, Namespace, RawTextHelpFormatter)
5
5
  from os import environ
6
+ from shutil import get_terminal_size
6
7
  from sys import exit as sys_exit
7
8
 
8
9
  # Components
@@ -27,6 +28,10 @@ def main() -> None:
27
28
  formatter_class=lambda prog: RawTextHelpFormatter(
28
29
  prog,
29
30
  max_help_position=30,
31
+ width=min(
32
+ 120,
33
+ get_terminal_size().columns - 2,
34
+ ),
30
35
  ),
31
36
  )
32
37