private-attribute-cpp 2.1.24__tar.gz → 2.2.1__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.
- private_attribute_cpp-2.2.1/.github/dependabot.yml +6 -0
- private_attribute_cpp-2.2.1/.github/workflows/build-android.yml +185 -0
- private_attribute_cpp-2.2.1/.github/workflows/lint.yml +10 -0
- private_attribute_cpp-2.2.1/.github/workflows/python-publish.yml +270 -0
- private_attribute_cpp-2.2.1/.github/workflows/test.yml +97 -0
- private_attribute_cpp-2.2.1/.github/workflows/update-bot.yml +42 -0
- private_attribute_cpp-2.2.1/.gitignore +20 -0
- private_attribute_cpp-2.2.1/.pre-commit-config.yaml +22 -0
- private_attribute_cpp-2.2.1/.update-bot/update_picosha2.py +37 -0
- private_attribute_cpp-2.2.1/CMakeLists.txt +34 -0
- {private_attribute_cpp-2.1.24/private_attribute_cpp.egg-info → private_attribute_cpp-2.2.1}/PKG-INFO +7 -16
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/README.md +3 -1
- private_attribute_cpp-2.2.1/ci/android/build_python.sh +312 -0
- private_attribute_cpp-2.2.1/ci/android/common.sh +222 -0
- private_attribute_cpp-2.2.1/ci/android/pydroid3.sh +54 -0
- private_attribute_cpp-2.2.1/ci/android/run.sh +70 -0
- private_attribute_cpp-2.2.1/ci/android/termux.sh +48 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/private_attribute.cpp +251 -176
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/private_attribute.pyi +9 -1
- private_attribute_cpp-2.2.1/pyproject.toml +28 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_attr_classify_owner.py +6 -6
- private_attribute_cpp-2.2.1/tests/test_init_subclass.py +99 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_private_inheritance.py +42 -20
- private_attribute_cpp-2.2.1/tests/test_use_parents.py +129 -0
- private_attribute_cpp-2.1.24/MANIFEST.in +0 -2
- private_attribute_cpp-2.1.24/PKG-INFO +0 -271
- private_attribute_cpp-2.1.24/private_attribute_cpp.egg-info/SOURCES.txt +0 -22
- private_attribute_cpp-2.1.24/private_attribute_cpp.egg-info/dependency_links.txt +0 -1
- private_attribute_cpp-2.1.24/private_attribute_cpp.egg-info/not-zip-safe +0 -1
- private_attribute_cpp-2.1.24/private_attribute_cpp.egg-info/top_level.txt +0 -2
- private_attribute_cpp-2.1.24/setup.cfg +0 -4
- private_attribute_cpp-2.1.24/setup.py +0 -44
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/LICENSE +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/picosha2.h +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_class_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_gc_collect.py +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_private_abc.py +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_private_func.py +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_private_method.py +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_private_wrap.py +0 -0
- {private_attribute_cpp-2.1.24 → private_attribute_cpp-2.2.1}/tests/test_slots_cycle.py +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
name: Build Android wheels (Termux + Pydroid3)
|
|
2
|
+
|
|
3
|
+
# ---------------------------------------------------------------------------
|
|
4
|
+
# Builds the `private_attribute` C extension for Android-native CPython
|
|
5
|
+
# runtimes. Two targets share the same ABI (Android bionic libc, aarch64):
|
|
6
|
+
#
|
|
7
|
+
# * termux - https://github.com/termux/termux-docker
|
|
8
|
+
# (.cpython-3XX-aarch64-linux-android.so)
|
|
9
|
+
# * pydroid3 - Chaquopy-based interpreter (flat .cpython-3XX.so)
|
|
10
|
+
#
|
|
11
|
+
# Release-tag routing (tag acts as a switch):
|
|
12
|
+
# * vX.Y.Z -> python-publish.yml (PyPI), NOT this workflow
|
|
13
|
+
# * vX.Y.Z-termux -> build ONLY the termux wheels
|
|
14
|
+
# * vX.Y.Z-android -> build ONLY the pydroid3 wheels
|
|
15
|
+
# * workflow_dispatch -> manual; pick target(s) freely (default: all)
|
|
16
|
+
#
|
|
17
|
+
# Python versions (matrix):
|
|
18
|
+
# 3.10, 3.11, 3.12, 3.13, 3.13t, 3.14, 3.14t, 3.15, 3.15t
|
|
19
|
+
# ("t" = free-threaded / no-GIL build; introduced in 3.13)
|
|
20
|
+
#
|
|
21
|
+
# Fallback rule: if a matching prebuilt interpreter is not available in the
|
|
22
|
+
# target environment, CPython source is downloaded and built (see
|
|
23
|
+
# ci/android/build_python.sh). This is always the case for the "t" variants
|
|
24
|
+
# and for Pydroid3 (no prebuilt interpreter is shipped in CI).
|
|
25
|
+
# ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
on:
|
|
28
|
+
workflow_dispatch:
|
|
29
|
+
inputs:
|
|
30
|
+
python-version:
|
|
31
|
+
description: "Comma-separated Python versions to build (blank = all). e.g. 3.13,3.13t"
|
|
32
|
+
required: false
|
|
33
|
+
default: ""
|
|
34
|
+
target:
|
|
35
|
+
description: "Target runtime environment"
|
|
36
|
+
required: false
|
|
37
|
+
type: choice
|
|
38
|
+
default: "all"
|
|
39
|
+
options:
|
|
40
|
+
- all
|
|
41
|
+
- termux
|
|
42
|
+
- pydroid3
|
|
43
|
+
release:
|
|
44
|
+
types: [published]
|
|
45
|
+
|
|
46
|
+
permissions:
|
|
47
|
+
contents: read
|
|
48
|
+
|
|
49
|
+
concurrency:
|
|
50
|
+
group: android-build-${{ github.ref }}-${{ github.event_name }}
|
|
51
|
+
cancel-in-progress: false
|
|
52
|
+
|
|
53
|
+
jobs:
|
|
54
|
+
build:
|
|
55
|
+
name: ${{ matrix.version }} @ ${{ matrix.target }}
|
|
56
|
+
# Skip this workflow entirely for plain version tags (those go to PyPI via
|
|
57
|
+
# python-publish.yml). Also skip if a tag routes to the OTHER target only.
|
|
58
|
+
if: |
|
|
59
|
+
github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && (endsWith(github.ref_name, '-termux') || endsWith(github.ref_name, '-android')))
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
strategy:
|
|
62
|
+
fail-fast: false
|
|
63
|
+
matrix:
|
|
64
|
+
target: [termux, pydroid3]
|
|
65
|
+
version:
|
|
66
|
+
- "3.10"
|
|
67
|
+
- "3.11"
|
|
68
|
+
- "3.12"
|
|
69
|
+
- "3.13"
|
|
70
|
+
- "3.13t"
|
|
71
|
+
- "3.14"
|
|
72
|
+
- "3.14t"
|
|
73
|
+
- "3.15"
|
|
74
|
+
- "3.15t"
|
|
75
|
+
|
|
76
|
+
steps:
|
|
77
|
+
- uses: actions/checkout@v7
|
|
78
|
+
|
|
79
|
+
- name: Resolve target routing (tag or manual input)
|
|
80
|
+
id: filter
|
|
81
|
+
shell: bash
|
|
82
|
+
run: |
|
|
83
|
+
this_target="${{ matrix.target }}"
|
|
84
|
+
this_version="${{ matrix.version }}"
|
|
85
|
+
|
|
86
|
+
# Default: build everything (manual dispatch without input).
|
|
87
|
+
want_target="all"
|
|
88
|
+
want_versions=""
|
|
89
|
+
|
|
90
|
+
if [ "${{ github.event_name }}" = "release" ]; then
|
|
91
|
+
# Tag-based routing.
|
|
92
|
+
case "${{ github.ref_name }}" in
|
|
93
|
+
*-termux) want_target="termux" ;;
|
|
94
|
+
*-android) want_target="pydroid3" ;;
|
|
95
|
+
*) want_target="none" ;;
|
|
96
|
+
esac
|
|
97
|
+
else
|
|
98
|
+
# Manual dispatch.
|
|
99
|
+
want_target="${{ github.event.inputs.target || 'all' }}"
|
|
100
|
+
want_versions="${{ github.event.inputs.python-version || '' }}"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
# target filter
|
|
104
|
+
if [ "$want_target" != "all" ] && [ "$want_target" != "$this_target" ]; then
|
|
105
|
+
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
106
|
+
echo "::notice::Skipping $this_target/$this_version (target=$want_target)"
|
|
107
|
+
exit 0
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
# version filter
|
|
111
|
+
if [ -n "$want_versions" ]; then
|
|
112
|
+
if ! printf '%s' "$want_versions" | tr ',' '\n' | grep -qx "$this_version"; then
|
|
113
|
+
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
114
|
+
echo "::notice::Skipping $this_target/$this_version (not in selection)"
|
|
115
|
+
exit 0
|
|
116
|
+
fi
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
120
|
+
|
|
121
|
+
- name: Set up QEMU (arm64 userspace emulation)
|
|
122
|
+
if: steps.filter.outputs.skip != 'true'
|
|
123
|
+
uses: docker/setup-qemu-action@v4
|
|
124
|
+
with:
|
|
125
|
+
platforms: arm64
|
|
126
|
+
|
|
127
|
+
- name: Build Android wheel
|
|
128
|
+
if: steps.filter.outputs.skip != 'true'
|
|
129
|
+
env:
|
|
130
|
+
PYVER: ${{ matrix.version }}
|
|
131
|
+
TARGET: ${{ matrix.target }}
|
|
132
|
+
run: bash ci/android/run.sh
|
|
133
|
+
|
|
134
|
+
- name: Upload wheel artifact
|
|
135
|
+
if: steps.filter.outputs.skip != 'true'
|
|
136
|
+
uses: actions/upload-artifact@v7.0.2
|
|
137
|
+
with:
|
|
138
|
+
name: android-wheels-${{ matrix.target }}-${{ matrix.version }}
|
|
139
|
+
path: dist-android/
|
|
140
|
+
if-no-files-found: warn
|
|
141
|
+
|
|
142
|
+
# -------------------------------------------------------------------------
|
|
143
|
+
# On a published -termux / -android release, collect the built wheels and
|
|
144
|
+
# attach them to that release. Plain vX.Y.Z releases are handled by
|
|
145
|
+
# python-publish.yml (PyPI).
|
|
146
|
+
# -------------------------------------------------------------------------
|
|
147
|
+
upload-to-release:
|
|
148
|
+
name: Attach Android wheels to release
|
|
149
|
+
if: github.event_name == 'release' && github.event.action == 'published' && (endsWith(github.ref_name, '-termux') || endsWith(github.ref_name, '-android'))
|
|
150
|
+
needs: [build]
|
|
151
|
+
runs-on: ubuntu-latest
|
|
152
|
+
permissions:
|
|
153
|
+
contents: write
|
|
154
|
+
steps:
|
|
155
|
+
- name: Download all Android wheels
|
|
156
|
+
uses: actions/download-artifact@v8
|
|
157
|
+
with:
|
|
158
|
+
pattern: android-wheels-*
|
|
159
|
+
path: android-wheels/
|
|
160
|
+
# Keep each artifact in its own subdir (name carries the target),
|
|
161
|
+
# because termux/pydroid3 share the linux_aarch64 platform tag and
|
|
162
|
+
# would otherwise collide on the same wheel filename.
|
|
163
|
+
merge-multiple: false
|
|
164
|
+
|
|
165
|
+
- name: Flatten wheel directory (disambiguate by target)
|
|
166
|
+
shell: bash
|
|
167
|
+
run: |
|
|
168
|
+
mkdir -p android-dist
|
|
169
|
+
for f in $(find android-wheels -type f -name '*.whl'); do
|
|
170
|
+
case "$f" in
|
|
171
|
+
*termux*) t=termux ;;
|
|
172
|
+
*pydroid3*) t=pydroid3 ;;
|
|
173
|
+
*) t=unknown ;;
|
|
174
|
+
esac
|
|
175
|
+
b="$(basename "$f")"
|
|
176
|
+
cp -n "$f" "android-dist/${b%.whl}-${t}.whl"
|
|
177
|
+
done
|
|
178
|
+
ls -lah android-dist/
|
|
179
|
+
|
|
180
|
+
- name: Attach wheels to GitHub Release
|
|
181
|
+
uses: softprops/action-gh-release@v3
|
|
182
|
+
with:
|
|
183
|
+
files: android-dist/*
|
|
184
|
+
env:
|
|
185
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
name: Build and Upload Wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-wheels:
|
|
13
|
+
name: Build wheels on ${{ matrix.os }}
|
|
14
|
+
# Route: run only for manual dispatch or a plain version tag
|
|
15
|
+
# (vX.Y.Z). Tagged releases with -termux/-android suffixes are handled
|
|
16
|
+
# exclusively by build-android.yml.
|
|
17
|
+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && !endsWith(github.ref_name, '-termux') && !endsWith(github.ref_name, '-android'))
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
strategy:
|
|
20
|
+
fail-fast: false
|
|
21
|
+
matrix:
|
|
22
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v7
|
|
26
|
+
|
|
27
|
+
- name: Set up QEMU
|
|
28
|
+
if: startsWith(matrix.os, 'ubuntu')
|
|
29
|
+
uses: docker/setup-qemu-action@v4
|
|
30
|
+
with:
|
|
31
|
+
platforms: all
|
|
32
|
+
|
|
33
|
+
- name: Add arm path on windows
|
|
34
|
+
if: startsWith(matrix.os, 'windows')
|
|
35
|
+
shell: pwsh
|
|
36
|
+
run: |
|
|
37
|
+
# Resolve the ARM64 cl.exe actually used by this build and derive the
|
|
38
|
+
# matching CRT redist directory from its toolset version, so msvcp140.dll
|
|
39
|
+
# matches the compiler (avoids prepending every installed toolset, whose
|
|
40
|
+
# newest-first order the runner then reverses and resolves an older DLL).
|
|
41
|
+
$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
42
|
+
$vsRoot = & $vswhere -latest -products "*" -property installationPath
|
|
43
|
+
$cl = & $vswhere -latest -products "*" -find "VC\Tools\MSVC\**\bin\Host*\ARM64\cl.exe" |
|
|
44
|
+
Sort-Object { [version]($_ -replace '.*\\MSVC\\([^\\]+)\\.*', '$1') } -Descending |
|
|
45
|
+
Select-Object -First 1
|
|
46
|
+
if ($cl) {
|
|
47
|
+
$msvcVer = $cl.Trim() -replace '.*\\MSVC\\([^\\]+)\\.*', '$1'
|
|
48
|
+
$crt = Get-ChildItem -Path "$vsRoot\VC\Redist\MSVC\$msvcVer\arm64\Microsoft.VC*.CRT" -Directory -ErrorAction SilentlyContinue |
|
|
49
|
+
Select-Object -First 1 -ExpandProperty FullName
|
|
50
|
+
if ($crt) {
|
|
51
|
+
Write-Host "Adding ARM64 CRT to PATH: $crt"
|
|
52
|
+
Add-Content -Path $env:GITHUB_PATH -Value $crt
|
|
53
|
+
} else {
|
|
54
|
+
Write-Host "ARM64 CRT not found for MSVC $msvcVer; leaving PATH unchanged."
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
Write-Host "ARM64 cl.exe not found; leaving PATH unchanged."
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- name: Setup Python (for cibuildwheel only)
|
|
61
|
+
uses: actions/setup-python@v7.0.0
|
|
62
|
+
with:
|
|
63
|
+
python-version: "3.12"
|
|
64
|
+
|
|
65
|
+
- name: Install cibuildwheel
|
|
66
|
+
run: pip install cibuildwheel
|
|
67
|
+
|
|
68
|
+
- name: Build wheels (CPython 3.10~3.15)
|
|
69
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
70
|
+
env:
|
|
71
|
+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-* cp314t-* cp315-* cp315t-*"
|
|
72
|
+
CIBW_PRERELEASE_PYTHONS: "1"
|
|
73
|
+
CIBW_ARCHS_LINUX: "x86_64 aarch64"
|
|
74
|
+
CIBW_ARCHS_WINDOWS: "AMD64 x86 ARM64"
|
|
75
|
+
CIBW_ARCHS_MACOS: "x86_64 arm64"
|
|
76
|
+
CIBW_TEST_SKIP: "*-win_arm64"
|
|
77
|
+
|
|
78
|
+
- uses: actions/upload-artifact@v7.0.2
|
|
79
|
+
with:
|
|
80
|
+
name: wheels-${{ matrix.os }}
|
|
81
|
+
path: wheelhouse
|
|
82
|
+
|
|
83
|
+
build-wheels-cp313t:
|
|
84
|
+
name: Build CPython 3.13 free-threading wheels on ${{ matrix.os }}
|
|
85
|
+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && !endsWith(github.ref_name, '-termux') && !endsWith(github.ref_name, '-android'))
|
|
86
|
+
runs-on: ${{ matrix.os }}
|
|
87
|
+
strategy:
|
|
88
|
+
fail-fast: false
|
|
89
|
+
matrix:
|
|
90
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
91
|
+
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/checkout@v7
|
|
94
|
+
|
|
95
|
+
- name: Set up QEMU
|
|
96
|
+
if: startsWith(matrix.os, 'ubuntu')
|
|
97
|
+
uses: docker/setup-qemu-action@v4
|
|
98
|
+
with:
|
|
99
|
+
platforms: all
|
|
100
|
+
|
|
101
|
+
- name: Add arm path on windows
|
|
102
|
+
if: startsWith(matrix.os, 'windows')
|
|
103
|
+
shell: pwsh
|
|
104
|
+
run: |
|
|
105
|
+
# Resolve the ARM64 cl.exe actually used by this build and derive the
|
|
106
|
+
# matching CRT redist directory from its toolset version, so msvcp140.dll
|
|
107
|
+
# matches the compiler (avoids prepending every installed toolset, whose
|
|
108
|
+
# newest-first order the runner then reverses and resolves an older DLL).
|
|
109
|
+
$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
110
|
+
$vsRoot = & $vswhere -latest -products "*" -property installationPath
|
|
111
|
+
$cl = & $vswhere -latest -products "*" -find "VC\Tools\MSVC\**\bin\Host*\ARM64\cl.exe" |
|
|
112
|
+
Sort-Object { [version]($_ -replace '.*\\MSVC\\([^\\]+)\\.*', '$1') } -Descending |
|
|
113
|
+
Select-Object -First 1
|
|
114
|
+
if ($cl) {
|
|
115
|
+
$msvcVer = $cl.Trim() -replace '.*\\MSVC\\([^\\]+)\\.*', '$1'
|
|
116
|
+
$crt = Get-ChildItem -Path "$vsRoot\VC\Redist\MSVC\$msvcVer\arm64\Microsoft.VC*.CRT" -Directory -ErrorAction SilentlyContinue |
|
|
117
|
+
Select-Object -First 1 -ExpandProperty FullName
|
|
118
|
+
if ($crt) {
|
|
119
|
+
Write-Host "Adding ARM64 CRT to PATH: $crt"
|
|
120
|
+
Add-Content -Path $env:GITHUB_PATH -Value $crt
|
|
121
|
+
} else {
|
|
122
|
+
Write-Host "ARM64 CRT not found for MSVC $msvcVer; leaving PATH unchanged."
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
Write-Host "ARM64 cl.exe not found; leaving PATH unchanged."
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
- name: Setup Python (for cibuildwheel only)
|
|
129
|
+
uses: actions/setup-python@v7.0.0
|
|
130
|
+
with:
|
|
131
|
+
python-version: "3.12"
|
|
132
|
+
|
|
133
|
+
- name: Install Linux repair tools
|
|
134
|
+
if: startsWith(matrix.os, 'ubuntu')
|
|
135
|
+
run: python -m pip install auditwheel
|
|
136
|
+
|
|
137
|
+
- name: Install macOS repair tools
|
|
138
|
+
if: startsWith(matrix.os, 'macos')
|
|
139
|
+
run: python -m pip install delocate
|
|
140
|
+
|
|
141
|
+
- name: Install Windows repair tool
|
|
142
|
+
if: startsWith(matrix.os, 'windows')
|
|
143
|
+
run: python -m pip install delvewheel
|
|
144
|
+
|
|
145
|
+
- name: Install cibuildwheel
|
|
146
|
+
run: python -m pip install "cibuildwheel==3.4.1"
|
|
147
|
+
|
|
148
|
+
- name: Build CPython 3.13 free-threading wheels
|
|
149
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
150
|
+
env:
|
|
151
|
+
CIBW_BUILD: "cp313t-*"
|
|
152
|
+
CIBW_ENABLE: "cpython-freethreading"
|
|
153
|
+
CIBW_ARCHS_LINUX: "x86_64 aarch64"
|
|
154
|
+
CIBW_ARCHS_WINDOWS: "AMD64 x86 ARM64"
|
|
155
|
+
CIBW_ARCHS_MACOS: "x86_64 arm64"
|
|
156
|
+
CIBW_TEST_SKIP: "*-win_arm64"
|
|
157
|
+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
|
|
158
|
+
auditwheel -v repair -w {dest_dir} {wheel}
|
|
159
|
+
|
|
160
|
+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
|
|
161
|
+
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
|
|
162
|
+
|
|
163
|
+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
|
|
164
|
+
delvewheel repair -w {dest_dir} -v {wheel}
|
|
165
|
+
|
|
166
|
+
- uses: actions/upload-artifact@v7.0.2
|
|
167
|
+
with:
|
|
168
|
+
name: wheels-cp313t-${{ matrix.os }}
|
|
169
|
+
path: wheelhouse
|
|
170
|
+
|
|
171
|
+
build-sdist:
|
|
172
|
+
name: Build source distribution
|
|
173
|
+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && !endsWith(github.ref_name, '-termux') && !endsWith(github.ref_name, '-android'))
|
|
174
|
+
runs-on: ubuntu-latest
|
|
175
|
+
|
|
176
|
+
steps:
|
|
177
|
+
- uses: actions/checkout@v7
|
|
178
|
+
|
|
179
|
+
- name: Setup Python
|
|
180
|
+
uses: actions/setup-python@v7.0.0
|
|
181
|
+
with:
|
|
182
|
+
python-version: "3.12"
|
|
183
|
+
|
|
184
|
+
- name: Install build
|
|
185
|
+
run: python -m pip install build
|
|
186
|
+
|
|
187
|
+
- name: Build source distribution
|
|
188
|
+
run: python -m build --sdist
|
|
189
|
+
|
|
190
|
+
- name: Upload source distribution
|
|
191
|
+
uses: actions/upload-artifact@v7.0.2
|
|
192
|
+
with:
|
|
193
|
+
name: source-distribution
|
|
194
|
+
path: dist/*.tar.gz
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
publish-to-pypi:
|
|
198
|
+
name: Publish package to PyPI
|
|
199
|
+
needs:
|
|
200
|
+
- build-wheels
|
|
201
|
+
- build-wheels-cp313t
|
|
202
|
+
- build-sdist
|
|
203
|
+
|
|
204
|
+
if: github.event_name == 'release' && github.event.action == 'published' && !endsWith(github.ref_name, '-termux') && !endsWith(github.ref_name, '-android')
|
|
205
|
+
|
|
206
|
+
runs-on: ubuntu-latest
|
|
207
|
+
|
|
208
|
+
environment:
|
|
209
|
+
name: pypi
|
|
210
|
+
url: https://pypi.org/project/private-attribute-cpp/
|
|
211
|
+
|
|
212
|
+
permissions:
|
|
213
|
+
id-token: write
|
|
214
|
+
|
|
215
|
+
steps:
|
|
216
|
+
- name: Download all wheels
|
|
217
|
+
uses: actions/download-artifact@v8
|
|
218
|
+
with:
|
|
219
|
+
pattern: wheels-*
|
|
220
|
+
path: dist/
|
|
221
|
+
merge-multiple: true
|
|
222
|
+
|
|
223
|
+
- name: Download source distribution
|
|
224
|
+
uses: actions/download-artifact@v8
|
|
225
|
+
with:
|
|
226
|
+
name: source-distribution
|
|
227
|
+
path: dist/
|
|
228
|
+
|
|
229
|
+
- name: List distributions
|
|
230
|
+
run: ls -lah dist/
|
|
231
|
+
|
|
232
|
+
- name: Publish distributions to PyPI
|
|
233
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
234
|
+
|
|
235
|
+
- name: Upload distributions as artifact
|
|
236
|
+
uses: actions/upload-artifact@v7.0.2
|
|
237
|
+
with:
|
|
238
|
+
name: all-distributions
|
|
239
|
+
path: dist/*
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
upload-to-release:
|
|
243
|
+
name: Upload distributions to GitHub Release
|
|
244
|
+
needs:
|
|
245
|
+
- publish-to-pypi
|
|
246
|
+
if: github.event_name == 'release' && github.event.action == 'published' && !endsWith(github.ref_name, '-termux') && !endsWith(github.ref_name, '-android')
|
|
247
|
+
runs-on: ubuntu-latest
|
|
248
|
+
|
|
249
|
+
permissions:
|
|
250
|
+
contents: write
|
|
251
|
+
|
|
252
|
+
steps:
|
|
253
|
+
- name: Download all distributions
|
|
254
|
+
uses: actions/download-artifact@v8
|
|
255
|
+
with:
|
|
256
|
+
name: all-distributions
|
|
257
|
+
path: dist/
|
|
258
|
+
|
|
259
|
+
- name: List distributions
|
|
260
|
+
run: ls -lah dist/
|
|
261
|
+
|
|
262
|
+
- name: Remove attestation files
|
|
263
|
+
run: rm -f dist/*.publish.attestation
|
|
264
|
+
|
|
265
|
+
- name: Upload assets to release
|
|
266
|
+
uses: softprops/action-gh-release@v3
|
|
267
|
+
with:
|
|
268
|
+
files: dist/*
|
|
269
|
+
env:
|
|
270
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
name: Run Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main", "master"]
|
|
6
|
+
paths:
|
|
7
|
+
- "tests/**"
|
|
8
|
+
- "CMakeLists.txt"
|
|
9
|
+
- "pyproject.toml"
|
|
10
|
+
- "picosha2.h"
|
|
11
|
+
- "private_attribute.cpp"
|
|
12
|
+
- "private_attribute.pyi"
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: ["main", "master"]
|
|
15
|
+
paths:
|
|
16
|
+
- "tests/**"
|
|
17
|
+
- "CMakeLists.txt"
|
|
18
|
+
- "pyproject.toml"
|
|
19
|
+
- "picosha2.h"
|
|
20
|
+
- "private_attribute.cpp"
|
|
21
|
+
- "private_attribute.pyi"
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build-and-test:
|
|
25
|
+
strategy:
|
|
26
|
+
fail-fast: false
|
|
27
|
+
matrix:
|
|
28
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
29
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15", "3.13t", "3.14t", "3.15t"]
|
|
30
|
+
|
|
31
|
+
runs-on: ${{ matrix.os }}
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- name: Checkout code
|
|
35
|
+
uses: actions/checkout@v7
|
|
36
|
+
|
|
37
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
38
|
+
uses: actions/setup-python@v7.0.0
|
|
39
|
+
with:
|
|
40
|
+
python-version: ${{ matrix.python-version }}
|
|
41
|
+
|
|
42
|
+
- name: Install dependencies
|
|
43
|
+
shell: bash
|
|
44
|
+
run: |
|
|
45
|
+
python -m pip install --upgrade pip
|
|
46
|
+
python -m pip install pytest
|
|
47
|
+
|
|
48
|
+
- name: Build and install extension
|
|
49
|
+
shell: bash
|
|
50
|
+
run: |
|
|
51
|
+
# scikit-build-core builds the extension via CMake. On Linux a Debug
|
|
52
|
+
# build is used so native crash backtraces carry full symbols; the
|
|
53
|
+
# CMakeLists.txt only adds -g0 when PRIVATE_ATTR_KEEP_DEBUG is unset,
|
|
54
|
+
# so we set it to 1 to keep -g (and -fno-omit-frame-pointer for
|
|
55
|
+
# reliable gdb frame info). Windows/macOS build a plain release
|
|
56
|
+
# extension: MSVC must stay on the release CRT (/MD) that CPython
|
|
57
|
+
# extensions link against, so no Debug config is used there.
|
|
58
|
+
if [ "${{ runner.os }}" = "Linux" ]; then
|
|
59
|
+
export CFLAGS="-O0 -g -fno-omit-frame-pointer"
|
|
60
|
+
export CXXFLAGS="-O0 -g -fno-omit-frame-pointer"
|
|
61
|
+
export PRIVATE_ATTR_KEEP_DEBUG=1
|
|
62
|
+
python -m pip install . --config-settings=cmake.build-type=Debug
|
|
63
|
+
else
|
|
64
|
+
python -m pip install .
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
- name: Install native debugging tools
|
|
68
|
+
shell: bash
|
|
69
|
+
run: |
|
|
70
|
+
if [ "${{ runner.os }}" = "Linux" ]; then
|
|
71
|
+
sudo apt-get update
|
|
72
|
+
sudo apt-get install -y gdb
|
|
73
|
+
elif [ "${{ runner.os }}" = "macOS" ]; then
|
|
74
|
+
echo "lldb is available on macOS runners"
|
|
75
|
+
else
|
|
76
|
+
echo "Native crash backtraces on Windows are best-effort via faulthandler and WinDbg when available"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
- name: Run tests with native crash backtrace
|
|
80
|
+
shell: bash
|
|
81
|
+
env:
|
|
82
|
+
PYTHONFAULTHANDLER: "1"
|
|
83
|
+
run: |
|
|
84
|
+
set -o pipefail
|
|
85
|
+
|
|
86
|
+
if [ "${{ runner.os }}" = "Linux" ]; then
|
|
87
|
+
gdb -q --batch \
|
|
88
|
+
-ex "set confirm off" \
|
|
89
|
+
-ex "set pagination off" \
|
|
90
|
+
-ex "handle SIGSEGV stop print pass" \
|
|
91
|
+
-ex "run" \
|
|
92
|
+
-ex "thread apply all bt full" \
|
|
93
|
+
-ex "quit \$_exitcode" \
|
|
94
|
+
--args python -m pytest tests/ -vvs -W error
|
|
95
|
+
else
|
|
96
|
+
python -X faulthandler -m pytest tests/ -vvs -W error
|
|
97
|
+
fi
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Update Bot
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 0 1 * *"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
update:
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repo
|
|
18
|
+
uses: actions/checkout@v7
|
|
19
|
+
|
|
20
|
+
- name: Setup Python
|
|
21
|
+
uses: actions/setup-python@v7.0.0
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: pip install pyyaml requests packaging
|
|
27
|
+
|
|
28
|
+
- name: Run update scripts
|
|
29
|
+
run: |
|
|
30
|
+
python ".update-bot/update_picosha2.py"
|
|
31
|
+
|
|
32
|
+
- name: Commit and push changes
|
|
33
|
+
run: |
|
|
34
|
+
git config user.name "update-bot"
|
|
35
|
+
git config user.email "bot@example.com"
|
|
36
|
+
git add -A
|
|
37
|
+
if git diff --cached --quiet; then
|
|
38
|
+
echo "No updates"
|
|
39
|
+
exit 0
|
|
40
|
+
fi
|
|
41
|
+
git commit -m "Automated update"
|
|
42
|
+
git push
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v6.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: check-merge-conflict
|
|
7
|
+
- id: end-of-file-fixer
|
|
8
|
+
- id: check-yaml
|
|
9
|
+
- id: check-case-conflict
|
|
10
|
+
- id: check-added-large-files
|
|
11
|
+
|
|
12
|
+
- repo: local
|
|
13
|
+
hooks:
|
|
14
|
+
- id: bidi-check
|
|
15
|
+
name: forbidden bidi chars
|
|
16
|
+
entry: bash -c 'grep -RIn --color -P "([\x00-\x09\x0B-\x0C\x0E-\x1F]|[\u202A-\u202E\u2066-\u2069])" . && exit 1 || exit 0'
|
|
17
|
+
language: system
|
|
18
|
+
|
|
19
|
+
- id: line-length
|
|
20
|
+
name: check max line length
|
|
21
|
+
entry: bash -c 'find . -type f -not -path "*/\.git/*" -not -name "README.md" -exec awk "length($0) > 180 {print FILENAME \":\" NR \":\" $0}" {} + | grep . && exit 1 || exit 0'
|
|
22
|
+
language: system
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import hashlib
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
URL = "https://raw.githubusercontent.com/okdshin/PicoSHA2/master/picosha2.h"
|
|
6
|
+
LOCAL = "picosha2.h"
|
|
7
|
+
|
|
8
|
+
def get_sha256(data):
|
|
9
|
+
return hashlib.sha256(data).hexdigest()
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
print("Checking picosha2.h...")
|
|
13
|
+
|
|
14
|
+
r = requests.get(URL, timeout=10)
|
|
15
|
+
r.raise_for_status()
|
|
16
|
+
remote_data = r.content
|
|
17
|
+
|
|
18
|
+
if not os.path.exists(LOCAL):
|
|
19
|
+
with open(LOCAL, "wb") as f:
|
|
20
|
+
f.write(remote_data)
|
|
21
|
+
print("picosha2.h created")
|
|
22
|
+
return
|
|
23
|
+
|
|
24
|
+
with open(LOCAL, "rb") as f:
|
|
25
|
+
local_data = f.read()
|
|
26
|
+
|
|
27
|
+
if get_sha256(local_data) == get_sha256(remote_data):
|
|
28
|
+
print("No change in picosha2.h")
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
with open(LOCAL, "wb") as f:
|
|
32
|
+
f.write(remote_data)
|
|
33
|
+
|
|
34
|
+
print("picosha2.h updated")
|
|
35
|
+
|
|
36
|
+
if __name__ == "__main__":
|
|
37
|
+
main()
|