ultralytics-actions 0.0.95__py3-none-any.whl → 0.0.97__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.
actions/__init__.py CHANGED
@@ -22,4 +22,4 @@
22
22
  # ├── test_summarize_pr.py
23
23
  # └── ...
24
24
 
25
- __version__ = "0.0.95"
25
+ __version__ = "0.0.97"
@@ -1,8 +1,9 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import time
4
6
  from datetime import datetime
5
- from typing import Dict, List
6
7
 
7
8
  from .utils import GITHUB_API_URL, Action
8
9
 
@@ -18,7 +19,7 @@ def get_pr_branch(event) -> str:
18
19
  return pr_data.get("head", {}).get("ref", "main")
19
20
 
20
21
 
21
- def trigger_and_get_workflow_info(event, branch: str) -> List[Dict]:
22
+ def trigger_and_get_workflow_info(event, branch: str) -> list[dict]:
22
23
  """Triggers workflows and returns their information."""
23
24
  repo = event.repository
24
25
  results = []
@@ -47,8 +48,7 @@ def trigger_and_get_workflow_info(event, branch: str) -> List[Dict]:
47
48
  )
48
49
 
49
50
  if runs_response.status_code == 200:
50
- runs = runs_response.json().get("workflow_runs", [])
51
- if runs:
51
+ if runs := runs_response.json().get("workflow_runs", []):
52
52
  run_url = runs[0].get("html_url", run_url)
53
53
  run_number = runs[0].get("run_number")
54
54
 
@@ -57,7 +57,7 @@ def trigger_and_get_workflow_info(event, branch: str) -> List[Dict]:
57
57
  return results
58
58
 
59
59
 
60
- def update_comment(event, comment_body: str, triggered_actions: List[Dict], branch: str) -> bool:
60
+ def update_comment(event, comment_body: str, triggered_actions: list[dict], branch: str) -> bool:
61
61
  """Updates the comment with workflow information."""
62
62
  if not triggered_actions:
63
63
  return False
@@ -1,7 +1,8 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
- from typing import Dict, List, Tuple
5
6
 
6
7
  from .utils import GITHUB_API_URL, Action, get_completion, remove_html_comments
7
8
 
@@ -9,7 +10,7 @@ from .utils import GITHUB_API_URL, Action, get_completion, remove_html_comments
9
10
  BLOCK_USER = os.getenv("BLOCK_USER", "false").lower() == "true"
10
11
 
11
12
 
12
- def get_event_content(event) -> Tuple[int, str, str, str, str, str, str]:
13
+ def get_event_content(event) -> tuple[int, str, str, str, str, str, str]:
13
14
  """Extracts key information from GitHub event data for issues, pull requests, or discussions."""
14
15
  data = event.event_data
15
16
  name = event.event_name
@@ -108,8 +109,8 @@ def block_user(event, username: str):
108
109
 
109
110
 
110
111
  def get_relevant_labels(
111
- issue_type: str, title: str, body: str, available_labels: Dict, current_labels: List
112
- ) -> List[str]:
112
+ issue_type: str, title: str, body: str, available_labels: dict, current_labels: list
113
+ ) -> list[str]:
113
114
  """Determines relevant labels for GitHub issues/PRs using OpenAI, considering title, body, and existing labels."""
114
115
  # Remove mutually exclusive labels like both 'bug' and 'question' or inappropriate labels like 'help wanted'
115
116
  for label in {
@@ -178,7 +179,7 @@ YOUR RESPONSE (label names only):
178
179
  ]
179
180
 
180
181
 
181
- def get_label_ids(event, labels: List[str]) -> List[str]:
182
+ def get_label_ids(event, labels: list[str]) -> list[str]:
182
183
  """Retrieves GitHub label IDs for a list of label names using the GraphQL API."""
