suite-py 1.49.0__py3-none-any.whl → 1.50.0__py3-none-any.whl
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.
- suite_py/__version__.py +1 -1
- suite_py/cli.py +7 -7
- suite_py/commands/create_branch.py +10 -10
- suite_py/commands/open_pr.py +5 -1
- suite_py/commands/release.py +10 -29
- suite_py/lib/config.py +2 -0
- {suite_py-1.49.0.dist-info → suite_py-1.50.0.dist-info}/METADATA +1 -1
- {suite_py-1.49.0.dist-info → suite_py-1.50.0.dist-info}/RECORD +10 -10
- {suite_py-1.49.0.dist-info → suite_py-1.50.0.dist-info}/WHEEL +0 -0
- {suite_py-1.49.0.dist-info → suite_py-1.50.0.dist-info}/entry_points.txt +0 -0
suite_py/__version__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
__version__ = "1.
|
|
2
|
+
__version__ = "1.50.0"
|
suite_py/cli.py
CHANGED
|
@@ -233,21 +233,21 @@ def bump(obj: Context, project: Optional[str] = None, version: Optional[str] = N
|
|
|
233
233
|
@main.command(
|
|
234
234
|
"create-branch", help="Create local branch and set the YouTrack card in progress"
|
|
235
235
|
)
|
|
236
|
-
@click.option("--card", type=click.STRING, help="YouTrack card number (ex. PRIMA-123)")
|
|
237
236
|
@click.option(
|
|
238
237
|
"--autostash",
|
|
239
238
|
is_flag=True,
|
|
240
239
|
help="Stash uncommitted changes before creating the branch and reapply them afterward",
|
|
241
240
|
)
|
|
242
241
|
@click.option(
|
|
243
|
-
"--
|
|
242
|
+
"--branch-name",
|
|
244
243
|
type=click.STRING,
|
|
245
|
-
help="
|
|
244
|
+
help="Branch name template. Supports {card_id}, {type}, {summary} placeholders (ex. '{card_id}/{type}/{summary}')",
|
|
246
245
|
)
|
|
246
|
+
@click.option("--card", type=click.STRING, help="YouTrack card ID (ex. PRIMA-4423)")
|
|
247
247
|
@click.option(
|
|
248
|
-
"--branch
|
|
248
|
+
"--parent-branch",
|
|
249
249
|
type=click.STRING,
|
|
250
|
-
help="
|
|
250
|
+
help="Parent branch to create the new branch from",
|
|
251
251
|
)
|
|
252
252
|
@click.pass_obj
|
|
253
253
|
@catch_exceptions
|
|
@@ -255,10 +255,10 @@ def cli_create_branch(obj, card, autostash, parent_branch, branch_name):
|
|
|
255
255
|
from suite_py.commands.create_branch import CreateBranch
|
|
256
256
|
|
|
257
257
|
obj.call(CreateBranch).run(
|
|
258
|
-
card_id=card,
|
|
259
258
|
autostash=autostash,
|
|
260
|
-
parent_branch=parent_branch,
|
|
261
259
|
branch_name=branch_name,
|
|
260
|
+
card_id=card,
|
|
261
|
+
parent_branch=parent_branch,
|
|
262
262
|
)
|
|
263
263
|
|
|
264
264
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import re
|
|
3
3
|
import sys
|
|
4
|
-
|
|
5
4
|
import requests
|
|
6
5
|
|
|
7
6
|
from suite_py.lib import logger, metrics
|
|
@@ -19,7 +18,7 @@ class CreateBranch:
|
|
|
19
18
|
):
|
|
20
19
|
self._config = config
|
|
21
20
|
self._git_handler = git_handler
|
|
22
|
-
self.
|
|
21
|
+
self._youtrack_handler = youtrack_handler
|
|
23
22
|
|
|
24
23
|
@metrics.command("create-branch")
|
|
25
24
|
def run(
|
|
@@ -41,9 +40,9 @@ class CreateBranch:
|
|
|
41
40
|
|
|
42
41
|
try:
|
|
43
42
|
if card_id:
|
|
44
|
-
issue = self.
|
|
43
|
+
issue = self._youtrack_handler.get_issue(card_id)
|
|
45
44
|
else:
|
|
46
|
-
issue = self.
|
|
45
|
+
issue = self._youtrack_handler.get_issue(self._ask_card_id())
|
|
47
46
|
except Exception:
|
|
48
47
|
logger.error(
|
|
49
48
|
"There was a problem retrieving the issue from YouTrack. Check that the issue number is correct"
|
|
@@ -52,11 +51,11 @@ class CreateBranch:
|
|
|
52
51
|
|
|
53
52
|
self._checkout_branch(issue, autostash, parent_branch, branch_name)
|
|
54
53
|
|
|
55
|
-
user = self.
|
|
56
|
-
self.
|
|
54
|
+
user = self._youtrack_handler.get_current_user()
|
|
55
|
+
self._youtrack_handler.assign_to(issue["id"], user["login"])
|
|
57
56
|
|
|
58
57
|
try:
|
|
59
|
-
self.
|
|
58
|
+
self._youtrack_handler.update_state(
|
|
60
59
|
issue["id"], self._config.youtrack["picked_state"]
|
|
61
60
|
)
|
|
62
61
|
except requests.exceptions.HTTPError:
|
|
@@ -87,7 +86,7 @@ class CreateBranch:
|
|
|
87
86
|
"Insert the YouTrack issue number:", self._config.user["default_slug"]
|
|
88
87
|
)
|
|
89
88
|
|
|
90
|
-
def
|
|
89
|
+
def _ask_card_id(self):
|
|
91
90
|
suggestions = self._get_card_suggestions()
|
|
92
91
|
user_choice = (
|
|
93
92
|
self._select_card(suggestions)
|
|
@@ -98,8 +97,9 @@ class CreateBranch:
|
|
|
98
97
|
|
|
99
98
|
def _get_card_suggestions(self):
|
|
100
99
|
try:
|
|
101
|
-
return self.
|
|
102
|
-
self._config.user["card_suggest_query"],
|
|
100
|
+
return self._youtrack_handler.search_issues(
|
|
101
|
+
self._config.user["card_suggest_query"],
|
|
102
|
+
self._config.user["card_suggestions_limit"],
|
|
103
103
|
)
|
|
104
104
|
except Exception:
|
|
105
105
|
logger.warning(
|
suite_py/commands/open_pr.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
2
|
import sys
|
|
3
|
+
from string import Template
|
|
3
4
|
|
|
4
5
|
from github import GithubException
|
|
5
6
|
|
|
@@ -77,7 +78,10 @@ class OpenPR:
|
|
|
77
78
|
|
|
78
79
|
default_title = self._youtrack.get_issue(youtrack_id)["summary"]
|
|
79
80
|
title_without_prefix = _ask_for_title(default_title)
|
|
80
|
-
|
|
81
|
+
|
|
82
|
+
title = Template(self._config.user["pr_title_template"]).substitute(
|
|
83
|
+
card_id=youtrack_id, title=title_without_prefix
|
|
84
|
+
)
|
|
81
85
|
else:
|
|
82
86
|
logger.warning(
|
|
83
87
|
f"Creating pull request on the {self._project} project for the {self._branch_name} branch NOT linked to YouTrack card"
|
suite_py/commands/release.py
CHANGED
|
@@ -149,8 +149,9 @@ class Release:
|
|
|
149
149
|
|
|
150
150
|
def build_choice(c, icon):
|
|
151
151
|
summary = c.commit.message.splitlines()[0]
|
|
152
|
+
author = c.commit.author.name
|
|
152
153
|
return {
|
|
153
|
-
"name": f"{icon} {c.sha[:8]} | {summary}",
|
|
154
|
+
"name": f"{icon} {c.sha[:8]} | {summary} by {author}",
|
|
154
155
|
"value": c.sha,
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -180,19 +181,11 @@ class Release:
|
|
|
180
181
|
|
|
181
182
|
Final exposed statuses (icons):
|
|
182
183
|
success (✅), failure (❌), in_progress (🏗️), cancelled (🚫), unknown (❓)
|
|
183
|
-
|
|
184
|
-
Everything else is folded into one of those buckets:
|
|
185
|
-
pending / queued / waiting -> in_progress
|
|
186
|
-
skipped / neutral -> unknown (unless at least one success present)
|
|
187
|
-
Preference order for determining state:
|
|
188
|
-
1. Check runs API
|
|
189
|
-
2. Combined status API
|
|
190
|
-
3. Fallback unknown
|
|
191
184
|
"""
|
|
192
185
|
check_runs = self._safe_get_check_runs(sha)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
186
|
+
if not check_runs:
|
|
187
|
+
return self._icon_for_state("unknown")
|
|
188
|
+
state = self._classify_from_check_runs(check_runs)
|
|
196
189
|
return self._icon_for_state(state)
|
|
197
190
|
|
|
198
191
|
def _safe_get_check_runs(self, sha):
|
|
@@ -235,25 +228,13 @@ class Release:
|
|
|
235
228
|
def _is_success(conclusions):
|
|
236
229
|
return bool(conclusions) and (
|
|
237
230
|
all(c == "success" for c in conclusions)
|
|
238
|
-
or (
|
|
231
|
+
or (
|
|
232
|
+
"success" in conclusions
|
|
233
|
+
and not Release._any_failure(conclusions)
|
|
234
|
+
and "cancelled" not in conclusions
|
|
235
|
+
)
|
|
239
236
|
)
|
|
240
237
|
|
|
241
|
-
def _classify_from_combined_status(self, sha):
|
|
242
|
-
try:
|
|
243
|
-
status = self._github.get_build_status(self._project, sha)
|
|
244
|
-
combined = (status.state or "unknown").lower()
|
|
245
|
-
except Exception:
|
|
246
|
-
combined = "unknown"
|
|
247
|
-
if combined in {"pending", "queued", "waiting", "in_progress"}:
|
|
248
|
-
return "in_progress"
|
|
249
|
-
if combined == "success":
|
|
250
|
-
return "success"
|
|
251
|
-
if combined == "failure":
|
|
252
|
-
return "failure"
|
|
253
|
-
if combined == "cancelled":
|
|
254
|
-
return "cancelled"
|
|
255
|
-
return "unknown"
|
|
256
|
-
|
|
257
238
|
@staticmethod
|
|
258
239
|
def _icon_for_state(state):
|
|
259
240
|
icon_mapping = {
|
suite_py/lib/config.py
CHANGED
|
@@ -36,11 +36,13 @@ class Config:
|
|
|
36
36
|
conf["user"].setdefault("default_slug", "PRIMA-XXX")
|
|
37
37
|
default_search = f"in:{conf['user']['default_slug'].split('-')[0]} #{{To Do}}"
|
|
38
38
|
conf["user"].setdefault("card_suggest_query", default_search)
|
|
39
|
+
conf["user"].setdefault("card_suggestions_limit", 5)
|
|
39
40
|
# This is in seconds
|
|
40
41
|
conf["user"].setdefault("captainhook_timeout", 30)
|
|
41
42
|
conf["user"].setdefault("captainhook_url", "https://captainhook.prima.it")
|
|
42
43
|
conf["user"].setdefault("use_commits_in_pr_body", False)
|
|
43
44
|
conf["user"].setdefault("frequent_reviewers_max_number", 5)
|
|
45
|
+
conf["user"].setdefault("pr_title_template", "[$card_id]: $title")
|
|
44
46
|
|
|
45
47
|
conf["youtrack"].setdefault("add_reviewers_tags", True)
|
|
46
48
|
conf["youtrack"].setdefault("default_issue_type", "Task")
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
suite_py/__init__.py,sha256=REmi3D0X2G1ZWnYpKs8Ffm3NIj-Hw6dMuvz2b9NW344,142
|
|
2
|
-
suite_py/__version__.py,sha256=
|
|
3
|
-
suite_py/cli.py,sha256=
|
|
2
|
+
suite_py/__version__.py,sha256=38W7jlGbYwxo07w_vLhpzv02ReQdpK1kDEMKK2DCpHA,49
|
|
3
|
+
suite_py/cli.py,sha256=wTV-d7Yq52JjkugxVCGCHM9Qsb3vKDv3VnTIJNJ162c,12579
|
|
4
4
|
suite_py/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
suite_py/commands/ask_review.py,sha256=yN__Ac-fiZBPShjRDhyCCQZGfVlQE16KozoJk4UtiNw,3788
|
|
6
6
|
suite_py/commands/bump.py,sha256=oFZU1hPfD11ujFC5G7wFyQOf2alY3xp2SO1h1ldjf3s,5406
|
|
7
7
|
suite_py/commands/check.py,sha256=jCX59g6DgTA55yD_75mgcqJ5zCjRwl_eIRGDeUFjUWY,3316
|
|
8
8
|
suite_py/commands/common.py,sha256=aWCEvO3hqdheuMUmZcHuc9EGZPQTk7VkzkHJk283MxQ,566
|
|
9
9
|
suite_py/commands/context.py,sha256=NAMZjJtTIi8xKIhdWEYNKwz0f4wUubW2eAj08gxRRbw,1267
|
|
10
|
-
suite_py/commands/create_branch.py,sha256=
|
|
10
|
+
suite_py/commands/create_branch.py,sha256=HuNA5DR-9d-yupBCljxYasElwxwlP3XI_UyairnfurU,5397
|
|
11
11
|
suite_py/commands/estimate_cone.py,sha256=_RekBWzPlzInlZRpSIeKUVkx-A8Phx0IEYVouTbN7z4,3411
|
|
12
12
|
suite_py/commands/login.py,sha256=A59e1HsbN7Ocv2L_2H0Eb7MZK7AzLkLb72QxBthnIqU,258
|
|
13
13
|
suite_py/commands/merge_pr.py,sha256=fXIE8mT9MjvvpqE-uVdXGBVFGhn0eQzcBxNr-N8SyAY,5171
|
|
14
|
-
suite_py/commands/open_pr.py,sha256=
|
|
14
|
+
suite_py/commands/open_pr.py,sha256=yys08FIHBbajmKTT6p_JWHu6Y9y2JKI43MKXQ-iIQ-A,7275
|
|
15
15
|
suite_py/commands/project_lock.py,sha256=b7OkGysue_Sl13VIT7B5CTBppCvrB_Q6iC0IJRBSHp8,1909
|
|
16
|
-
suite_py/commands/release.py,sha256=
|
|
16
|
+
suite_py/commands/release.py,sha256=_pH1YxrK-8M2vi7Bed0hGn53esTHQDQYKyquPDZ8RlI,14756
|
|
17
17
|
suite_py/commands/set_token.py,sha256=fehIqKjKhE-BJGFhgkPTo3Ntr0MvpgLd6EC5yjKuRs8,1508
|
|
18
18
|
suite_py/commands/status.py,sha256=0JUK53_d1-U3WNS742JD2QTiGmCGZONo3jJx8WR7q70,1122
|
|
19
19
|
suite_py/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
suite_py/lib/config.py,sha256=
|
|
20
|
+
suite_py/lib/config.py,sha256=x4tJxm7IjyEkBSybD8hxYfi365qbaIFsMaoBw6yJb6I,4043
|
|
21
21
|
suite_py/lib/handler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
suite_py/lib/handler/aws_handler.py,sha256=dRvRDicikfRbuFtCLPbevaX-yC-fO4LwXFdyqLPJ8OI,8815
|
|
23
23
|
suite_py/lib/handler/captainhook_handler.py,sha256=R30_Vvh2ck7fM5fwbpm3UV_FtlQr2xnx6RJpkG1Gn14,2983
|
|
@@ -40,7 +40,7 @@ suite_py/lib/requests/session.py,sha256=P32H3cWnCWunu91WIj2iDM5U3HzaBglg60VN_C9J
|
|
|
40
40
|
suite_py/lib/symbol.py,sha256=z3QYBuNIwD3qQ3zF-cLOomIr_-C3bO_u5UIDAHMiyTo,60
|
|
41
41
|
suite_py/lib/tokens.py,sha256=4DbsHDFLIxs40t3mRw_ZyhmejZQ0Bht7iAL8dTCTQd4,5458
|
|
42
42
|
suite_py/templates/login.html,sha256=fJLls2SB84oZTSrxTdA5q1PqfvIHcCD4fhVWfyco7Ig,861
|
|
43
|
-
suite_py-1.
|
|
44
|
-
suite_py-1.
|
|
45
|
-
suite_py-1.
|
|
46
|
-
suite_py-1.
|
|
43
|
+
suite_py-1.50.0.dist-info/METADATA,sha256=E2McUnkrL3Q3OC1hP4rrm2h8NMBdWqPKTUuKdmFZya8,1250
|
|
44
|
+
suite_py-1.50.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
45
|
+
suite_py-1.50.0.dist-info/entry_points.txt,sha256=dVKLC-9Infy-dHJT_MkK6LcDjOgBCJ8lfPkURJhBjxE,46
|
|
46
|
+
suite_py-1.50.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|