rapidocrlite 5.0.0a6__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 (100) hide show
  1. rapidocrlite-5.0.0a6/.github/check_manylinux_tag.sh +25 -0
  2. rapidocrlite-5.0.0a6/.github/workflows/build-wheels.yml +398 -0
  3. rapidocrlite-5.0.0a6/.github/workflows/metal-macos.yml +65 -0
  4. rapidocrlite-5.0.0a6/.github/workflows/vulkan-lavapipe.yml +76 -0
  5. rapidocrlite-5.0.0a6/.gitignore +27 -0
  6. rapidocrlite-5.0.0a6/.gitmodules +3 -0
  7. rapidocrlite-5.0.0a6/CMakeLists.txt +371 -0
  8. rapidocrlite-5.0.0a6/PKG-INFO +151 -0
  9. rapidocrlite-5.0.0a6/README-CN.md +446 -0
  10. rapidocrlite-5.0.0a6/README.md +446 -0
  11. rapidocrlite-5.0.0a6/cmake/ppocrConfig.cmake.in +5 -0
  12. rapidocrlite-5.0.0a6/docs/API.md +212 -0
  13. rapidocrlite-5.0.0a6/docs/PERFORMANCE.md +245 -0
  14. rapidocrlite-5.0.0a6/docs/RELEASING.md +87 -0
  15. rapidocrlite-5.0.0a6/examples/c_api_demo.c +56 -0
  16. rapidocrlite-5.0.0a6/examples/cpp_api_demo.cpp +37 -0
  17. rapidocrlite-5.0.0a6/examples/ppocr_batch_smoke.cpp +216 -0
  18. rapidocrlite-5.0.0a6/examples/ppocr_bench.cpp +123 -0
  19. rapidocrlite-5.0.0a6/examples/ppocr_demo.cpp +46 -0
  20. rapidocrlite-5.0.0a6/examples/ppocr_determinism.cpp +143 -0
  21. rapidocrlite-5.0.0a6/examples/ppocr_gpu_frontend_smoke.cpp +169 -0
  22. rapidocrlite-5.0.0a6/examples/ppocr_gpu_graph_mem_soak.cpp +157 -0
  23. rapidocrlite-5.0.0a6/examples/ppocr_gpu_graph_smoke.cpp +146 -0
  24. rapidocrlite-5.0.0a6/examples/ppocr_gpu_ocr_smoke.cpp +145 -0
  25. rapidocrlite-5.0.0a6/examples/ppocr_gpu_pipeline_smoke.cpp +180 -0
  26. rapidocrlite-5.0.0a6/examples/ppocr_isa_bench.cpp +85 -0
  27. rapidocrlite-5.0.0a6/examples/ppocr_kernel_smoke.cpp +2068 -0
  28. rapidocrlite-5.0.0a6/examples/ppocr_mem_soak.cpp +161 -0
  29. rapidocrlite-5.0.0a6/examples/ppocr_metal_check.cpp +124 -0
  30. rapidocrlite-5.0.0a6/examples/ppocr_vulkan_robust.cpp +241 -0
  31. rapidocrlite-5.0.0a6/examples/ppocr_vulkan_smoke.cpp +3571 -0
  32. rapidocrlite-5.0.0a6/include/ppocr/export.h +23 -0
  33. rapidocrlite-5.0.0a6/include/ppocr/ppocr.h +174 -0
  34. rapidocrlite-5.0.0a6/include/ppocr/ppocr.hpp +212 -0
  35. rapidocrlite-5.0.0a6/pyproject.toml +88 -0
  36. rapidocrlite-5.0.0a6/python/README.md +126 -0
  37. rapidocrlite-5.0.0a6/python/demo.py +30 -0
  38. rapidocrlite-5.0.0a6/python/pyproject.toml +49 -0
  39. rapidocrlite-5.0.0a6/python/src/rapidocr/__init__.py +35 -0
  40. rapidocrlite-5.0.0a6/python/src/rapidocr/__main__.py +6 -0
  41. rapidocrlite-5.0.0a6/python/src/rapidocr/_native.py +315 -0
  42. rapidocrlite-5.0.0a6/python/src/rapidocr/config.yaml +194 -0
  43. rapidocrlite-5.0.0a6/python/src/rapidocr/default_models.yaml +1557 -0
  44. rapidocrlite-5.0.0a6/python/src/rapidocr/download.py +5 -0
  45. rapidocrlite-5.0.0a6/python/src/rapidocr/inference_engine/__init__.py +10 -0
  46. rapidocrlite-5.0.0a6/python/src/rapidocr/inference_engine/base.py +92 -0
  47. rapidocrlite-5.0.0a6/python/src/rapidocr/main.py +469 -0
  48. rapidocrlite-5.0.0a6/python/src/rapidocr/models/.gitkeep +0 -0
  49. rapidocrlite-5.0.0a6/python/src/rapidocr/output.py +198 -0
  50. rapidocrlite-5.0.0a6/python/src/rapidocr/py.typed +0 -0
  51. rapidocrlite-5.0.0a6/python/src/rapidocr/typings.py +79 -0
  52. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/__init__.py +1 -0
  53. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/download_file.py +134 -0
  54. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/download_models.py +133 -0
  55. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/load_image.py +237 -0
  56. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/log.py +11 -0
  57. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/model_resolver.py +124 -0
  58. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/parse_parameters.py +110 -0
  59. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/process_img.py +85 -0
  60. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/typings.py +23 -0
  61. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/utils.py +20 -0
  62. rapidocrlite-5.0.0a6/python/src/rapidocr/utils/vis_res.py +36 -0
  63. rapidocrlite-5.0.0a6/python/tests/ci-constraints.txt +6 -0
  64. rapidocrlite-5.0.0a6/python/tests/ci_wheel_check.py +104 -0
  65. rapidocrlite-5.0.0a6/python/tests/ci_wheel_check.sh +83 -0
  66. rapidocrlite-5.0.0a6/python/tests/ci_wheel_check_macos.sh +60 -0
  67. rapidocrlite-5.0.0a6/python/tests/data/expected_cpu_texts.json +67 -0
  68. rapidocrlite-5.0.0a6/python/tests/data/hello.png +0 -0
  69. rapidocrlite-5.0.0a6/python/tests/data/page_mixed.png +0 -0
  70. rapidocrlite-5.0.0a6/python/tests/data/page_zh.png +0 -0
  71. rapidocrlite-5.0.0a6/python/tests/fetch_ci_models.py +75 -0
  72. rapidocrlite-5.0.0a6/python/tests/test_api.py +71 -0
  73. rapidocrlite-5.0.0a6/python/tests/test_download.py +120 -0
  74. rapidocrlite-5.0.0a6/python/tests/test_main_api_sync.py +266 -0
  75. rapidocrlite-5.0.0a6/python/tests/test_main_compat.py +314 -0
  76. rapidocrlite-5.0.0a6/python/tests/test_metal.py +106 -0
  77. rapidocrlite-5.0.0a6/python/tests/test_vulkan.py +96 -0
  78. rapidocrlite-5.0.0a6/python/tools/validate_model_routes.py +107 -0
  79. rapidocrlite-5.0.0a6/src/embed_spirv.cmake +39 -0
  80. rapidocrlite-5.0.0a6/src/kernels.cpp +6350 -0
  81. rapidocrlite-5.0.0a6/src/kernels.hpp +413 -0
  82. rapidocrlite-5.0.0a6/src/kernels_avx2.cpp +3401 -0
  83. rapidocrlite-5.0.0a6/src/kernels_avx512.cpp +5964 -0
  84. rapidocrlite-5.0.0a6/src/metal_driver.mm +1118 -0
  85. rapidocrlite-5.0.0a6/src/metal_native_kernels.hpp +344 -0
  86. rapidocrlite-5.0.0a6/src/metal_patch_msl.cmake +13 -0
  87. rapidocrlite-5.0.0a6/src/onnx_lite.cpp +10458 -0
  88. rapidocrlite-5.0.0a6/src/onnx_lite.hpp +182 -0
  89. rapidocrlite-5.0.0a6/src/ppocr.cpp +2649 -0
  90. rapidocrlite-5.0.0a6/src/ppocr_c_api.cpp +344 -0
  91. rapidocrlite-5.0.0a6/src/vulkan_backend.cpp +9583 -0
  92. rapidocrlite-5.0.0a6/src/vulkan_backend.hpp +978 -0
  93. rapidocrlite-5.0.0a6/src/vulkan_binary.comp +2545 -0
  94. rapidocrlite-5.0.0a6/src/vulkan_depthwise_tail.comp +80 -0
  95. rapidocrlite-5.0.0a6/src/vulkan_pointwise_tail.comp +48 -0
  96. rapidocrlite-5.0.0a6/tests/c_api_smoke.c +53 -0
  97. rapidocrlite-5.0.0a6/tests/check_isa_encoding.sh +33 -0
  98. rapidocrlite-5.0.0a6/tests/run_metal_macos.sh +48 -0
  99. rapidocrlite-5.0.0a6/tests/run_vulkan_lavapipe.sh +98 -0
  100. rapidocrlite-5.0.0a6/tools/bench_cpu.sh +16 -0
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+ # Fail unless every wheel in the directory is a manylinux2014 / manylinux_2_17 wheel.
3
+ set -euo pipefail
4
+
5
+ dir=${1:-wheelhouse}
6
+ python3 -m pip install -q auditwheel
7
+ mapfile -t wheels < <(find "$dir" -type f -name '*.whl' | sort)
8
+ if [[ ${#wheels[@]} -eq 0 ]]; then
9
+ echo "no wheels under $dir" >&2
10
+ exit 1
11
+ fi
12
+ for wheel in "${wheels[@]}"; do
13
+ base=$(basename "$wheel")
14
+ if ! echo "$base" | grep -Eq 'manylinux2014|manylinux_2_17'; then
15
+ echo "platform tag missing from filename: $base" >&2
16
+ exit 1
17
+ fi
18
+ show=$(python3 -m auditwheel show "$wheel")
19
+ printf '%s\n' "$show"
20
+ if ! printf '%s\n' "$show" | grep -Eq 'manylinux2014|manylinux_2_17'; then
21
+ echo "auditwheel show did not report manylinux2014/manylinux_2_17: $base" >&2
22
+ exit 1
23
+ fi
24
+ echo "tag_ok $base"
25
+ done
@@ -0,0 +1,398 @@
1
+ name: build wheels
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - "v5*"
9
+ pull_request:
10
+ branches:
11
+ - main
12
+ workflow_dispatch:
13
+
14
+ concurrency:
15
+ group: wheels-${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ jobs:
22
+ sdist:
23
+ name: sdist
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ with:
28
+ submodules: recursive
29
+
30
+ - uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.12"
33
+
34
+ - name: Build sdist
35
+ run: |
36
+ python -m pip install -U build
37
+ python -m build --sdist
38
+ (cd dist && sha256sum ./*.tar.gz > SHA256SUMS)
39
+
40
+ - uses: actions/upload-artifact@v4
41
+ with:
42
+ name: rapidocrlite-sdist
43
+ path: |
44
+ dist/*.tar.gz
45
+ dist/SHA256SUMS
46
+ if-no-files-found: error
47
+
48
+ wheels-x86_64:
49
+ name: wheels x86_64
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+ with:
54
+ submodules: recursive
55
+
56
+ - uses: actions/setup-python@v5
57
+ with:
58
+ python-version: "3.12"
59
+
60
+ - name: Cache tiny models
61
+ uses: actions/cache@v4
62
+ with:
63
+ path: ci-models
64
+ key: rapidocr-ci-models-tiny-v1
65
+
66
+ - name: Download tiny models when the cache is empty
67
+ run: python python/tests/fetch_ci_models.py
68
+
69
+ - name: Build manylinux2014 wheels
70
+ uses: pypa/cibuildwheel@v2.23.3
71
+ env:
72
+ CIBW_ARCHS: x86_64
73
+
74
+ - name: Check manylinux2014 / manylinux_2_17 tags
75
+ run: bash .github/check_manylinux_tag.sh wheelhouse
76
+
77
+ - uses: actions/upload-artifact@v4
78
+ with:
79
+ name: rapidocrlite-wheels-x86_64
80
+ path: wheelhouse/*.whl
81
+ if-no-files-found: error
82
+
83
+ wheels-aarch64:
84
+ name: wheels aarch64
85
+ runs-on: ubuntu-24.04-arm
86
+ outputs:
87
+ started: ${{ steps.mark.outputs.started }}
88
+ steps:
89
+ - name: Mark the native ARM runner as available
90
+ id: mark
91
+ run: echo "started=true" >> "$GITHUB_OUTPUT"
92
+
93
+ - uses: actions/checkout@v4
94
+ with:
95
+ submodules: recursive
96
+
97
+ - uses: actions/setup-python@v5
98
+ with:
99
+ python-version: "3.12"
100
+
101
+ - name: Cache tiny models
102
+ uses: actions/cache@v4
103
+ with:
104
+ path: ci-models
105
+ key: rapidocr-ci-models-tiny-v1
106
+
107
+ - name: Download tiny models when the cache is empty
108
+ run: python python/tests/fetch_ci_models.py
109
+
110
+ - name: Build manylinux2014 wheels
111
+ uses: pypa/cibuildwheel@v2.23.3
112
+ env:
113
+ CIBW_ARCHS: aarch64
114
+
115
+ - name: Check manylinux2014 / manylinux_2_17 tags
116
+ run: bash .github/check_manylinux_tag.sh wheelhouse
117
+
118
+ - uses: actions/upload-artifact@v4
119
+ with:
120
+ name: rapidocrlite-wheels-aarch64
121
+ path: wheelhouse/*.whl
122
+ if-no-files-found: error
123
+
124
+ wheels-aarch64-qemu:
125
+ name: wheels aarch64 qemu
126
+ needs: wheels-aarch64
127
+ if: >-
128
+ always() &&
129
+ needs.wheels-aarch64.result == 'failure' &&
130
+ needs.wheels-aarch64.outputs.started != 'true'
131
+ runs-on: ubuntu-latest
132
+ steps:
133
+ - uses: actions/checkout@v4
134
+ with:
135
+ submodules: recursive
136
+
137
+ - uses: actions/setup-python@v5
138
+ with:
139
+ python-version: "3.12"
140
+
141
+ - name: QEMU for aarch64
142
+ uses: docker/setup-qemu-action@v3
143
+ with:
144
+ platforms: arm64
145
+
146
+ - name: Cache tiny models
147
+ uses: actions/cache@v4
148
+ with:
149
+ path: ci-models
150
+ key: rapidocr-ci-models-tiny-v1
151
+
152
+ - name: Download tiny models when the cache is empty
153
+ run: python python/tests/fetch_ci_models.py
154
+
155
+ - name: Build manylinux2014 wheels
156
+ uses: pypa/cibuildwheel@v2.23.3
157
+ env:
158
+ CIBW_ARCHS: aarch64
159
+
160
+ - name: Check manylinux2014 / manylinux_2_17 tags
161
+ run: bash .github/check_manylinux_tag.sh wheelhouse
162
+
163
+ - uses: actions/upload-artifact@v4
164
+ with:
165
+ name: rapidocrlite-wheels-aarch64
166
+ path: wheelhouse/*.whl
167
+ if-no-files-found: error
168
+
169
+ wheels-macos-arm64:
170
+ name: wheels macOS arm64 (Metal)
171
+ runs-on: macos-14
172
+ steps:
173
+ - uses: actions/checkout@v4
174
+ with:
175
+ submodules: recursive
176
+
177
+ - uses: actions/setup-python@v5
178
+ with:
179
+ python-version: "3.12"
180
+
181
+ - name: Cache tiny models
182
+ uses: actions/cache@v4
183
+ with:
184
+ path: ci-models
185
+ key: rapidocr-ci-models-tiny-v1
186
+
187
+ - name: Download tiny models when the cache is empty
188
+ run: python python/tests/fetch_ci_models.py
189
+
190
+ - name: Build macOS 14 arm64 wheels with Metal
191
+ uses: pypa/cibuildwheel@v2.23.3
192
+ env:
193
+ CIBW_PLATFORM: macos
194
+ CIBW_BUILD_VERBOSITY: 1
195
+ CIBW_ARCHS: arm64
196
+ CIBW_SKIP: "pp* *-macosx_x86_64 *-macosx_universal2"
197
+
198
+ - name: Check macOS 14 arm64 tags
199
+ run: |
200
+ ls wheelhouse
201
+ n=$(ls wheelhouse/*.whl | wc -l)
202
+ test "$n" -eq 5
203
+ for w in wheelhouse/*.whl; do
204
+ case "$(basename "$w")" in
205
+ *-macosx_14_0_arm64.whl) ;;
206
+ *) echo "unexpected tag: $w" >&2; exit 1 ;;
207
+ esac
208
+ done
209
+
210
+ - uses: actions/upload-artifact@v4
211
+ with:
212
+ name: rapidocrlite-wheels-macos-arm64
213
+ path: wheelhouse/*.whl
214
+ if-no-files-found: error
215
+
216
+ wheels-windows-x64:
217
+ name: wheels Windows x64
218
+ runs-on: windows-latest
219
+ steps:
220
+ - uses: actions/checkout@v4
221
+ with:
222
+ submodules: recursive
223
+
224
+ - uses: actions/setup-python@v5
225
+ with:
226
+ python-version: "3.12"
227
+
228
+ - name: Cache tiny models
229
+ uses: actions/cache@v4
230
+ with:
231
+ path: ci-models
232
+ key: rapidocr-ci-models-tiny-v1
233
+
234
+ - name: Download tiny models when the cache is empty
235
+ run: python python/tests/fetch_ci_models.py
236
+
237
+ - name: Build Windows x64 wheels
238
+ uses: pypa/cibuildwheel@v2.23.3
239
+ env:
240
+ CIBW_PLATFORM: windows
241
+ CIBW_ARCHS: AMD64
242
+ CIBW_SKIP: "pp* *-win32 *-win_arm64"
243
+ CIBW_BUILD_VERBOSITY: 1
244
+
245
+ - name: Check Windows tags
246
+ shell: bash
247
+ run: |
248
+ ls wheelhouse
249
+ test "$(ls wheelhouse/*-win_amd64.whl | wc -l)" -eq 5
250
+
251
+ # GitHub's Windows runners are usually AVX2-only, so run the AVX-512
252
+ # kernels under Intel SDE (Sapphire Rapids) against the reference texts.
253
+ - name: AVX-512 check under Intel SDE
254
+ shell: bash
255
+ run: |
256
+ curl -sSL -o sde.tar.xz https://downloadmirror.intel.com/843185/sde-external-9.48.0-2024-11-25-win.tar.xz
257
+ mkdir sde && tar -xf sde.tar.xz -C sde --strip-components=1
258
+ python -m pip install wheelhouse/*cp312-cp312-win_amd64.whl
259
+ PPOCR_CHECK_ISAS=avx512 PPOCR_CHECK_TEXTS_ONLY=1 PYTHONIOENCODING=utf-8 \
260
+ ./sde/sde.exe -spr -- python python/tests/ci_wheel_check.py
261
+
262
+ - uses: actions/upload-artifact@v4
263
+ with:
264
+ name: rapidocrlite-wheels-windows-x64
265
+ path: wheelhouse/*.whl
266
+ if-no-files-found: error
267
+
268
+ wheels-windows-x86:
269
+ name: wheels Windows x86 (win32)
270
+ runs-on: windows-latest
271
+ steps:
272
+ - uses: actions/checkout@v4
273
+ with:
274
+ submodules: recursive
275
+
276
+ - uses: actions/setup-python@v5
277
+ with:
278
+ python-version: "3.12"
279
+
280
+ - name: Cache tiny models
281
+ uses: actions/cache@v4
282
+ with:
283
+ path: ci-models
284
+ key: rapidocr-ci-models-tiny-v1
285
+
286
+ - name: Download tiny models when the cache is empty
287
+ run: python python/tests/fetch_ci_models.py
288
+
289
+ - name: Build Windows x86 (win32) wheels
290
+ uses: pypa/cibuildwheel@v2.23.3
291
+ env:
292
+ CIBW_PLATFORM: windows
293
+ CIBW_ARCHS: x86
294
+ CIBW_SKIP: "pp* *-win_amd64 *-win_arm64"
295
+ CIBW_BUILD_VERBOSITY: 1
296
+
297
+ - name: Check Windows tags
298
+ shell: bash
299
+ run: |
300
+ ls wheelhouse
301
+ test "$(ls wheelhouse/*-win32.whl | wc -l)" -eq 5
302
+
303
+ - uses: actions/upload-artifact@v4
304
+ with:
305
+ name: rapidocrlite-wheels-windows-x86
306
+ path: wheelhouse/*.whl
307
+ if-no-files-found: error
308
+
309
+ dist:
310
+ name: SHA256SUMS
311
+ needs: [sdist, wheels-x86_64, wheels-aarch64, wheels-aarch64-qemu, wheels-macos-arm64, wheels-windows-x64, wheels-windows-x86]
312
+ if: >-
313
+ always() &&
314
+ needs.sdist.result == 'success' &&
315
+ needs.wheels-x86_64.result == 'success' &&
316
+ needs.wheels-macos-arm64.result == 'success' &&
317
+ needs.wheels-windows-x64.result == 'success' &&
318
+ needs.wheels-windows-x86.result == 'success' &&
319
+ (needs.wheels-aarch64.result == 'success' || needs.wheels-aarch64-qemu.result == 'success')
320
+ runs-on: ubuntu-latest
321
+ steps:
322
+ - uses: actions/download-artifact@v4
323
+ with:
324
+ pattern: rapidocrlite-*
325
+ merge-multiple: true
326
+ path: dist
327
+
328
+ - name: Write SHA256SUMS
329
+ run: |
330
+ rm -f dist/SHA256SUMS
331
+ (cd dist && sha256sum ./*.whl ./*.tar.gz | tee SHA256SUMS)
332
+
333
+ - uses: actions/upload-artifact@v4
334
+ with:
335
+ name: rapidocrlite-dist
336
+ path: |
337
+ dist/*.whl
338
+ dist/*.tar.gz
339
+ dist/SHA256SUMS
340
+ if-no-files-found: error
341
+
342
+ publish:
343
+ name: PyPI
344
+ needs: dist
345
+ # always(): dist itself runs after a skipped job (aarch64 qemu), and without
346
+ # it the skipped ancestor would skip publishing as well.
347
+ if: >-
348
+ always() &&
349
+ needs.dist.result == 'success' &&
350
+ github.event_name == 'push' &&
351
+ startsWith(github.ref, 'refs/tags/v5')
352
+ runs-on: ubuntu-latest
353
+ environment: pypi
354
+ env:
355
+ PYPI_API_TOKEN_V5_NG: ${{ secrets.PYPI_API_TOKEN_V5_NG }}
356
+ permissions:
357
+ id-token: write
358
+ contents: read
359
+ steps:
360
+ - uses: actions/download-artifact@v4
361
+ with:
362
+ name: rapidocrlite-dist
363
+ path: dist
364
+
365
+ - name: Check tag matches package version
366
+ env:
367
+ TAG: ${{ github.ref_name }}
368
+ run: |
369
+ v="${TAG#v}"
370
+ ls dist
371
+ ls dist/rapidocrlite-"$v".tar.gz
372
+ bad=$(ls dist/*.whl | grep -v "/rapidocrlite-$v-" || true)
373
+ if [ -n "$bad" ]; then echo "version mismatch: $bad" >&2; exit 1; fi
374
+
375
+ - name: Keep only distributions in the upload directory
376
+ run: |
377
+ mkdir -p pypi
378
+ cp dist/*.whl dist/*.tar.gz pypi/
379
+ ls pypi
380
+
381
+ - name: Publish to PyPI (API token secret)
382
+ if: env.PYPI_API_TOKEN_V5_NG != ''
383
+ uses: pypa/gh-action-pypi-publish@release/v1
384
+ with:
385
+ packages-dir: pypi
386
+ password: ${{ secrets.PYPI_API_TOKEN_V5_NG }}
387
+ skip-existing: true
388
+ attestations: false
389
+ verbose: true
390
+
391
+ - name: Publish to PyPI (Trusted Publishing)
392
+ if: env.PYPI_API_TOKEN_V5_NG == ''
393
+ uses: pypa/gh-action-pypi-publish@release/v1
394
+ with:
395
+ packages-dir: pypi
396
+ skip-existing: true
397
+ attestations: false
398
+ verbose: true
@@ -0,0 +1,65 @@
1
+ name: metal macos
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ concurrency:
13
+ group: metal-${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ metal:
21
+ name: macos-14 Metal
22
+ runs-on: macos-14
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ submodules: recursive
27
+
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.12"
31
+
32
+ - name: Install shader tools
33
+ run: brew install glslang spirv-cross ninja
34
+
35
+ - name: Cache tiny models
36
+ uses: actions/cache@v4
37
+ with:
38
+ path: ci-models
39
+ key: rapidocr-ci-models-tiny-v1
40
+
41
+ - name: Download tiny models when the cache is empty
42
+ run: python python/tests/fetch_ci_models.py
43
+
44
+ - name: Build with the Metal backend (no Vulkan loader)
45
+ run: |
46
+ cmake -S . -B build-metal -G Ninja \
47
+ -DCMAKE_BUILD_TYPE=Release \
48
+ -DPPOCR_BUILD_STATIC=OFF \
49
+ -DPPOCR_BUILD_TESTS=ON \
50
+ -DPPOCR_BUILD_EXAMPLES=ON \
51
+ -DPPOCR_ENABLE_VULKAN=OFF \
52
+ -DPPOCR_ENABLE_METAL=ON | tee configure.log
53
+ grep -q "Metal backend enabled" configure.log
54
+ cmake --build build-metal -j"$(sysctl -n hw.ncpu)"
55
+
56
+ - name: C API smoke
57
+ run: ctest --test-dir build-metal --output-on-failure
58
+
59
+ - name: Install Python test dependencies
60
+ run: |
61
+ python -m pip install -r python/tests/ci-constraints.txt \
62
+ pytest PyYAML requests tqdm
63
+
64
+ - name: Metal checks
65
+ run: bash tests/run_metal_macos.sh build-metal
@@ -0,0 +1,76 @@
1
+ name: vulkan lavapipe
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ concurrency:
13
+ group: vulkan-${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ lavapipe:
21
+ name: lavapipe
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ submodules: recursive
27
+
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.12"
31
+
32
+ - name: Install the software Vulkan stack
33
+ run: |
34
+ sudo apt-get update
35
+ sudo apt-get install -y --no-install-recommends \
36
+ mesa-vulkan-drivers vulkan-tools vulkan-validationlayers \
37
+ glslang-tools ninja-build cmake g++
38
+
39
+ - name: Cache tiny models
40
+ uses: actions/cache@v4
41
+ with:
42
+ path: ci-models
43
+ key: rapidocr-ci-models-tiny-v1
44
+
45
+ - name: Download tiny models when the cache is empty
46
+ run: python python/tests/fetch_ci_models.py
47
+
48
+ - name: Build with embedded Vulkan shaders
49
+ run: |
50
+ cmake -S . -B build-vk -G Ninja \
51
+ -DCMAKE_BUILD_TYPE=Release \
52
+ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
53
+ -DPPOCR_BUILD_STATIC=OFF \
54
+ -DPPOCR_BUILD_TESTS=ON \
55
+ -DPPOCR_BUILD_EXAMPLES=ON \
56
+ -DPPOCR_ENABLE_VULKAN=ON
57
+ cmake --build build-vk -j"$(nproc)"
58
+
59
+ - name: Confirm the library does not link libvulkan
60
+ run: |
61
+ if objdump -p build-vk/libppocr.so | grep -E 'NEEDED[[:space:]]+libvulkan'; then
62
+ echo "libppocr.so must dlopen libvulkan, not DT_NEEDED it" >&2
63
+ exit 1
64
+ fi
65
+
66
+ - name: Install Python test dependencies
67
+ run: |
68
+ python -m pip install -r python/tests/ci-constraints.txt \
69
+ pytest PyYAML requests tqdm
70
+
71
+ - name: Lavapipe hello, kernels, and fallback
72
+ env:
73
+ VK_ICD_FILENAMES: /usr/share/vulkan/icd.d/lvp_icd.json
74
+ PPOCR_VULKAN_DEVICE_INDEX: "0"
75
+ PPOCR_VULKAN_VALIDATION: "1"
76
+ run: bash tests/run_vulkan_lavapipe.sh build-vk
@@ -0,0 +1,27 @@
1
+ # Local build products and generated analysis output
2
+ /build*/
3
+ /bench/
4
+ __pycache__/
5
+ *.pyc
6
+ /python/dist/
7
+ /python/*.egg-info/
8
+ /python/src/*.egg-info/
9
+ /python/.pytest_cache/
10
+ /ci-models/
11
+ /wheelhouse/
12
+ /dist/
13
+ /python/src/rapidocr/models/*
14
+ !/python/src/rapidocr/models/.gitkeep
15
+ /**/graphify-out/
16
+ /build-msvc-env.txt
17
+
18
+ # Nested vendor repository metadata; vendor source is committed as normal files.
19
+ /third_party/Vulkan-Headers/.git/
20
+
21
+ # Editor and OS files
22
+ .vs/
23
+ .idea/
24
+ *.user
25
+ *.suo
26
+ .DS_Store
27
+ Thumbs.db
@@ -0,0 +1,3 @@
1
+ [submodule "third_party/Vulkan-Headers"]
2
+ path = third_party/Vulkan-Headers
3
+ url = https://github.com/KhronosGroup/Vulkan-Headers.git