ultralytics-actions 0.0.57__py3-none-any.whl → 0.0.59__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.57"
25
+ __version__ = "0.0.59"
@@ -219,4 +219,4 @@ def main(root_dir=Path.cwd(), process_python=True, process_bash=True, verbose=Fa
219
219
 
220
220
 
221
221
  if __name__ == "__main__":
222
- main(process_python=True, process_bash=False)
222
+ main(process_python=True, process_bash=True)
@@ -1,5 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ import os
3
4
  import re
4
5
  import time
5
6
  from concurrent.futures import ThreadPoolExecutor
@@ -7,6 +8,7 @@ from urllib import parse
7
8
 
8
9
  import requests
9
10
 
11
+ BRAVE_API_KEY = os.getenv("BRAVE_API_KEY")
10
12
  REQUESTS_HEADERS = {
11
13
  "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
12
14
  "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
@@ -24,6 +26,7 @@ REQUESTS_HEADERS = {
24
26
  }
25
27
  BAD_HTTP_CODES = frozenset(
26
28
  {
29
+ # 204, # No content
27
30
  # 403, # Forbidden - client lacks permission to access the resource (commented as works in browser typically)
28
31
  404, # Not Found - requested resource doesn't exist
29
32
  405, # Method Not Allowed - HTTP method not supported for this endpoint
@@ -32,6 +35,7 @@ BAD_HTTP_CODES = frozenset(
32
35
  502, # Bad Gateway - upstream server sent invalid response
33
36
  503, # Service Unavailable - server temporarily unable to handle request
34
37
  504, # Gateway Timeout - upstream server didn't respond in time
38
+ 525, # Cloudfare handshake error
35
39
  }
36
40
  )
37
41
  URL_IGNORE_LIST = { # use a set (not frozenset) to update with possible private GitHub repos
@@ -52,6 +56,8 @@ URL_IGNORE_LIST = { # use a set (not frozenset) to update with possible private
52
56
  "x.com",
53
57
  "storage.googleapis.com", # private GCS buckets
54
58
  "{", # possible Python fstring
59
+ "(", # breaks pattern matches
60
+ "api", # ignore api endpoints
55
61
  }
56
62
  URL_PATTERN = re.compile(
57
63
  r"\[([^]]+)]\(([^)]+)\)" # Matches Markdown links [text](url)
@@ -78,6 +84,16 @@ def clean_url(url):
78
84
  return url
79
85
 
80
86
 
87
+ def brave_search(query, api_key, count=5):
88
+ """Search for alternative URLs using Brave Search API."""
89
+ headers = {"X-Subscription-Token": api_key, "Accept": "application/json"}
90
+ url = f"https://api.search.brave.com/res/v1/web/search?q={parse.quote(query)}&count={count}"
91
+ response = requests.get(url, headers=headers)
92
+ data = response.json() if response.status_code == 200 else {}
93
+ results = data.get("web", {}).get("results", []) if data else []
94
+ return [result.get("url") for result in results if result.get("url")]
95
+
96
+
81
97
  def is_url(url, session=None, check=True, max_attempts=3, timeout=2):
82
98
  """Check if string is URL and optionally verify it exists, with fallback for GitHub repos."""
83
99
  try:
@@ -101,7 +117,8 @@ def is_url(url, session=None, check=True, max_attempts=3, timeout=2):
101
117
  try:
102
118
  # Try HEAD first, then GET if needed
103
119
  for method in (requester.head, requester.get):
104
- if method(url, stream=method == requester.get, **kwargs).status_code not in BAD_HTTP_CODES:
120
+ status_code = method(url, stream=method == requester.get, **kwargs).status_code
121
+ if status_code not in BAD_HTTP_CODES:
105
122
  return True
106
123
 
107
124
  # If GitHub and check fails (repo might be private), add the base GitHub URL to ignore list
@@ -124,23 +141,50 @@ def is_url(url, session=None, check=True, max_attempts=3, timeout=2):
124
141
  return False
125
142
 
126
143
 
127
- def check_links_in_string(text, verbose=True, return_bad=False):
144
+ def check_links_in_string(text, verbose=True, return_bad=False, replace=False):
128
145
  """Process a given text, find unique URLs within it, and check for any 404 errors."""
129
146
  all_urls = []
130
147
  for md_text, md_url, plain_url in URL_PATTERN.findall(text):
131
148
  url = md_url or plain_url
132
149
  if url and parse.urlparse(url).scheme:
133
- all_urls.append(url)
150
+ all_urls.append((md_text, url, md_url != ""))
151
+
152
+ urls = [(t, clean_url(u), is_md) for t, u, is_md in all_urls] # clean URLs
134
153
 
135
- urls = set(map(clean_url, all_urls)) # remove extra characters and make unique
136
154
  with requests.Session() as session, ThreadPoolExecutor(max_workers=16) as executor:
137
155
  session.headers.update(REQUESTS_HEADERS)
138
- bad_urls = [url for url, valid in zip(urls, executor.map(lambda x: not is_url(x, session), urls)) if valid]
156
+ valid_results = list(executor.map(lambda x: is_url(x[1], session), urls))
157
+ bad_urls = [url for (_, url, _), valid in zip(urls, valid_results) if not valid]
158
+
159
+ if replace and bad_urls and BRAVE_API_KEY:
160
+ replacements = {}
161
+ modified_text = text
162
+
163
+ for (title, url, is_md), valid in zip(urls, valid_results):
164
+ if not valid:
165
+ alternative_urls = brave_search(f"{title} {url}", BRAVE_API_KEY, count=3)
166
+ if alternative_urls:
167
+ # Try each alternative URL until we find one that works
168
+ for alt_url in alternative_urls:
169
+ if is_url(alt_url, session):
170
+ break
171
+ replacements[url] = alt_url
172
+ modified_text = modified_text.replace(url, alt_url)
173
+
174
+ if verbose and replacements:
175
+ print(
176
+ f"WARNING ⚠️ replaced {len(replacements)} broken links:\n"
177
+ + "\n".join(f" {k}: {v}" for k, v in replacements.items())
178
+ )
179
+ if replacements:
180
+ return (True, [], modified_text) if return_bad else modified_text
139
181
 
140
182
  passing = not bad_urls
141
183
  if verbose and not passing:
142
184
  print(f"WARNING ⚠️ errors found in URLs {bad_urls}")
143
185
 
186
+ if replace:
187
+ return (passing, bad_urls, text) if return_bad else text
144
188
  return (passing, bad_urls) if return_bad else passing
145
189
 
146
190
 
@@ -150,3 +194,4 @@ if __name__ == "__main__":
150
194
 
151
195
  print(f"is_url(): {is_url(url)}")
152
196
  print(f"check_links_in_string(): {check_links_in_string(string)}")
197
+ print(f"check_links_in_string() with replace: {check_links_in_string(string, replace=True)}")
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: ultralytics-actions
3
+ Version: 0.0.59
4
+ Summary: Ultralytics Actions for GitHub automation and PR management.
5
+ Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>
6
+ Maintainer-email: Ultralytics <hello@ultralytics.com>
7
+ License: AGPL-3.0
8
+ Project-URL: Homepage, https://ultralytics.com
9
+ Project-URL: Source, https://github.com/ultralytics/actions
10
+ Project-URL: Documentation, https://docs.ultralytics.com
11
+ Project-URL: Bug Reports, https://github.com/ultralytics/actions/issues
12
+ Project-URL: Changelog, https://github.com/ultralytics/actions/releases
13
+ Keywords: github-actions,ci-cd,workflow-automation,pull-request-automation,code-review,release-automation,markdown-processing,devops,github-integration,continuous-integration
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Topic :: Internet :: WWW/HTTP
27
+ Classifier: Operating System :: OS Independent
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: requests>=2.32.3
32
+ Requires-Dist: ruff>=0.9.1
33
+ Requires-Dist: docformatter>=1.7.5
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ <a href="https://www.ultralytics.com/"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
39
+
40
+ # 🚀 Ultralytics Actions: Auto-Formatting for Python, Markdown, and Swift
41
+
42
+ Welcome to the [Ultralytics Actions](https://github.com/ultralytics/actions) repository, your go-to solution for maintaining consistent code quality across Ultralytics Python and Swift projects. This GitHub Action is designed to automate the formatting of Python, Markdown, and Swift files, ensuring adherence to our coding standards and enhancing project maintainability.
43
+
44
+ [![GitHub Actions Marketplace](https://img.shields.io/badge/Marketplace-Ultralytics_Actions-blue?style=flat&logo=github)](https://github.com/marketplace/actions/ultralytics-actions)
45
+ [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml)
46
+ [![Ultralytics Discord](https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue)](https://discord.com/invite/ultralytics)
47
+ [![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/)
48
+ [![Ultralytics Reddit](https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue)](https://reddit.com/r/ultralytics)
49
+ [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions)
50
+ [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://www.pepy.tech/projects/ultralytics-actions)
51
+
52
+ ## 📄 Actions Description
53
+
54
+ Ultralytics Actions automatically applies formats, updates, and enhancements using a suite of powerful tools:
55
+
56
+ - **Python Code:** Formatted using [Ruff](https://github.com/astral-sh/ruff), an extremely fast Python linter and formatter.
57
+ - **Markdown Files:** Styled with [Prettier](https://github.com/prettier/prettier) to ensure consistent documentation appearance.
58
+ - **Docstrings:** Cleaned and standardized using [docformatter](https://github.com/PyCQA/docformatter).
59
+ - **Swift Code:** Formatted with [`swift-format`](https://github.com/swiftlang/swift-format) to maintain a uniform coding style across Swift projects. _(Note: Requires the `macos-latest` runner.)_
60
+ - **Spell Check:** Common misspellings are caught using [codespell](https://github.com/codespell-project/codespell).
61
+ - **Broken Links Check:** Broken links in documentation and Markdown files are identified using [Lychee](https://github.com/lycheeverse/lychee).
62
+ - **PR Summary:** Concise Pull Request summaries are generated using [OpenAI](https://openai.com/) GPT-4o, improving clarity and review efficiency.
63
+ - **Auto-labeling:** Relevant labels are applied to issues and pull requests via [OpenAI](https://openai.com/) GPT-4o for intelligent categorization.
64
+
65
+ ## 🛠️ How It Works
66
+
67
+ Ultralytics Actions triggers on various GitHub events to streamline workflows:
68
+
69
+ - **Push Events:** Automatically formats code when changes are pushed to the `main` branch.
70
+ - **Pull Requests:**
71
+ - Ensures contributions meet formatting standards before merging.
72
+ - Generates a concise summary of changes using GPT-4o.
73
+ - Applies relevant labels using GPT-4o for intelligent categorization.
74
+ - **Issues:** Automatically applies relevant labels using GPT-4o when new issues are created.
75
+
76
+ These automated actions help maintain high code quality, improve documentation clarity, and streamline the review process by providing consistent formatting, informative summaries, and appropriate categorization.
77
+
78
+ ## 🔧 Setting Up the Action
79
+
80
+ To integrate this action into your Ultralytics repository:
81
+
82
+ 1. **Create a Workflow File:** In your repository, create a YAML file under `.github/workflows/`, for example, `ultralytics-actions.yml`.
83
+
84
+ 2. **Add the Action:** Configure the Ultralytics Actions in your workflow file as shown below:
85
+
86
+ ```yaml
87
+ name: Ultralytics Actions
88
+
89
+ on:
90
+ issues:
91
+ types: [opened]
92
+ pull_request:
93
+ branches: [main]
94
+ types: [opened, closed]
95
+
96
+ jobs:
97
+ format:
98
+ runs-on: ubuntu-latest # Use 'macos-latest' if 'swift: true'
99
+ steps:
100
+ - name: Run Ultralytics Formatting
101
+ uses: ultralytics/actions@main
102
+ with:
103
+ token: ${{ secrets.GITHUB_TOKEN }} # Automatically generated, do not modify
104
+ labels: true # Autolabel issues and PRs using GPT-4o (requires 'openai_api_key')
105
+ python: true # Format Python code and docstrings with Ruff and docformatter
106
+ prettier: true # Format YAML, JSON, Markdown, and CSS with Prettier
107
+ swift: false # Format Swift code with swift-format (requires 'runs-on: macos-latest')
108
+ spelling: true # Check spelling with codespell
109
+ links: true # Check for broken links with Lychee
110
+ summary: true # Generate PR summary with GPT-4o (requires 'openai_api_key')
111
+ openai_api_key: ${{ secrets.OPENAI_API_KEY }} # Add your OpenAI API key as a repository secret
112
+ ```
113
+
114
+ 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`.
115
+
116
+ ## 💡 Contribute
117
+
118
+ 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!
119
+
120
+ [![Ultralytics open-source contributors](https://raw.githubusercontent.com/ultralytics/assets/main/im/image-contributors.png)](https://github.com/ultralytics/ultralytics/graphs/contributors)
121
+
122
+ ## 📄 License
123
+
124
+ Ultralytics offers two licensing options:
125
+
126
+ - **AGPL-3.0 License**: An [OSI-approved](https://opensource.org/license/agpl-v3) open-source license ideal for students, researchers, and enthusiasts who value open collaboration. See the [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) file for details.
127
+ - **Enterprise License**: Designed for commercial use, this license allows integrating Ultralytics software and AI models into commercial products without AGPL-3.0's open-source requirements. For enterprise solutions, contact [Ultralytics Licensing](https://www.ultralytics.com/license).
128
+
129
+ ## 📫 Contact
130
+
131
+ For bug reports or feature suggestions related to Ultralytics Actions, please submit an issue via [GitHub Issues](https://github.com/ultralytics/actions/issues). Join our [Discord](https://discord.com/invite/ultralytics) community for discussions and support!
132
+
133
+ <br>
134
+ <div align="center">
135
+ <a href="https://github.com/ultralytics"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
136
+ <img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-transparent.png" width="3%" alt="space">
137
+ <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
138
+ <img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-transparent.png" width="3%" alt="space">
139
+ <a href="https://twitter.com/ultralytics"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
140
+ <img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-transparent.png" width="3%" alt="space">
141
+ <a href="https://youtube.com/ultralytics"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
142
+ <img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-transparent.png" width="3%" alt="space">
143
+ <a href="https://www.tiktok.com/@ultralytics"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
144
+ <img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-transparent.png" width="3%" alt="space">
145
+ <a href="https://ultralytics.com/bilibili"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
146
+ <img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-transparent.png" width="3%" alt="space">
147
+ <a href="https://discord.com/invite/ultralytics"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
148
+ </div>
@@ -0,0 +1,15 @@
1
+ actions/__init__.py,sha256=RivsSzZZVLYTkIVSK4dsOzKSKmmIsMsFi-5_WJnRZzM,742
2
+ actions/first_interaction.py,sha256=1_WvQHCi5RWaSfyi49ClF2Zk_3CKGjFnZqz6FlxPRAc,17868
3
+ actions/summarize_pr.py,sha256=BKttOq-MGaanVaChLU5B1ewKUA8K6S05Cy3FQtyRmxU,11681
4
+ actions/summarize_release.py,sha256=tov6qsYGC68lfobvkwVyoWZBGtJ598G0m097n4Ydzvo,8472
5
+ actions/update_markdown_code_blocks.py,sha256=9PL7YIQfApRNAa0que2hYHv7umGZTZoHlblesB0xFj4,8587
6
+ actions/utils/__init__.py,sha256=WStdEAYROVnF0nubEOmrFLrejkRiMXIefA5O1ckfcFs,476
7
+ actions/utils/common_utils.py,sha256=K7um3mHwx0sWAWfnEcDqfRs_x0Kr1mBhPuKbUfl1tWw,8150
8
+ actions/utils/github_utils.py,sha256=-F--JgxtXE0fSPMFEzakz7iZilp-vonzLiyXfg0b17Y,7117
9
+ actions/utils/openai_utils.py,sha256=qQbmrJpOUANxSMf7inDSgPIwgf0JHD1fWZuab-y2W6g,2942
10
+ ultralytics_actions-0.0.59.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
+ ultralytics_actions-0.0.59.dist-info/METADATA,sha256=D2M-beZpJYd0gC27E_d-iriL8zfb-YUkMFzydowf9rc,10923
12
+ ultralytics_actions-0.0.59.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
13
+ ultralytics_actions-0.0.59.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
+ ultralytics_actions-0.0.59.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
+ ultralytics_actions-0.0.59.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,145 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ultralytics-actions
3
- Version: 0.0.57
4
- Summary: Ultralytics Actions for GitHub automation and PR management.
5
- Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>
6
- Maintainer-email: Ultralytics <hello@ultralytics.com>
7
- License: AGPL-3.0
8
- Project-URL: Homepage, https://ultralytics.com
9
- Project-URL: Source, https://github.com/ultralytics/actions
10
- Project-URL: Documentation, https://docs.ultralytics.com
11
- Project-URL: Bug Reports, https://github.com/ultralytics/actions/issues
12
- Project-URL: Changelog, https://github.com/ultralytics/actions/releases
13
- Keywords: github-actions,ci-cd,workflow-automation,pull-request-automation,code-review,release-automation,markdown-processing,devops,github-integration,continuous-integration
14
- Classifier: Development Status :: 4 - Beta
15
- Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
- Classifier: Programming Language :: Python :: 3.11
22
- Classifier: Programming Language :: Python :: 3.12
23
- Classifier: Programming Language :: Python :: 3.13
24
- Classifier: Topic :: Software Development
25
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
- Classifier: Topic :: Internet :: WWW/HTTP
27
- Classifier: Operating System :: OS Independent
28
- Requires-Python: >=3.8
29
- Description-Content-Type: text/markdown
30
- License-File: LICENSE
31
- Requires-Dist: requests>=2.32.3
32
- Requires-Dist: ruff>=0.9.1
33
- Requires-Dist: docformatter>=1.7.5
34
- Provides-Extra: dev
35
- Requires-Dist: pytest; extra == "dev"
36
- Dynamic: license-file
37
-
38
- <a href="https://www.ultralytics.com/" target="_blank"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
39
-
40
- # 🚀 Ultralytics Actions: Auto-Formatting for Python, Markdown, and Swift
41
-
42
- Welcome to the [Ultralytics Actions](https://github.com/ultralytics/actions) repository, your go-to solution for maintaining consistent code quality across Ultralytics Python and Swift projects. This GitHub Action is designed to automate the formatting of Python, Markdown, and Swift files, ensuring adherence to our coding standards.
43
-
44
- [![GitHub Actions Marketplace](https://img.shields.io/badge/Marketplace-Ultralytics_Actions-blue?style=flat&logo=github)](https://github.com/marketplace/actions/ultralytics-actions) [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml) <a href="https://discord.com/invite/ultralytics"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a> <a href="https://reddit.com/r/ultralytics"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
45
-
46
- [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions) [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://www.pepy.tech/projects/ultralytics-actions)
47
-
48
- ## 📄 Actions Description
49
-
50
- Ultralytics Actions automatically applies formats, updates, and enhancements:
51
-
52
- - **Python Code:** Using [Ruff](https://github.com/astral-sh/ruff), a fast Python auto-formatter.
53
- - **Markdown Files:** With [Prettier](https://github.com/prettier/prettier), ensuring a consistent style in documentation.
54
- - **Docstrings:** Utilizing [docformatter](https://github.com/PyCQA/docformatter) for clean and standardized documentation comments.
55
- - **Swift Code:** Formatting Swift files using `swift-format` to ensure consistent coding style across Swift projects. _(Requires `macos-latest` to run correctly.)_
56
- - **Spell Check:** Employing [codespell](https://github.com/codespell-project/codespell) for catching common misspellings.
57
- - **Broken Links Check:** Implementing [Lychee](https://github.com/lycheeverse/lychee) to report broken links in docs and markdown files.
58
- - **PR Summary:** Generating concise [OpenAI](https://openai.com/) GPT4o-powered PR summaries, enhancing PR clarity.
59
- - **Auto-labeling:** Applying relevant labels to issues and pull requests using [OpenAI](https://openai.com/) GPT-4o for intelligent categorization.
60
-
61
- ## 🛠 How It Works
62
-
63
- Ultralytics Actions triggers on various GitHub events:
64
-
65
- - **Push Events:** Automatically formats code when changes are pushed to the `main` branch.
66
- - **Pull Requests:**
67
- - Ensures that contributions meet our formatting standards before merging.
68
- - Generates a concise summary of the changes using GPT-4o.
69
- - Automatically applies relevant labels using GPT-4o for intelligent categorization.
70
- - **Issues:** Automatically applies relevant labels using GPT-4o when new issues are created.
71
-
72
- These actions help maintain code quality, improve documentation clarity, and streamline the review process by providing consistent formatting, informative summaries, and appropriate categorization of issues and pull requests.
73
-
74
- ## 🔧 Setting Up the Action
75
-
76
- To use this action in your Ultralytics repository:
77
-
78
- 1. **Create a Workflow File:** In your repository, create a file under `.github/workflows/`, e.g., `ultralytics-actions.yml`.
79
-
80
- 2. **Add the Action:** Use the Ultralytics Actions in your workflow file as follows:
81
-
82
- ```yaml
83
- name: Ultralytics Actions
84
-
85
- on:
86
- issues:
87
- types: [opened]
88
- pull_request:
89
- branches: [main]
90
- types: [opened, closed]
91
-
92
- jobs:
93
- format:
94
- runs-on: ubuntu-latest
95
- steps:
96
- - name: Run Ultralytics Formatting
97
- uses: ultralytics/actions@main
98
- with:
99
- token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, do not modify
100
- labels: true # autolabel issues and PRs
101
- python: true # format Python code and docstrings
102
- prettier: true # format YAML, JSON, Markdown and CSS
103
- swift: true # format Swift code (requires 'macos-latest' runner)
104
- spelling: true # check spelling
105
- links: true # check broken links
106
- summary: true # print PR summary with GPT4o (requires 'openai_api_key')
107
- openai_api_key: # your OpenAI API key
108
- ```
109
-
110
- 3. **Customize:** Adjust the workflow settings as necessary for your project.
111
-
112
- ## 💡 Contribute
113
-
114
- Ultralytics thrives on community collaboration; we immensely value your involvement! We urge you to peruse our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) for detailed insights on how you can participate. Don't forget to share your feedback with us by contributing to our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A heartfelt thank you 🙏 goes out to everyone who has already contributed!
115
-
116
- <a href="https://github.com/ultralytics/yolov5/graphs/contributors">
117
- <img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/image-contributors.png" alt="Ultralytics open-source contributors"></a>
118
-
119
- ## 📄 License
120
-
121
- Ultralytics presents two distinct licensing paths to accommodate a variety of scenarios:
122
-
123
- - **AGPL-3.0 License**: This official [OSI-approved](https://opensource.org/license) open-source license is perfectly aligned with the goals of students, enthusiasts, and researchers who believe in the virtues of open collaboration and shared wisdom. Details are available in the [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) document.
124
- - **Enterprise License**: Tailored for commercial deployment, this license authorizes the unfettered integration of Ultralytics software and AI models within commercial goods and services, without the copyleft stipulations of AGPL-3.0. Should your use case demand an enterprise solution, direct your inquiries to [Ultralytics Licensing](https://www.ultralytics.com/license).
125
-
126
- ## 📮 Contact
127
-
128
- For bugs or feature suggestions pertaining to Ultralytics, please lodge an issue via [GitHub Issues](https://github.com/ultralytics/pre-commit/issues). You're also invited to participate in our [Discord](https://discord.com/invite/ultralytics) community to engage in discussions and seek advice!
129
-
130
- <br>
131
- <div align="center">
132
- <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
133
- <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
134
- <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
135
- <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
136
- <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
137
- <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
138
- <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
139
- <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
140
- <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
141
- <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
142
- <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
143
- <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
144
- <a href="https://discord.com/invite/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
145
- </div>
@@ -1,15 +0,0 @@
1
- actions/__init__.py,sha256=Ahj81FIHSd_RoAqBPeasm8WDsgbMFESfsHki6Qr_IGs,742
2
- actions/first_interaction.py,sha256=1_WvQHCi5RWaSfyi49ClF2Zk_3CKGjFnZqz6FlxPRAc,17868
3
- actions/summarize_pr.py,sha256=BKttOq-MGaanVaChLU5B1ewKUA8K6S05Cy3FQtyRmxU,11681
4
- actions/summarize_release.py,sha256=tov6qsYGC68lfobvkwVyoWZBGtJ598G0m097n4Ydzvo,8472
5
- actions/update_markdown_code_blocks.py,sha256=YCNJQO48Off5NQwIzdpE9_BLafEDv3-rkEtkREhEItU,8588
6
- actions/utils/__init__.py,sha256=WStdEAYROVnF0nubEOmrFLrejkRiMXIefA5O1ckfcFs,476
7
- actions/utils/common_utils.py,sha256=PZkK9Wc3od34J9VSw4ICWHhQQC033o3DCrCy0VIyZE4,6024
8
- actions/utils/github_utils.py,sha256=-F--JgxtXE0fSPMFEzakz7iZilp-vonzLiyXfg0b17Y,7117
9
- actions/utils/openai_utils.py,sha256=qQbmrJpOUANxSMf7inDSgPIwgf0JHD1fWZuab-y2W6g,2942
10
- ultralytics_actions-0.0.57.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
- ultralytics_actions-0.0.57.dist-info/METADATA,sha256=g6TwX1wlWsyosq1JztCpqp_GGZmGzR9L6G5HQTn5fEA,10583
12
- ultralytics_actions-0.0.57.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
13
- ultralytics_actions-0.0.57.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
- ultralytics_actions-0.0.57.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
- ultralytics_actions-0.0.57.dist-info/RECORD,,