rsgments 0.2.0__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.

Potentially problematic release.


This version of rsgments might be problematic. Click here for more details.

@@ -0,0 +1,585 @@
1
+ name: Build & Release Wheels
2
+
3
+ on:
4
+ push:
5
+ workflow_dispatch:
6
+ inputs:
7
+ version:
8
+ description: "Version to build (e.g. 0.2.0)"
9
+ required: true
10
+ type: string
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ # ============================================================================
17
+ # 1. Gate: only trigger builds on commits containing `build [version]`
18
+ # ============================================================================
19
+ gate:
20
+ if: >-
21
+ github.event_name == 'workflow_dispatch' ||
22
+ contains(github.event.head_commit.message, 'build ')
23
+ runs-on: ubuntu-24.04
24
+ outputs:
25
+ should_build: ${{ steps.parse.outputs.should_build }}
26
+ version: ${{ steps.parse.outputs.version }}
27
+ tag: ${{ steps.parse.outputs.tag }}
28
+
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+
32
+ - name: Parse build version
33
+ id: parse
34
+ shell: python3 {0}
35
+ env:
36
+ COMMIT_MSG: ${{ github.event.head_commit.message }}
37
+ INPUT_VERSION: ${{ inputs.version }}
38
+ run: |
39
+ import os
40
+ import re
41
+ import tomllib
42
+
43
+ event = os.environ["GITHUB_EVENT_NAME"]
44
+ if event == "workflow_dispatch":
45
+ raw = os.environ.get("INPUT_VERSION", "").strip()
46
+ else:
47
+ msg = os.environ.get("COMMIT_MSG", "")
48
+ m = re.search(
49
+ r"\bbuild\s+\[?(v?[0-9]+(?:\.[0-9]+)+(?:[.-][0-9A-Za-z]+)*)\]?",
50
+ msg,
51
+ re.IGNORECASE,
52
+ )
53
+ raw = m.group(1) if m else ""
54
+
55
+ out_path = os.environ["GITHUB_OUTPUT"]
56
+ if not raw:
57
+ print("No 'build [version]' marker found. Skipping build.")
58
+ with open(out_path, "a", encoding="utf-8") as f:
59
+ f.write("should_build=false\n")
60
+ raise SystemExit(0)
61
+
62
+ clean_ver = raw.lstrip("vV")
63
+ tag = f"v{clean_ver}"
64
+
65
+ with open("pyproject.toml", "rb") as f:
66
+ pkg_ver = tomllib.load(f)["project"]["version"]
67
+ if pkg_ver != clean_ver:
68
+ print(
69
+ f"::warning::Commit version ({clean_ver}) differs from pyproject.toml ({pkg_ver}). "
70
+ "PyPI will use the version specified in pyproject.toml."
71
+ )
72
+
73
+ print(f"Triggering build for version={clean_ver}, tag={tag}")
74
+ with open(out_path, "a", encoding="utf-8") as f:
75
+ f.write("should_build=true\n")
76
+ f.write(f"version={clean_ver}\n")
77
+ f.write(f"tag={tag}\n")
78
+
79
+ # ============================================================================
80
+ # 2. Source distribution (sdist)
81
+ # ============================================================================
82
+ sdist:
83
+ needs: gate
84
+ if: needs.gate.outputs.should_build == 'true'
85
+ runs-on: ubuntu-24.04
86
+ steps:
87
+ - uses: actions/checkout@v4
88
+
89
+ - name: Build sdist
90
+ uses: PyO3/maturin-action@v1
91
+ with:
92
+ command: sdist
93
+ args: --out dist
94
+
95
+ - uses: actions/upload-artifact@v4
96
+ with:
97
+ name: sdist
98
+ path: dist/*.tar.gz
99
+
100
+ # ============================================================================
101
+ # 3. Linux (manylinux glibc: x86_64, x86, aarch64, armv7, s390x, ppc64le)
102
+ # ============================================================================
103
+ linux:
104
+ needs: gate
105
+ if: needs.gate.outputs.should_build == 'true'
106
+ runs-on: ${{ matrix.runner }}
107
+ strategy:
108
+ fail-fast: false
109
+ matrix:
110
+ include:
111
+ - runner: ubuntu-24.04
112
+ target: x86_64
113
+ native_test: true
114
+ - runner: ubuntu-24.04
115
+ target: x86
116
+ native_test: false
117
+ - runner: ubuntu-24.04-arm
118
+ target: aarch64
119
+ native_test: true
120
+ - runner: ubuntu-24.04
121
+ target: armv7
122
+ native_test: false
123
+ - runner: ubuntu-24.04
124
+ target: s390x
125
+ native_test: false
126
+ - runner: ubuntu-24.04
127
+ target: ppc64le
128
+ native_test: false
129
+
130
+ steps:
131
+ - uses: actions/checkout@v4
132
+
133
+ - name: Build cp39 wheel (native)
134
+ uses: PyO3/maturin-action@v1
135
+ with:
136
+ target: ${{ matrix.target }}
137
+ args: --release --out dist -i 3.9
138
+ sccache: "true"
139
+ manylinux: auto
140
+
141
+ - name: Build cp310-abi3 wheel (3.10 - 3.14 GIL)
142
+ uses: PyO3/maturin-action@v1
143
+ with:
144
+ target: ${{ matrix.target }}
145
+ args: --release --out dist -i 3.10 --features pyo3/abi3-py310
146
+ sccache: "true"
147
+ manylinux: auto
148
+
149
+ - name: Build cp314t wheel (free-threaded)
150
+ uses: PyO3/maturin-action@v1
151
+ with:
152
+ target: ${{ matrix.target }}
153
+ args: --release --out dist -i 3.14t
154
+ sccache: "true"
155
+ manylinux: auto
156
+
157
+ - name: Build cp313t wheel (free-threaded, best-effort)
158
+ continue-on-error: true
159
+ uses: PyO3/maturin-action@v1
160
+ with:
161
+ target: ${{ matrix.target }}
162
+ args: --release --out dist -i 3.13t
163
+ sccache: "true"
164
+ manylinux: auto
165
+
166
+ # Verify built wheels on native host architectures (3.9, 3.14 via abi3, and 3.14t)
167
+ - name: Setup Python 3.9
168
+ if: matrix.native_test
169
+ uses: actions/setup-python@v6
170
+ with:
171
+ python-version: "3.9"
172
+ - name: Test cp39 wheel
173
+ if: matrix.native_test
174
+ run: |
175
+ python -m pip install --upgrade pip
176
+ python -m pip install pytest dist/*-cp39-*.whl
177
+ pytest -v
178
+
179
+ - name: Setup Python 3.14
180
+ if: matrix.native_test
181
+ uses: actions/setup-python@v6
182
+ with:
183
+ python-version: "3.14"
184
+ - name: Test cp310-abi3 wheel on Python 3.14
185
+ if: matrix.native_test
186
+ run: |
187
+ python -m pip install --upgrade pip
188
+ python -m pip install pytest dist/*-abi3-*.whl
189
+ pytest -v
190
+
191
+ - name: Setup Python 3.14t
192
+ if: matrix.native_test
193
+ uses: actions/setup-python@v6
194
+ with:
195
+ python-version: "3.14t"
196
+ - name: Test cp314t wheel
197
+ if: matrix.native_test
198
+ run: |
199
+ python -m pip install --upgrade pip
200
+ python -m pip install pytest dist/*-cp314t-*.whl
201
+ pytest -v
202
+
203
+ - uses: actions/upload-artifact@v4
204
+ with:
205
+ name: wheels-linux-${{ matrix.target }}
206
+ path: dist/*.whl
207
+
208
+ # ============================================================================
209
+ # 4. Linux (musllinux_1_2: x86_64, x86, aarch64, armv7)
210
+ # ============================================================================
211
+ musllinux:
212
+ needs: gate
213
+ if: needs.gate.outputs.should_build == 'true'
214
+ runs-on: ${{ matrix.runner }}
215
+ strategy:
216
+ fail-fast: false
217
+ matrix:
218
+ include:
219
+ - runner: ubuntu-24.04
220
+ target: x86_64
221
+ - runner: ubuntu-24.04
222
+ target: x86
223
+ - runner: ubuntu-24.04-arm
224
+ target: aarch64
225
+ - runner: ubuntu-24.04
226
+ target: armv7
227
+
228
+ steps:
229
+ - uses: actions/checkout@v4
230
+
231
+ - name: Build cp39 wheel (native)
232
+ uses: PyO3/maturin-action@v1
233
+ with:
234
+ target: ${{ matrix.target }}
235
+ args: --release --out dist -i 3.9
236
+ sccache: "true"
237
+ manylinux: musllinux_1_2
238
+
239
+ - name: Build cp310-abi3 wheel (3.10 - 3.14 GIL)
240
+ uses: PyO3/maturin-action@v1
241
+ with:
242
+ target: ${{ matrix.target }}
243
+ args: --release --out dist -i 3.10 --features pyo3/abi3-py310
244
+ sccache: "true"
245
+ manylinux: musllinux_1_2
246
+
247
+ - name: Build cp314t wheel (free-threaded)
248
+ continue-on-error: ${{ matrix.target == 'armv7' }}
249
+ uses: PyO3/maturin-action@v1
250
+ with:
251
+ target: ${{ matrix.target }}
252
+ args: --release --out dist -i 3.14t
253
+ sccache: "true"
254
+ manylinux: musllinux_1_2
255
+
256
+ - name: Build cp313t wheel (free-threaded, best-effort)
257
+ continue-on-error: true
258
+ uses: PyO3/maturin-action@v1
259
+ with:
260
+ target: ${{ matrix.target }}
261
+ args: --release --out dist -i 3.13t
262
+ sccache: "true"
263
+ manylinux: musllinux_1_2
264
+
265
+ - uses: actions/upload-artifact@v4
266
+ with:
267
+ name: wheels-musllinux-${{ matrix.target }}
268
+ path: dist/*.whl
269
+
270
+ # ============================================================================
271
+ # 5. macOS (Apple Silicon aarch64 & Intel x86_64)
272
+ # ============================================================================
273
+ macos:
274
+ needs: gate
275
+ if: needs.gate.outputs.should_build == 'true'
276
+ runs-on: ${{ matrix.runner }}
277
+ strategy:
278
+ fail-fast: false
279
+ matrix:
280
+ include:
281
+ - runner: macos-latest
282
+ target: aarch64
283
+ - runner: macos-15-intel
284
+ target: x86_64
285
+
286
+ steps:
287
+ - uses: actions/checkout@v4
288
+
289
+ # Python 3.9 native
290
+ - name: Setup Python 3.9
291
+ uses: actions/setup-python@v6
292
+ with:
293
+ python-version: "3.9"
294
+ - name: Build cp39 wheel
295
+ uses: PyO3/maturin-action@v1
296
+ with:
297
+ target: ${{ matrix.target }}
298
+ args: --release --out dist -i 3.9
299
+ sccache: "true"
300
+ - name: Test cp39 wheel
301
+ run: |
302
+ python -m pip install --upgrade pip
303
+ python -m pip install pytest dist/*-cp39-*.whl
304
+ pytest -v
305
+
306
+ # Python 3.10 - 3.14 GIL (cp310-abi3)
307
+ - name: Setup Python 3.10
308
+ uses: actions/setup-python@v6
309
+ with:
310
+ python-version: "3.10"
311
+ - name: Build cp310-abi3 wheel
312
+ uses: PyO3/maturin-action@v1
313
+ with:
314
+ target: ${{ matrix.target }}
315
+ args: --release --out dist -i 3.10 --features pyo3/abi3-py310
316
+ sccache: "true"
317
+
318
+ - name: Setup Python 3.14
319
+ uses: actions/setup-python@v6
320
+ with:
321
+ python-version: "3.14"
322
+ - name: Test cp310-abi3 wheel on Python 3.14
323
+ run: |
324
+ python -m pip install --upgrade pip
325
+ python -m pip install pytest dist/*-abi3-*.whl
326
+ pytest -v
327
+
328
+ # Python 3.14t free-threaded
329
+ - name: Setup Python 3.14t
330
+ uses: actions/setup-python@v6
331
+ with:
332
+ python-version: "3.14t"
333
+ - name: Build cp314t wheel
334
+ uses: PyO3/maturin-action@v1
335
+ with:
336
+ target: ${{ matrix.target }}
337
+ args: --release --out dist -i 3.14t
338
+ sccache: "true"
339
+ - name: Test cp314t wheel
340
+ run: |
341
+ python -m pip install --upgrade pip
342
+ python -m pip install pytest dist/*-cp314t-*.whl
343
+ pytest -v
344
+
345
+ # Python 3.13t free-threaded (best-effort)
346
+ - name: Setup Python 3.13t
347
+ id: py313t
348
+ continue-on-error: true
349
+ uses: actions/setup-python@v6
350
+ with:
351
+ python-version: "3.13t"
352
+ - name: Build cp313t wheel
353
+ if: steps.py313t.outcome == 'success'
354
+ continue-on-error: true
355
+ uses: PyO3/maturin-action@v1
356
+ with:
357
+ target: ${{ matrix.target }}
358
+ args: --release --out dist -i 3.13t
359
+ sccache: "true"
360
+
361
+ - uses: actions/upload-artifact@v4
362
+ with:
363
+ name: wheels-macos-${{ matrix.target }}
364
+ path: dist/*.whl
365
+
366
+ # ============================================================================
367
+ # 6. Windows (GIL: x64, x86, arm64)
368
+ # ============================================================================
369
+ windows:
370
+ needs: gate
371
+ if: needs.gate.outputs.should_build == 'true'
372
+ runs-on: ${{ matrix.runner }}
373
+ strategy:
374
+ fail-fast: false
375
+ matrix:
376
+ include:
377
+ - runner: windows-latest
378
+ target: x64
379
+ arch: x64
380
+ has_39: true
381
+ abi3_py: "3.10"
382
+ abi3_feat: "pyo3/abi3-py310"
383
+ - runner: windows-latest
384
+ target: x86
385
+ arch: x86
386
+ has_39: true
387
+ abi3_py: "3.10"
388
+ abi3_feat: "pyo3/abi3-py310"
389
+ - runner: windows-11-arm
390
+ target: aarch64
391
+ arch: arm64
392
+ has_39: false
393
+ abi3_py: "3.11"
394
+ abi3_feat: "pyo3/abi3-py311"
395
+
396
+ steps:
397
+ - uses: actions/checkout@v4
398
+
399
+ - name: Setup Python 3.9
400
+ if: matrix.has_39
401
+ uses: actions/setup-python@v6
402
+ with:
403
+ python-version: "3.9"
404
+ architecture: ${{ matrix.arch }}
405
+ - name: Build cp39 wheel
406
+ if: matrix.has_39
407
+ uses: PyO3/maturin-action@v1
408
+ with:
409
+ target: ${{ matrix.target }}
410
+ args: --release --out dist -i 3.9
411
+ sccache: "true"
412
+ - name: Test cp39 wheel
413
+ if: matrix.has_39
414
+ shell: pwsh
415
+ run: |
416
+ python -m pip install --upgrade pip
417
+ $whl = Get-ChildItem dist\*-cp39-*.whl | Select-Object -First 1
418
+ python -m pip install pytest $whl.FullName
419
+ pytest -v
420
+
421
+ - name: Setup Python ${{ matrix.abi3_py }} for abi3
422
+ uses: actions/setup-python@v6
423
+ with:
424
+ python-version: ${{ matrix.abi3_py }}
425
+ architecture: ${{ matrix.arch }}
426
+ - name: Build abi3 wheel
427
+ uses: PyO3/maturin-action@v1
428
+ with:
429
+ target: ${{ matrix.target }}
430
+ args: --release --out dist -i ${{ matrix.abi3_py }} --features ${{ matrix.abi3_feat }}
431
+ sccache: "true"
432
+
433
+ - name: Setup Python 3.14 to verify abi3 wheel
434
+ uses: actions/setup-python@v6
435
+ with:
436
+ python-version: "3.14"
437
+ architecture: ${{ matrix.arch }}
438
+ - name: Test abi3 wheel on Python 3.14
439
+ shell: pwsh
440
+ run: |
441
+ python -m pip install --upgrade pip
442
+ $whl = Get-ChildItem dist\*-abi3-*.whl | Select-Object -First 1
443
+ python -m pip install pytest $whl.FullName
444
+ pytest -v
445
+
446
+ - uses: actions/upload-artifact@v4
447
+ with:
448
+ name: wheels-windows-${{ matrix.target }}
449
+ path: dist/*.whl
450
+
451
+ # ============================================================================
452
+ # 7. Windows Free-threaded (isolated jobs to avoid CPython installer collision)
453
+ # ============================================================================
454
+ windows_freethreaded:
455
+ needs: gate
456
+ if: needs.gate.outputs.should_build == 'true'
457
+ runs-on: ${{ matrix.runner }}
458
+ continue-on-error: ${{ matrix.allow_fail }}
459
+ strategy:
460
+ fail-fast: false
461
+ matrix:
462
+ include:
463
+ - runner: windows-latest
464
+ target: x64
465
+ arch: x64
466
+ py: "3.14t"
467
+ allow_fail: false
468
+ - runner: windows-latest
469
+ target: x64
470
+ arch: x64
471
+ py: "3.13t"
472
+ allow_fail: true
473
+ - runner: windows-latest
474
+ target: x86
475
+ arch: x86
476
+ py: "3.14t"
477
+ allow_fail: true
478
+ - runner: windows-11-arm
479
+ target: aarch64
480
+ arch: arm64
481
+ py: "3.14t"
482
+ allow_fail: true
483
+
484
+ steps:
485
+ - uses: actions/checkout@v4
486
+
487
+ - name: Setup Python ${{ matrix.py }}
488
+ uses: actions/setup-python@v6
489
+ with:
490
+ python-version: ${{ matrix.py }}
491
+ architecture: ${{ matrix.arch }}
492
+
493
+ - name: Build ${{ matrix.py }} wheel
494
+ uses: PyO3/maturin-action@v1
495
+ with:
496
+ target: ${{ matrix.target }}
497
+ args: --release --out dist -i ${{ matrix.py }}
498
+ sccache: "true"
499
+
500
+ - name: Test ${{ matrix.py }} wheel
501
+ shell: pwsh
502
+ run: |
503
+ python -m pip install --upgrade pip
504
+ $whl = Get-ChildItem dist\*.whl | Select-Object -First 1
505
+ python -m pip install pytest $whl.FullName
506
+ pytest -v
507
+
508
+ - uses: actions/upload-artifact@v4
509
+ with:
510
+ name: wheels-windows-${{ matrix.target }}-${{ matrix.py }}
511
+ path: dist/*.whl
512
+ if-no-files-found: warn
513
+
514
+ # ============================================================================
515
+ # 8. Consolidate artifacts, check metadata with twine, and create GitHub Release
516
+ # ============================================================================
517
+ release:
518
+ needs: [gate, sdist, linux, musllinux, macos, windows, windows_freethreaded]
519
+ if: >-
520
+ always() &&
521
+ needs.gate.outputs.should_build == 'true' &&
522
+ needs.sdist.result == 'success' &&
523
+ needs.linux.result == 'success' &&
524
+ needs.musllinux.result == 'success' &&
525
+ needs.macos.result == 'success' &&
526
+ needs.windows.result == 'success' &&
527
+ needs.windows_freethreaded.result == 'success'
528
+ runs-on: ubuntu-24.04
529
+ permissions:
530
+ contents: write
531
+
532
+ steps:
533
+ - name: Download all distributions
534
+ uses: actions/download-artifact@v4
535
+ with:
536
+ path: dist/
537
+ merge-multiple: true
538
+
539
+ - name: Verify package metadata with twine
540
+ run: |
541
+ ls -lh dist/
542
+ python3 -m pip install --upgrade twine
543
+ twine check dist/*
544
+
545
+ - name: Upload consolidated dist artifact
546
+ uses: actions/upload-artifact@v4
547
+ with:
548
+ name: release-dists
549
+ path: dist/
550
+
551
+ - name: Create GitHub Release
552
+ uses: softprops/action-gh-release@v2
553
+ with:
554
+ tag_name: ${{ needs.gate.outputs.tag }}
555
+ name: Release ${{ needs.gate.outputs.tag }}
556
+ generate_release_notes: true
557
+ files: dist/*
558
+
559
+ # ============================================================================
560
+ # 9. Publish to PyPI (opt-in via repository variable ENABLE_PYPI=true)
561
+ # ============================================================================
562
+ pypi_publish:
563
+ needs: [gate, release]
564
+ if: >-
565
+ needs.gate.outputs.should_build == 'true' &&
566
+ vars.ENABLE_PYPI == 'true'
567
+ runs-on: ubuntu-24.04
568
+ permissions:
569
+ id-token: write
570
+ contents: read
571
+ environment:
572
+ name: pypi
573
+ url: https://pypi.org/p/rsgments
574
+
575
+ steps:
576
+ - name: Retrieve release distributions
577
+ uses: actions/download-artifact@v4
578
+ with:
579
+ name: release-dists
580
+ path: dist/
581
+
582
+ - name: Publish release distributions to PyPI
583
+ uses: pypa/gh-action-pypi-publish@release/v1
584
+ with:
585
+ packages-dir: dist/
@@ -0,0 +1,6 @@
1
+ /target/
2
+ /.pytest_cache/
3
+ __pycache__/
4
+ *.py[cod]
5
+ .venv/
6
+ venv/