primp 0.6.2__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.
- primp-0.6.2/.github/workflows/CI.yml +303 -0
- primp-0.6.2/.gitignore +76 -0
- primp-0.6.2/Cargo.lock +1839 -0
- primp-0.6.2/Cargo.toml +40 -0
- primp-0.6.2/LICENSE +21 -0
- primp-0.6.2/PKG-INFO +237 -0
- primp-0.6.2/README.md +209 -0
- primp-0.6.2/benchmark/README.md +17 -0
- primp-0.6.2/benchmark/benchmark.py +179 -0
- primp-0.6.2/benchmark/generate_image.py +86 -0
- primp-0.6.2/benchmark/requirements.txt +11 -0
- primp-0.6.2/benchmark/server.py +33 -0
- primp-0.6.2/benchmark.jpg +0 -0
- primp-0.6.2/pyproject.toml +40 -0
- primp-0.6.2/src/lib.rs +1012 -0
- primp-0.6.2/src/response.rs +107 -0
- primp-0.6.2/src/utils.rs +168 -0
- primp-0.6.2/tests/test_client.py +239 -0
- primp-0.6.2/tests/test_defs.py +322 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.7.0
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github -o .github/workflows/CI.yml --pytest
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- '*'
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
24
|
+
strategy:
|
|
25
|
+
fail-fast: false
|
|
26
|
+
matrix:
|
|
27
|
+
platform:
|
|
28
|
+
- runner: ubuntu-latest
|
|
29
|
+
target: x86_64
|
|
30
|
+
- runner: ubuntu-latest
|
|
31
|
+
target: aarch64
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
- uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version: 3.x
|
|
37
|
+
- name: Install aarch64 build dependencies
|
|
38
|
+
if: matrix.platform.target == 'aarch64'
|
|
39
|
+
run: sudo apt-get update && sudo apt-get install --yes crossbuild-essential-arm64
|
|
40
|
+
- name: Build wheels
|
|
41
|
+
uses: PyO3/maturin-action@v1
|
|
42
|
+
with:
|
|
43
|
+
rust-toolchain: stable
|
|
44
|
+
target: ${{ matrix.platform.target }}
|
|
45
|
+
args: ${{ matrix.platform.target == 'x86_64' && '--release --out dist --zig' || '--release --out dist' }}
|
|
46
|
+
sccache: 'true'
|
|
47
|
+
manylinux: auto
|
|
48
|
+
container: 'off'
|
|
49
|
+
env:
|
|
50
|
+
CFLAGS_aarch64_unknown_linux_gnu: ${{ matrix.platform.target == 'aarch64' && '-D__ARM_ARCH=8' || '' }}
|
|
51
|
+
CC: ${{ matrix.platform.target == 'aarch64' && 'aarch64-linux-gnu-gcc' || '' }}
|
|
52
|
+
CXX: ${{ matrix.platform.target == 'aarch64' && 'aarch64-linux-gnu-g++' || '' }}
|
|
53
|
+
# CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: x86_64-linux-gnu-g++
|
|
54
|
+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.platform.target == 'aarch64' && 'aarch64-linux-gnu-g++' || '' }}
|
|
55
|
+
- name: Upload wheels
|
|
56
|
+
uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
59
|
+
path: dist
|
|
60
|
+
- name: pytest
|
|
61
|
+
if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
|
|
62
|
+
shell: bash
|
|
63
|
+
run: |
|
|
64
|
+
set -e
|
|
65
|
+
pip install uv
|
|
66
|
+
for version in 3.8 3.9 3.10 3.11 3.12; do
|
|
67
|
+
uv venv --preview --python $version
|
|
68
|
+
source .venv/bin/activate
|
|
69
|
+
uv pip install certifi pytest
|
|
70
|
+
uv pip install primp --no-index --find-links dist --force-reinstall
|
|
71
|
+
pytest
|
|
72
|
+
done
|
|
73
|
+
- name: pytest
|
|
74
|
+
if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }}
|
|
75
|
+
uses: uraimo/run-on-arch-action@v2
|
|
76
|
+
with:
|
|
77
|
+
arch: ${{ matrix.platform.target }}
|
|
78
|
+
distro: ubuntu22.04
|
|
79
|
+
githubToken: ${{ github.token }}
|
|
80
|
+
install: |
|
|
81
|
+
apt-get update
|
|
82
|
+
apt-get install -y --no-install-recommends python3 python3-pip
|
|
83
|
+
run: |
|
|
84
|
+
set -e
|
|
85
|
+
pip install uv
|
|
86
|
+
for version in 3.8 3.9 3.10 3.11 3.12; do
|
|
87
|
+
uv venv --preview --python $version
|
|
88
|
+
source .venv/bin/activate
|
|
89
|
+
uv pip install certifi pytest
|
|
90
|
+
uv pip install primp --no-index --find-links dist --force-reinstall
|
|
91
|
+
pytest
|
|
92
|
+
done
|
|
93
|
+
|
|
94
|
+
musllinux:
|
|
95
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
96
|
+
strategy:
|
|
97
|
+
fail-fast: false
|
|
98
|
+
matrix:
|
|
99
|
+
platform:
|
|
100
|
+
- runner: ubuntu-latest
|
|
101
|
+
target: x86_64
|
|
102
|
+
- runner: ubuntu-latest
|
|
103
|
+
target: aarch64
|
|
104
|
+
steps:
|
|
105
|
+
- uses: actions/checkout@v4
|
|
106
|
+
- uses: actions/setup-python@v5
|
|
107
|
+
with:
|
|
108
|
+
python-version: 3.x
|
|
109
|
+
- name: Install aarch64 build dependencies
|
|
110
|
+
if: ${{ startsWith(matrix.platform.target, 'aarch64') }}
|
|
111
|
+
run: sudo apt-get update && sudo apt-get install --yes crossbuild-essential-arm64
|
|
112
|
+
- name: Prepare musl cross-compiler
|
|
113
|
+
run: |
|
|
114
|
+
curl -O http://musl.cc/${{ matrix.platform.target }}-linux-musl-cross.tgz
|
|
115
|
+
tar xzf ${{ matrix.platform.target }}-linux-musl-cross.tgz -C /opt
|
|
116
|
+
echo "/opt/${{ matrix.platform.target }}-linux-musl-cross/bin/" >> $GITHUB_PATH
|
|
117
|
+
- name: Build wheels
|
|
118
|
+
uses: PyO3/maturin-action@v1
|
|
119
|
+
with:
|
|
120
|
+
rust-toolchain: stable
|
|
121
|
+
target: ${{ matrix.platform.target }}
|
|
122
|
+
args: --release --out dist
|
|
123
|
+
sccache: 'true'
|
|
124
|
+
manylinux: musllinux_1_2
|
|
125
|
+
container: 'off'
|
|
126
|
+
env:
|
|
127
|
+
CC: ${{ matrix.platform.target }}-linux-musl-gcc
|
|
128
|
+
CXX: ${{ matrix.platform.target }}-linux-musl-g++
|
|
129
|
+
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: x86_64-linux-musl-g++
|
|
130
|
+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-g++
|
|
131
|
+
- name: Upload wheels
|
|
132
|
+
uses: actions/upload-artifact@v4
|
|
133
|
+
with:
|
|
134
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
135
|
+
path: dist
|
|
136
|
+
- name: QEMU
|
|
137
|
+
if: matrix.platform.target != 'x86_64'
|
|
138
|
+
uses: docker/setup-qemu-action@v3
|
|
139
|
+
- name: pytest
|
|
140
|
+
uses: addnab/docker-run-action@v3
|
|
141
|
+
with:
|
|
142
|
+
image: quay.io/pypa/musllinux_1_2_${{ matrix.platform.target }}:latest
|
|
143
|
+
options: -v ${{ github.workspace }}:/io -w /io
|
|
144
|
+
run: |
|
|
145
|
+
for version in 3.8 3.9 3.10 3.11 3.12; do
|
|
146
|
+
python$version -m venv .venv
|
|
147
|
+
source .venv/bin/activate
|
|
148
|
+
pip install certifi pytest
|
|
149
|
+
pip install primp --no-index --find-links dist --force-reinstall
|
|
150
|
+
pytest
|
|
151
|
+
done
|
|
152
|
+
|
|
153
|
+
windows:
|
|
154
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
155
|
+
strategy:
|
|
156
|
+
fail-fast: false
|
|
157
|
+
matrix:
|
|
158
|
+
platform:
|
|
159
|
+
- runner: windows-latest
|
|
160
|
+
target: x64
|
|
161
|
+
steps:
|
|
162
|
+
- uses: actions/checkout@v4
|
|
163
|
+
- uses: actions/setup-python@v5
|
|
164
|
+
with:
|
|
165
|
+
python-version: 3.x
|
|
166
|
+
architecture: ${{ matrix.platform.target }}
|
|
167
|
+
- name: Install nasm
|
|
168
|
+
run: choco install nasm
|
|
169
|
+
- name: Build wheels
|
|
170
|
+
uses: PyO3/maturin-action@v1
|
|
171
|
+
with:
|
|
172
|
+
rust-toolchain: stable
|
|
173
|
+
target: ${{ matrix.platform.target }}
|
|
174
|
+
args: --release --out dist
|
|
175
|
+
sccache: 'true'
|
|
176
|
+
- name: Upload wheels
|
|
177
|
+
uses: actions/upload-artifact@v4
|
|
178
|
+
with:
|
|
179
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
180
|
+
path: dist
|
|
181
|
+
- name: pytest
|
|
182
|
+
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
|
|
183
|
+
shell: bash
|
|
184
|
+
run: |
|
|
185
|
+
set -e
|
|
186
|
+
pip install uv
|
|
187
|
+
for version in 3.8 3.9 3.10 3.11 3.12; do
|
|
188
|
+
uv venv --preview --python $version
|
|
189
|
+
source .venv/Scripts/activate
|
|
190
|
+
uv pip install certifi pytest
|
|
191
|
+
uv pip install primp --no-index --find-links dist --force-reinstall
|
|
192
|
+
pytest
|
|
193
|
+
done
|
|
194
|
+
|
|
195
|
+
macos:
|
|
196
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
197
|
+
strategy:
|
|
198
|
+
fail-fast: false
|
|
199
|
+
matrix:
|
|
200
|
+
platform:
|
|
201
|
+
- runner: macos-12
|
|
202
|
+
target: x86_64
|
|
203
|
+
- runner: macos-14
|
|
204
|
+
target: aarch64
|
|
205
|
+
steps:
|
|
206
|
+
- uses: actions/checkout@v4
|
|
207
|
+
- uses: actions/setup-python@v5
|
|
208
|
+
with:
|
|
209
|
+
python-version: 3.x
|
|
210
|
+
- name: Build wheels
|
|
211
|
+
uses: PyO3/maturin-action@v1
|
|
212
|
+
with:
|
|
213
|
+
rust-toolchain: nightly
|
|
214
|
+
target: ${{ matrix.platform.target }}
|
|
215
|
+
args: --release --out dist
|
|
216
|
+
sccache: 'true'
|
|
217
|
+
- name: Upload wheels
|
|
218
|
+
uses: actions/upload-artifact@v4
|
|
219
|
+
with:
|
|
220
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
221
|
+
path: dist
|
|
222
|
+
- name: pytest
|
|
223
|
+
run: |
|
|
224
|
+
set -e
|
|
225
|
+
pip install uv
|
|
226
|
+
for version in 3.8 3.9 3.10 3.11 3.12; do
|
|
227
|
+
uv venv --preview --python $version
|
|
228
|
+
source .venv/bin/activate
|
|
229
|
+
uv pip install certifi pytest
|
|
230
|
+
uv pip install primp --no-index --find-links dist --force-reinstall
|
|
231
|
+
pytest
|
|
232
|
+
done
|
|
233
|
+
|
|
234
|
+
sdist:
|
|
235
|
+
runs-on: ubuntu-latest
|
|
236
|
+
steps:
|
|
237
|
+
- uses: actions/checkout@v4
|
|
238
|
+
- name: Build sdist
|
|
239
|
+
uses: PyO3/maturin-action@v1
|
|
240
|
+
with:
|
|
241
|
+
command: sdist
|
|
242
|
+
args: --out dist
|
|
243
|
+
- name: Upload sdist
|
|
244
|
+
uses: actions/upload-artifact@v4
|
|
245
|
+
with:
|
|
246
|
+
name: wheels-sdist
|
|
247
|
+
path: dist
|
|
248
|
+
|
|
249
|
+
release:
|
|
250
|
+
name: Release
|
|
251
|
+
runs-on: ubuntu-latest
|
|
252
|
+
if: "startsWith(github.ref, 'refs/tags/')"
|
|
253
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
254
|
+
steps:
|
|
255
|
+
- uses: actions/download-artifact@v4
|
|
256
|
+
- name: Publish to PyPI
|
|
257
|
+
uses: PyO3/maturin-action@v1
|
|
258
|
+
env:
|
|
259
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
260
|
+
with:
|
|
261
|
+
command: upload
|
|
262
|
+
args: --non-interactive --skip-existing wheels-*/*
|
|
263
|
+
|
|
264
|
+
benchmark:
|
|
265
|
+
permissions:
|
|
266
|
+
contents: write
|
|
267
|
+
runs-on: ubuntu-latest
|
|
268
|
+
needs: [linux]
|
|
269
|
+
steps:
|
|
270
|
+
- uses: actions/checkout@v4
|
|
271
|
+
- name: Set up Python
|
|
272
|
+
uses: actions/setup-python@v5
|
|
273
|
+
with:
|
|
274
|
+
python-version: 3.x
|
|
275
|
+
- name: Download wheels
|
|
276
|
+
uses: actions/download-artifact@v4
|
|
277
|
+
with:
|
|
278
|
+
name: wheels-linux-x86_64
|
|
279
|
+
- name: Install dependencies
|
|
280
|
+
run: |
|
|
281
|
+
pip install -r benchmark/requirements.txt
|
|
282
|
+
pip install primp --no-index --find-links ./ --force-reinstall
|
|
283
|
+
- name: Start Uvicorn server
|
|
284
|
+
run: |
|
|
285
|
+
uvicorn benchmark.server:app --host 0.0.0.0 --port 8000 &
|
|
286
|
+
sleep 10
|
|
287
|
+
- name: Run benchmark
|
|
288
|
+
run: python benchmark/benchmark.py
|
|
289
|
+
- name: Generate image, commit to the temp branch, merge changes into main, delete temp branch
|
|
290
|
+
if: "startsWith(github.ref, 'refs/tags/')"
|
|
291
|
+
run: |
|
|
292
|
+
python benchmark/generate_image.py
|
|
293
|
+
git config --global user.name 'GitHub Actions'
|
|
294
|
+
git config --global user.email 'actions@github.com'
|
|
295
|
+
git add \*.jpg
|
|
296
|
+
git diff --quiet && git diff --staged --quiet || git commit -m "Update generated image"
|
|
297
|
+
git checkout -b update-generated-image
|
|
298
|
+
git push https://${{ secrets.PUSH_TOKEN }}@github.com/deedy5/primp.git update-generated-image || echo "No changes to push"
|
|
299
|
+
git fetch origin
|
|
300
|
+
git checkout main
|
|
301
|
+
git merge update-generated-image
|
|
302
|
+
git push https://${{ secrets.PUSH_TOKEN }}@github.com/deedy5/primp.git main
|
|
303
|
+
git push origin --delete update-generated-image
|
primp-0.6.2/.gitignore
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
73
|
+
|
|
74
|
+
# Ignore csv and jpg files in benchmark folder
|
|
75
|
+
benchmark/*.csv
|
|
76
|
+
benchmark/*.jpg
|