183
184
  query = """
184
185
  query($owner: String!, $name: String!) {
@@ -202,7 +203,7 @@ query($owner: String!, $name: String!) {
202
203
  return []
203
204
 
204
205
 
205
- def apply_labels(event, number: int, node_id: str, labels: List[str], issue_type: str):
206
+ def apply_labels(event, number: int, node_id: str, labels: list[str], issue_type: str):
206
207
  """Applies specified labels to a GitHub issue, pull request, or discussion using the appropriate API."""
207
208
  if "Alert" in labels:
208
209
  create_alert_label(event)
actions/summarize_pr.py CHANGED
@@ -1,5 +1,7 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import time
4
6
 
5
7
  from .utils import GITHUB_API_URL, GITHUB_GRAPHQL_URL, Action, get_completion
@@ -1,5 +1,7 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  import re
5
7
  import subprocess
@@ -1,5 +1,7 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  from pathlib import Path
5
7
 
@@ -1,5 +1,7 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import hashlib
4
6
  import re
5
7
  import shutil
@@ -1,5 +1,7 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  import re
5
7
  import time
@@ -148,8 +150,8 @@ def allow_redirect(start="", end=""):
148
150
  return (
149
151
  end
150
152
  and end.startswith("https://")
151
- and not any(item in end_lower for item in REDIRECT_END_IGNORE_LIST)
152
- and not any(item in start_lower for item in REDIRECT_START_IGNORE_LIST)
153
+ and all(item not in end_lower for item in REDIRECT_END_IGNORE_LIST)
154
+ and all(item not in start_lower for item in REDIRECT_START_IGNORE_LIST)
153
155
  )
154
156
 
155
157
 
@@ -241,11 +243,10 @@ def check_links_in_string(text, verbose=True, return_bad=False, replace=False):
241
243
  if not valid and brave_api_key:
242
244
  query = f"{(redirect or url)[:200]} {title[:199]}"
243
245
  if search_urls := brave_search(query, brave_api_key, count=3):
244
- best_url = search_urls[0]
245
- for alt_url in search_urls:
246
- if is_url(alt_url, session):
247
- best_url = alt_url
248
- break
246
+ best_url = next(
247
+ (alt_url for alt_url in search_urls if is_url(alt_url, session)),
248
+ search_urls[0],
249
+ )
249
250
  if url != best_url:
250
251
  replacements[url] = best_url
251
252
  modified_text = modified_text.replace(url, best_url)
@@ -1,9 +1,10 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import json
4
6
  import os
5
7
  from pathlib import Path
6
- from typing import Union
7
8
 
8
9
  import requests
9
10
 
@@ -96,7 +97,7 @@ class Action:
96
97
  """Checks if the repository is public using event data or GitHub API if needed."""
97
98
  return self.event_data.get("repository", {}).get("private")
98
99
 
99
- def get_username(self) -> Union[str, None]:
100
+ def get_username(self) -> str | None:
100
101
  """Gets username associated with the GitHub token."""
101
102
  response = self.post(GITHUB_GRAPHQL_URL, json={"query": "query { viewer { login } }"})
102
103
  if response.status_code == 200:
@@ -1,8 +1,9 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  import time
5
- from typing import Dict, List
6
7
 
7
8
  import requests
8
9
 
@@ -10,11 +11,11 @@ from actions.utils.common_utils import check_links_in_string
10
11
 
11
12
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
12
13
  OPENAI_MODEL = os.getenv("OPENAI_MODEL", "gpt-5-2025-08-07")
13
- SYSTEM_PROMPT_ADDITION = """
14
- Guidance:
15
- - Ultralytics Branding: Use YOLO11, YOLO12, etc., not YOLOv11, YOLOv12 (only older versions like YOLOv10 have a v). Always capitalize "HUB" in "Ultralytics HUB"; use "Ultralytics HUB", not "The Ultralytics HUB".
14
+ SYSTEM_PROMPT_ADDITION = """Guidance:
15
+ - Ultralytics Branding: Use YOLO11, YOLO26, etc., not YOLOv11, YOLOv26 (only older versions like YOLOv10 have a v). Always capitalize "HUB" in "Ultralytics HUB"; use "Ultralytics HUB", not "The Ultralytics HUB".
16
16
  - Avoid Equations: Do not include equations or mathematical notations.
17
- - Links: Use descriptive anchor text like "See the [Ultralytics Docs](https://docs.ultralytics.com) for details."
17
+ - Markdown: Reply in Markdown format.
18
+ - Links: Use descriptive anchor text for all URLs.
18
19
  - Code:
19
20
  - Provide minimal code examples if helpful.
20
21
  - Enclose code in backticks: `pip install ultralytics` for inline code or e.g. ```python for larger code blocks.
@@ -34,9 +35,9 @@ def remove_outer_codeblocks(string):
34
35
 
35
36
 
36
37
  def get_completion(
37
- messages: List[Dict[str, str]],
38
+ messages: list[dict[str, str]],
38
39
  check_links: bool = True,
39
- remove: List[str] = (" @giscus[bot]",), # strings to remove from response
40
+ remove: list[str] = (" @giscus[bot]",), # strings to remove from response
40
41
  temperature: float = 1.0, # note GPT-5 requires temperature=1.0
41
42
  reasoning_effort: str = None, # reasoning effort for GPT-5 models: minimal, low, medium, high
42
43
  ) -> str:
@@ -3,6 +3,8 @@
3
3
  # from actions.utils.version_utils import check_pypi_version
4
4
  # check_pypi_version()
5
5
 
6
+ from __future__ import annotations
7
+
6
8
  import re
7
9
  from pathlib import Path
8
10
 
@@ -13,7 +15,7 @@ def should_publish(local_version, remote_version):
13
15
  """Determine if version should be published based on semver rules."""
14
16
  if remote_version:
15
17
  local_ver, remote_ver = [tuple(map(int, v.split("."))) for v in [local_version, remote_version]]
16
- major_diff, minor_diff, patch_diff = [l - r for l, r in zip(local_ver, remote_ver)]
18
+ major_diff, minor_diff, patch_diff = [local - remote for local, remote in zip(local_ver, remote_ver)]
17
19
  return (
18
20
  (major_diff == 0 and minor_diff == 0 and 0 < patch_diff <= 2) # patch diff <=2
19
21
  or (major_diff == 0 and minor_diff == 1 and local_ver[2] == 0) # new minor version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-actions
3
- Version: 0.0.95
3
+ Version: 0.0.97
4
4
  Summary: Ultralytics Actions for GitHub automation and PR management.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -47,8 +47,6 @@ Welcome to the [Ultralytics Actions](https://github.com/ultralytics/actions) rep
47
47
  [![Actions CI](https://github.com/ultralytics/actions/actions/workflows/ci.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/ci.yml)
48
48
  [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml)
49
49
  [![codecov](https://codecov.io/github/ultralytics/actions/graph/badge.svg?token=DoizJ1WS6j)](https://codecov.io/github/ultralytics/actions)
50
- [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions)
51
- [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://clickpy.clickhouse.com/dashboard/ultralytics-actions)
52
50
 
53
51
  [![Ultralytics Discord](https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue)](https://discord.com/invite/ultralytics)
54
52
  [![Ultralytics Forums](https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue)](https://community.ultralytics.com/)
@@ -130,6 +128,18 @@ To integrate this action into your Ultralytics repository:
130
128
 
131
129
  3. **Customize:** Adjust the `runs-on` runner and the boolean flags (`labels`, `python`, `prettier`, `swift`, `spelling`, `links`, `summary`) based on your project's needs. Remember to add your `OPENAI_API_KEY` as a secret in your repository settings if you enable `labels` or `summary`.
132
130
 
131
+ ## Python Package
132
+
133
+ Install the `ultralytics-actions` Python package directly with Pip:
134
+
135
+ [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics-actions?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics-actions/)
136
+ [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://clickpy.clickhouse.com/dashboard/ultralytics-actions)
137
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics-actions?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics-actions/)
138
+
139
+ ```sh
140
+ pip install ultralytics-actions
141
+ ```
142
+
133
143
  ## 💡 Contribute
134
144
 
135
145
  Ultralytics thrives on community collaboration, and we deeply value your contributions! Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) for details on how you can get involved. We also encourage you to share your feedback through our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A huge thank you 🙏 to all our contributors!
@@ -0,0 +1,18 @@
1
+ actions/__init__.py,sha256=m-xlbF9MP9tiWkYZjQBFQLvlHmZhPYVXByKQFii_JZo,742
2
+ actions/dispatch_actions.py,sha256=RPqjsnH_8932oLaPp9wWRCWKTaMp8M9dn6CIAMtNjN0,4230
3
+ actions/first_interaction.py,sha256=bPG_BMp_k-iJbeQ-fI1bTRHxnfo86ZdIhb0wytBGXVo,16511
4
+ actions/summarize_pr.py,sha256=2qDkSlonQGytJXcthsggPE-AKu2xhtcsWwIaBgkSmAk,10499
5
+ actions/summarize_release.py,sha256=1MQ7Cefv4GTRxr10LwX4b6CFyYZNLNrbCzUKlokUoKE,8671
6
+ actions/update_file_headers.py,sha256=E5fKYLdeW16-BHCcuqxohGpGZqgEh-WX4ZmCQJw2R90,6684
7
+ actions/update_markdown_code_blocks.py,sha256=EdIlRd4s903U7Q0J1yI0Z6Wk0ldJbQF43XpJZ4qhyWI,8623
8
+ actions/utils/__init__.py,sha256=7k4cmFX0Td99Uzgsd8Mm-E0xq5kQ5ZJoPM_oGCVD4CU,804
9
+ actions/utils/common_utils.py,sha256=8ZmgaXZU3J2sg-HSaldp3hHYq7bI3akcJHdIXPmcNAo,11908
10
+ actions/utils/github_utils.py,sha256=NJYfZzpagt5LK-Rwt6tqdTq7DZRGhclKLHHd-N2zkfk,8207
11
+ actions/utils/openai_utils.py,sha256=XqKfJHeua-F5NTRvJnqUCftjO3fnav2UCyc8_mRZb3Y,3954
12
+ actions/utils/version_utils.py,sha256=EIbm3iZVNyNl3dh8aNz_9ITeTC93ZxfyUzIRkO3tSXw,3242
13
+ ultralytics_actions-0.0.97.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
14
+ ultralytics_actions-0.0.97.dist-info/METADATA,sha256=cruP3iFtd7mF4G4abaJNwbxmiyTJZ2wX7m70LjEcDA8,11973
15
+ ultralytics_actions-0.0.97.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ ultralytics_actions-0.0.97.dist-info/entry_points.txt,sha256=rvqr6Juj7lCJL1DQLwMmOrA8R2Q8tyR_dvCe0mYuJ8s,441
17
+ ultralytics_actions-0.0.97.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
18
+ ultralytics_actions-0.0.97.dist-info/RECORD,,
@@ -1,18 +0,0 @@
1
- actions/__init__.py,sha256=MOBMAwhddkI1HSm42aRYcHo3ho0zUnyrkDLA2kPce3I,742
2
- actions/dispatch_actions.py,sha256=vbA4w_B8vMXMen__ck2WoDsUFCELjXOQbpLzZCmqTXg,4240
3
- actions/first_interaction.py,sha256=EL131PalWKwzLhNKqL07zqI8Qsoydv1UyUyyt2EvnRg,16512
4
- actions/summarize_pr.py,sha256=K7Kf22AspUY10GtLUK8DhKgXz2yEDIE3BjpLgPn6niQ,10463
5
- actions/summarize_release.py,sha256=BM2kcnqGp16n-6uSdGKjKhrbqJLtkvbHqOIZFFs7nmY,8635
6
- actions/update_file_headers.py,sha256=dAu8RWOn-CkuFZHa5LT1-BvNxYX4FRQe2B1UDAjvG3I,6648
7
- actions/update_markdown_code_blocks.py,sha256=9PL7YIQfApRNAa0que2hYHv7umGZTZoHlblesB0xFj4,8587
8
- actions/utils/__init__.py,sha256=7k4cmFX0Td99Uzgsd8Mm-E0xq5kQ5ZJoPM_oGCVD4CU,804
9
- actions/utils/common_utils.py,sha256=AFbpKUxneB4Qa8wYZaRuJ1W3dBBaMVO7mjpc-b7QWKc,11915
10
- actions/utils/github_utils.py,sha256=wjivM9FPZwaItXpQiYbGbnGdK6v4ayLEFvQT2xhRLq4,8202
11
- actions/utils/openai_utils.py,sha256=IDKZVchLmcGXfAvRyTozcjr9icuUktB-24PMR7VRcSA,3972
12
- actions/utils/version_utils.py,sha256=lKY2lLtYdxejKvqD9hFJiARMrYMHnP_KC_zmcLUmD20,3188
13
- ultralytics_actions-0.0.95.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
14
- ultralytics_actions-0.0.95.dist-info/METADATA,sha256=ACjeoXZ-oPba1bGkEQ-ruaGf-Jombn9kbWIj041buLo,11638
15
- ultralytics_actions-0.0.95.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- ultralytics_actions-0.0.95.dist-info/entry_points.txt,sha256=rvqr6Juj7lCJL1DQLwMmOrA8R2Q8tyR_dvCe0mYuJ8s,441
17
- ultralytics_actions-0.0.95.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
18
- ultralytics_actions-0.0.95.dist-info/RECORD,,