Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#21009 `ultralytics 8.3.154` Refactor `Validator` and `Metrics` classes

Merged
Ghost merged 1 commits into Ultralytics:main from ultralytics:validator-cleanup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
  1. # Ultralytics ๐Ÿš€ AGPL-3.0 License - https://ultralytics.com/license
  2. # Test and publish docs to https://docs.ultralytics.com
  3. # Ignores the following Docs rules to match Google-style docstrings:
  4. # D100: Missing docstring in public module
  5. # D104: Missing docstring in public package
  6. # D203: 1 blank line required before class docstring
  7. # D205: 1 blank line required between summary line and description
  8. # D212: Multi-line docstring summary should start at the first line
  9. # D213: Multi-line docstring summary should start at the second line
  10. # D401: First line of docstring should be in imperative mood
  11. # D406: Section name should end with a newline
  12. # D407: Missing dashed underline after section
  13. # D413: Missing blank line after last section
  14. name: Publish Docs
  15. on:
  16. push:
  17. branches: [main]
  18. pull_request:
  19. branches: [main]
  20. workflow_dispatch:
  21. inputs:
  22. publish_docs:
  23. description: "Publish live to https://docs.ultralytics.com"
  24. default: true
  25. type: boolean
  26. permissions:
  27. contents: write # Modify code in PRs
  28. jobs:
  29. Docs:
  30. if: github.repository == 'ultralytics/ultralytics'
  31. runs-on: ubuntu-latest
  32. env:
  33. GITHUB_REF: ${{ github.head_ref || github.ref }}
  34. steps:
  35. - name: Checkout Repository
  36. uses: actions/checkout@v4
  37. with:
  38. # Fetch depth 0 required to capture full docs author history
  39. repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
  40. token: ${{ secrets._GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  41. ref: ${{ env.GITHUB_REF }}
  42. fetch-depth: 0
  43. - name: Set up Python
  44. uses: actions/setup-python@v5
  45. with:
  46. python-version: "3.x"
  47. - uses: astral-sh/setup-uv@v6
  48. - name: Install Dependencies
  49. run: uv pip install --system ruff black tqdm mkdocs-material "mkdocstrings[python]" mkdocs-ultralytics-plugin mkdocs-macros-plugin
  50. - name: Ruff fixes
  51. continue-on-error: true
  52. run: |
  53. ruff check \
  54. --fix \
  55. --unsafe-fixes \
  56. --extend-select I,D,UP \
  57. --target-version py38 \
  58. --ignore D100,D104,D203,D205,D212,D213,D401,D406,D407,D413 \
  59. .
  60. - name: Update Docs Reference Section and Push Changes
  61. continue-on-error: true
  62. run: |
  63. git config --global user.name "UltralyticsAssistant"
  64. git config --global user.email "web@ultralytics.com"
  65. npm install --global prettier prettier-plugin-sh
  66. python docs/build_reference.py
  67. git pull origin "$GITHUB_REF"
  68. git add .
  69. git reset HEAD -- .github/workflows/ # workflow changes are not permitted with default token
  70. if [[ "${{ github.event_name }}" == "pull_request" ]] && ! git diff --staged --quiet; then
  71. git commit -m "Auto-update Ultralytics Docs Reference by https://ultralytics.com/actions"
  72. git push
  73. else
  74. echo "No changes to commit"
  75. fi
  76. - name: Ruff checks
  77. run: |
  78. ruff check \
  79. --extend-select I,D,UP \
  80. --target-version py38 \
  81. --ignore D100,D104,D203,D205,D212,D213,D401,D406,D407,D413 \
  82. .
  83. - name: Build Docs and Check for Warnings
  84. run: |
  85. export JUPYTER_PLATFORM_DIRS=1
  86. python docs/build_docs.py
  87. - name: Commit and Push Docs changes
  88. continue-on-error: true
  89. if: always()
  90. run: |
  91. git pull origin "$GITHUB_REF"
  92. git add --update # only add updated files
  93. git reset HEAD -- .github/workflows/ # workflow changes are not permitted with default token
  94. if [[ "${{ github.event_name }}" == "pull_request" ]] && ! git diff --staged --quiet; then
  95. git commit -m "Auto-update Ultralytics Docs by https://ultralytics.com/actions"
  96. git push
  97. else
  98. echo "No changes to commit"
  99. fi
  100. - name: Publish Docs to https://docs.ultralytics.com
  101. if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_docs == 'true')
  102. run: |
  103. git clone --depth 1 --branch gh-pages https://github.com/ultralytics/docs.git docs-repo
  104. cd docs-repo
  105. if [ -f "vercel.json" ]; then
  106. cp vercel.json /tmp/vercel.json
  107. fi
  108. rm -rf *
  109. cp -R ../site/* .
  110. if [ -f "/tmp/vercel.json" ]; then
  111. cp /tmp/vercel.json .
  112. fi
  113. echo "${{ secrets.INDEXNOW_KEY_DOCS }}" > "${{ secrets.INDEXNOW_KEY_DOCS }}.txt"
  114. git add .
  115. if git diff --staged --quiet; then
  116. echo "No changes to commit"
  117. else
  118. git pull origin gh-pages
  119. LATEST_HASH=$(git rev-parse --short=7 HEAD)
  120. git commit -m "Update Docs for 'ultralytics ${{ steps.check_pypi.outputs.version }} - $LATEST_HASH'"
  121. git push https://${{ secrets._GITHUB_TOKEN }}@github.com/ultralytics/docs.git gh-pages
  122. fi
Discard
Tip!

Press p or to see the previous file or, n or to see the next file