bustapi 0.1.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 bustapi might be problematic. Click here for more details.
- bustapi-0.1.0/.github/workflows/ci.yml +232 -0
- bustapi-0.1.0/.github/workflows/pypi.yml +161 -0
- bustapi-0.1.0/.github/workflows/rls.yml +164 -0
- bustapi-0.1.0/.gitignore +148 -0
- bustapi-0.1.0/ARCHITECTURE.md +298 -0
- bustapi-0.1.0/Cargo.lock +1863 -0
- bustapi-0.1.0/Cargo.toml +40 -0
- bustapi-0.1.0/IMPLEMENTATION_ROADMAP.md +914 -0
- bustapi-0.1.0/LICENSE +21 -0
- bustapi-0.1.0/PKG-INFO +233 -0
- bustapi-0.1.0/PROGRESS_SUMMARY.md +104 -0
- bustapi-0.1.0/PROJECT_SPECIFICATION.md +490 -0
- bustapi-0.1.0/README.md +184 -0
- bustapi-0.1.0/examples/flask_migration.py +125 -0
- bustapi-0.1.0/examples/hello_world.py +90 -0
- bustapi-0.1.0/pyproject.toml +94 -0
- bustapi-0.1.0/python/bustapi/__init__.py +96 -0
- bustapi-0.1.0/python/bustapi/app.py +552 -0
- bustapi-0.1.0/python/bustapi/blueprints.py +500 -0
- bustapi-0.1.0/python/bustapi/exceptions.py +438 -0
- bustapi-0.1.0/python/bustapi/flask_compat.py +62 -0
- bustapi-0.1.0/python/bustapi/helpers.py +370 -0
- bustapi-0.1.0/python/bustapi/py.typed +0 -0
- bustapi-0.1.0/python/bustapi/request.py +378 -0
- bustapi-0.1.0/python/bustapi/response.py +406 -0
- bustapi-0.1.0/python/bustapi/testing.py +375 -0
- bustapi-0.1.0/src/bindings.rs +464 -0
- bustapi-0.1.0/src/lib.rs +46 -0
- bustapi-0.1.0/src/request.rs +215 -0
- bustapi-0.1.0/src/response.rs +392 -0
- bustapi-0.1.0/src/router.rs +366 -0
- bustapi-0.1.0/src/server.rs +162 -0
- bustapi-0.1.0/test_basic.py +100 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
name: BustAPI CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main", "develop"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout code
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v4
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Set up Rust
|
|
29
|
+
uses: dtolnay/rust-toolchain@stable
|
|
30
|
+
with:
|
|
31
|
+
toolchain: stable
|
|
32
|
+
components: clippy, rustfmt
|
|
33
|
+
|
|
34
|
+
- name: Cache Rust dependencies
|
|
35
|
+
uses: actions/cache@v3
|
|
36
|
+
with:
|
|
37
|
+
path: |
|
|
38
|
+
~/.cargo/registry
|
|
39
|
+
~/.cargo/git
|
|
40
|
+
target
|
|
41
|
+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
42
|
+
restore-keys: |
|
|
43
|
+
${{ runner.os }}-cargo-
|
|
44
|
+
|
|
45
|
+
- name: Cache Python dependencies
|
|
46
|
+
uses: actions/cache@v3
|
|
47
|
+
with:
|
|
48
|
+
path: ~/.cache/pip
|
|
49
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
|
|
50
|
+
restore-keys: |
|
|
51
|
+
${{ runner.os }}-pip-
|
|
52
|
+
|
|
53
|
+
- name: Create venv and install Python tools (Unix)
|
|
54
|
+
if: runner.os != 'Windows'
|
|
55
|
+
run: |
|
|
56
|
+
# create a portable virtualenv and install tooling there (Linux / macOS)
|
|
57
|
+
python -m venv .venv
|
|
58
|
+
VENV_PY=./.venv/bin/python
|
|
59
|
+
$VENV_PY -m pip install --upgrade pip
|
|
60
|
+
$VENV_PY -m pip install maturin pytest pytest-asyncio pytest-cov black isort ruff
|
|
61
|
+
echo "VENV_PY=$VENV_PY" >> $GITHUB_ENV
|
|
62
|
+
|
|
63
|
+
- name: Create venv and install Python tools (Windows)
|
|
64
|
+
if: runner.os == 'Windows'
|
|
65
|
+
shell: pwsh
|
|
66
|
+
run: |
|
|
67
|
+
# create a portable virtualenv and install tooling there (Windows)
|
|
68
|
+
python -m venv .venv
|
|
69
|
+
$VENV = Join-Path $PWD '.\\.venv\\Scripts\\python.exe'
|
|
70
|
+
& $VENV -m pip install --upgrade pip
|
|
71
|
+
& $VENV -m pip install maturin pytest pytest-asyncio pytest-cov black isort ruff
|
|
72
|
+
Write-Output "VENV_PY=$VENV" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
73
|
+
|
|
74
|
+
- name: Check Python code formatting with black
|
|
75
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
76
|
+
run: |
|
|
77
|
+
$VENV_PY -m black --check --diff python/
|
|
78
|
+
|
|
79
|
+
- name: Check Python imports ordering with isort
|
|
80
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
81
|
+
run: |
|
|
82
|
+
$VENV_PY -m isort --check-only --diff python/
|
|
83
|
+
|
|
84
|
+
- name: Lint Python code with ruff
|
|
85
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
86
|
+
run: |
|
|
87
|
+
$VENV_PY -m ruff check python/
|
|
88
|
+
|
|
89
|
+
- name: Check Rust code formatting
|
|
90
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
91
|
+
run: |
|
|
92
|
+
cargo fmt --check
|
|
93
|
+
|
|
94
|
+
- name: Lint Rust code
|
|
95
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
96
|
+
run: |
|
|
97
|
+
cargo clippy --all-targets --all-features -- -D warnings
|
|
98
|
+
|
|
99
|
+
- name: Build and install Rust extension with maturin (Unix)
|
|
100
|
+
if: runner.os != 'Windows'
|
|
101
|
+
run: |
|
|
102
|
+
# run maturin using the virtualenv's python so it won't pick a different system interpreter
|
|
103
|
+
$VENV_PY -m maturin develop --release
|
|
104
|
+
$VENV_PY -c "import bustapi; print(f'BustAPI {bustapi.__version__} installed successfully')"
|
|
105
|
+
|
|
106
|
+
- name: Build and install Rust extension with maturin (Windows)
|
|
107
|
+
if: runner.os == 'Windows'
|
|
108
|
+
shell: pwsh
|
|
109
|
+
run: |
|
|
110
|
+
# on Windows run the same pattern using the venv python executable
|
|
111
|
+
python -m venv .venv
|
|
112
|
+
$VENV = Join-Path $PWD '.\\.venv\\Scripts\\python.exe'
|
|
113
|
+
& $VENV -m pip install --upgrade pip
|
|
114
|
+
& $VENV -m pip install maturin
|
|
115
|
+
& $VENV -m maturin develop --release
|
|
116
|
+
& $VENV -c "import bustapi; print(f'BustAPI {bustapi.__version__} installed successfully')"
|
|
117
|
+
Write-Output "VENV_PY=$VENV" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
118
|
+
|
|
119
|
+
- name: Run basic tests (Unix)
|
|
120
|
+
if: runner.os != 'Windows'
|
|
121
|
+
run: |
|
|
122
|
+
$VENV_PY test_basic.py
|
|
123
|
+
|
|
124
|
+
- name: Run basic tests (Windows)
|
|
125
|
+
if: runner.os == 'Windows'
|
|
126
|
+
shell: pwsh
|
|
127
|
+
run: |
|
|
128
|
+
$VENV = $env:VENV_PY
|
|
129
|
+
& $VENV test_basic.py
|
|
130
|
+
|
|
131
|
+
build-wheels:
|
|
132
|
+
name: Build wheels on ${{ matrix.os }}
|
|
133
|
+
runs-on: ${{ matrix.os }}
|
|
134
|
+
needs: test
|
|
135
|
+
strategy:
|
|
136
|
+
matrix:
|
|
137
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
138
|
+
|
|
139
|
+
steps:
|
|
140
|
+
- name: Checkout code
|
|
141
|
+
uses: actions/checkout@v4
|
|
142
|
+
|
|
143
|
+
- name: Set up Python
|
|
144
|
+
uses: actions/setup-python@v4
|
|
145
|
+
with:
|
|
146
|
+
python-version: "3.11"
|
|
147
|
+
|
|
148
|
+
- name: Set up Rust
|
|
149
|
+
uses: dtolnay/rust-toolchain@stable
|
|
150
|
+
|
|
151
|
+
- name: Create venv and install maturin (Unix)
|
|
152
|
+
if: runner.os != 'Windows'
|
|
153
|
+
run: |
|
|
154
|
+
python -m venv .venv
|
|
155
|
+
VENV_PY=./.venv/bin/python
|
|
156
|
+
$VENV_PY -m pip install --upgrade pip
|
|
157
|
+
$VENV_PY -m pip install maturin
|
|
158
|
+
echo "VENV_PY=$VENV_PY" >> $GITHUB_ENV
|
|
159
|
+
|
|
160
|
+
- name: Create venv and install maturin (Windows)
|
|
161
|
+
if: runner.os == 'Windows'
|
|
162
|
+
shell: pwsh
|
|
163
|
+
run: |
|
|
164
|
+
python -m venv .venv
|
|
165
|
+
$VENV = Join-Path $PWD '.\\.venv\\Scripts\\python.exe'
|
|
166
|
+
& $VENV -m pip install --upgrade pip
|
|
167
|
+
& $VENV -m pip install maturin
|
|
168
|
+
Write-Output "VENV_PY=$VENV" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
169
|
+
|
|
170
|
+
- name: Build wheels with maturin (Unix)
|
|
171
|
+
if: runner.os != 'Windows'
|
|
172
|
+
run: |
|
|
173
|
+
$VENV_PY -m maturin build --release --out dist
|
|
174
|
+
|
|
175
|
+
- name: Build wheels with maturin (Windows)
|
|
176
|
+
if: runner.os == 'Windows'
|
|
177
|
+
shell: pwsh
|
|
178
|
+
run: |
|
|
179
|
+
$VENV = $env:VENV_PY
|
|
180
|
+
& $VENV -m maturin build --release --out dist
|
|
181
|
+
|
|
182
|
+
- name: Upload wheels as artifacts
|
|
183
|
+
uses: actions/upload-artifact@v4
|
|
184
|
+
with:
|
|
185
|
+
name: wheels-${{ matrix.os }}
|
|
186
|
+
path: dist/*.whl
|
|
187
|
+
|
|
188
|
+
benchmark:
|
|
189
|
+
name: Performance benchmarks
|
|
190
|
+
runs-on: ubuntu-latest
|
|
191
|
+
needs: test
|
|
192
|
+
if: github.event_name == 'pull_request'
|
|
193
|
+
|
|
194
|
+
steps:
|
|
195
|
+
- name: Checkout code
|
|
196
|
+
uses: actions/checkout@v4
|
|
197
|
+
|
|
198
|
+
- name: Set up Python
|
|
199
|
+
uses: actions/setup-python@v4
|
|
200
|
+
with:
|
|
201
|
+
python-version: "3.11"
|
|
202
|
+
|
|
203
|
+
- name: Set up Rust
|
|
204
|
+
uses: dtolnay/rust-toolchain@stable
|
|
205
|
+
|
|
206
|
+
- name: Create Python virtual environment
|
|
207
|
+
run: |
|
|
208
|
+
python -m venv .venv
|
|
209
|
+
echo "VENV_PY=./.venv/bin/python" >> $GITHUB_ENV
|
|
210
|
+
|
|
211
|
+
- name: Install dependencies
|
|
212
|
+
run: |
|
|
213
|
+
$VENV_PY -m pip install --upgrade pip
|
|
214
|
+
$VENV_PY -m pip install maturin requests httpx pytest-benchmark
|
|
215
|
+
|
|
216
|
+
- name: Build package
|
|
217
|
+
run: |
|
|
218
|
+
$VENV_PY -m maturin develop
|
|
219
|
+
|
|
220
|
+
- name: Run benchmarks
|
|
221
|
+
run: |
|
|
222
|
+
mkdir -p benchmarks/results
|
|
223
|
+
$VENV_PY -c "import bustapi; print('Running benchmarks for BustAPI', bustapi.__version__)" > benchmarks/results/version.txt
|
|
224
|
+
$VENV_PY examples/hello_world.py &
|
|
225
|
+
sleep 2
|
|
226
|
+
$VENV_PY -m pytest examples/benchmark_requests.py -v
|
|
227
|
+
|
|
228
|
+
- name: Upload benchmark results
|
|
229
|
+
uses: actions/upload-artifact@v4
|
|
230
|
+
with:
|
|
231
|
+
name: benchmark-results
|
|
232
|
+
path: benchmarks/results/
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-wheels:
|
|
11
|
+
name: Build wheels on ${{ matrix.os }}
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: '3.11'
|
|
26
|
+
|
|
27
|
+
- name: Set up Rust
|
|
28
|
+
uses: dtolnay/rust-toolchain@stable
|
|
29
|
+
|
|
30
|
+
- name: Cache cargo
|
|
31
|
+
uses: actions/cache@v3
|
|
32
|
+
with:
|
|
33
|
+
path: |
|
|
34
|
+
~/.cargo/registry
|
|
35
|
+
~/.cargo/git
|
|
36
|
+
target
|
|
37
|
+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
38
|
+
|
|
39
|
+
- name: Create venv and install maturin (Unix)
|
|
40
|
+
if: runner.os != 'Windows'
|
|
41
|
+
run: |
|
|
42
|
+
python -m venv .venv
|
|
43
|
+
VENV_PY=./.venv/bin/python
|
|
44
|
+
$VENV_PY -m pip install --upgrade pip
|
|
45
|
+
$VENV_PY -m pip install maturin
|
|
46
|
+
echo "VENV_PY=$VENV_PY" >> $GITHUB_ENV
|
|
47
|
+
|
|
48
|
+
- name: Create venv and install maturin (Windows)
|
|
49
|
+
if: runner.os == 'Windows'
|
|
50
|
+
shell: pwsh
|
|
51
|
+
run: |
|
|
52
|
+
python -m venv .venv
|
|
53
|
+
$VENV = '.\\.venv\\Scripts\\python.exe'
|
|
54
|
+
& $VENV -m pip install --upgrade pip
|
|
55
|
+
& $VENV -m pip install maturin
|
|
56
|
+
Write-Output "VENV_PY=$VENV" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
57
|
+
|
|
58
|
+
- name: Build wheels (Unix)
|
|
59
|
+
if: runner.os != 'Windows'
|
|
60
|
+
run: |
|
|
61
|
+
$VENV_PY -m maturin build --release --out dist
|
|
62
|
+
|
|
63
|
+
- name: Build wheels (Windows)
|
|
64
|
+
if: runner.os == 'Windows'
|
|
65
|
+
shell: pwsh
|
|
66
|
+
run: |
|
|
67
|
+
$VENV = $env:VENV_PY
|
|
68
|
+
& $VENV -m maturin build --release --out dist
|
|
69
|
+
|
|
70
|
+
- name: Upload wheels artifact
|
|
71
|
+
uses: actions/upload-artifact@v4
|
|
72
|
+
with:
|
|
73
|
+
name: wheels-${{ matrix.os }}
|
|
74
|
+
path: dist/*.whl
|
|
75
|
+
|
|
76
|
+
sdist:
|
|
77
|
+
name: Build source distribution
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
|
|
80
|
+
steps:
|
|
81
|
+
- name: Checkout code
|
|
82
|
+
uses: actions/checkout@v4
|
|
83
|
+
|
|
84
|
+
- name: Set up Python
|
|
85
|
+
uses: actions/setup-python@v5
|
|
86
|
+
with:
|
|
87
|
+
python-version: '3.11'
|
|
88
|
+
|
|
89
|
+
- name: Set up Rust
|
|
90
|
+
uses: dtolnay/rust-toolchain@stable
|
|
91
|
+
|
|
92
|
+
- name: Create venv and install maturin (sdist)
|
|
93
|
+
run: |
|
|
94
|
+
python -m venv .venv
|
|
95
|
+
VENV_PY=./.venv/bin/python
|
|
96
|
+
$VENV_PY -m pip install --upgrade pip
|
|
97
|
+
$VENV_PY -m pip install maturin
|
|
98
|
+
echo "VENV_PY=$VENV_PY" >> $GITHUB_ENV
|
|
99
|
+
|
|
100
|
+
- name: Build sdist (Unix)
|
|
101
|
+
if: runner.os != 'Windows'
|
|
102
|
+
run: |
|
|
103
|
+
$VENV_PY -m maturin sdist --out dist
|
|
104
|
+
|
|
105
|
+
- name: Build sdist (Windows)
|
|
106
|
+
if: runner.os == 'Windows'
|
|
107
|
+
shell: pwsh
|
|
108
|
+
run: |
|
|
109
|
+
$VENV = $env:VENV_PY
|
|
110
|
+
& $VENV -m maturin sdist --out dist
|
|
111
|
+
|
|
112
|
+
- name: Upload sdist artifact
|
|
113
|
+
uses: actions/upload-artifact@v4
|
|
114
|
+
with:
|
|
115
|
+
name: sdist
|
|
116
|
+
path: dist/*.tar.gz
|
|
117
|
+
|
|
118
|
+
publish:
|
|
119
|
+
name: Publish to PyPI
|
|
120
|
+
needs: [build-wheels, sdist]
|
|
121
|
+
runs-on: ubuntu-latest
|
|
122
|
+
environment:
|
|
123
|
+
name: pypi
|
|
124
|
+
url: https://pypi.org/p/bustapi
|
|
125
|
+
permissions:
|
|
126
|
+
contents: read
|
|
127
|
+
|
|
128
|
+
steps:
|
|
129
|
+
- name: Download all artifacts
|
|
130
|
+
uses: actions/download-artifact@v4
|
|
131
|
+
with:
|
|
132
|
+
path: dist
|
|
133
|
+
|
|
134
|
+
- name: Flatten downloaded artifacts
|
|
135
|
+
run: |
|
|
136
|
+
echo "Flattening artifacts into dist/ (move files from nested artifact folders)"
|
|
137
|
+
# move any files from subdirectories into dist/
|
|
138
|
+
find dist -mindepth 2 -type f -exec mv -t dist {} + || true
|
|
139
|
+
# remove any now-empty directories created by download-artifact
|
|
140
|
+
find dist -type d -empty -delete || true
|
|
141
|
+
|
|
142
|
+
- name: Display collected files
|
|
143
|
+
run: |
|
|
144
|
+
echo "Collected files:"
|
|
145
|
+
find dist -type f -maxdepth 2 -print
|
|
146
|
+
|
|
147
|
+
- name: Publish package to PyPI
|
|
148
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
149
|
+
with:
|
|
150
|
+
user: __token__
|
|
151
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
152
|
+
packages-dir: dist
|
|
153
|
+
skip-existing: true
|
|
154
|
+
- name: Verify dist contents
|
|
155
|
+
run: |
|
|
156
|
+
echo "Checking dist/ files before publish"
|
|
157
|
+
if [ -z "$(ls -A dist 2>/dev/null)" ]; then
|
|
158
|
+
echo "No files in dist/ to publish - aborting"
|
|
159
|
+
ls -la dist || true
|
|
160
|
+
exit 1
|
|
161
|
+
fi
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
tag:
|
|
7
|
+
description: "Release tag (e.g. v0.1.0)"
|
|
8
|
+
required: true
|
|
9
|
+
default: "v0.1.0"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: Build with Maturin
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
19
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
# Ensure Python is installed
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python-version }}
|
|
29
|
+
|
|
30
|
+
# Ensure Rust is installed
|
|
31
|
+
- name: Install Rust
|
|
32
|
+
run: |
|
|
33
|
+
if ! command -v rustc &> /dev/null
|
|
34
|
+
then
|
|
35
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
36
|
+
source $HOME/.cargo/env
|
|
37
|
+
fi
|
|
38
|
+
rustc --version
|
|
39
|
+
cargo --version
|
|
40
|
+
|
|
41
|
+
# Cache cargo dependencies
|
|
42
|
+
- name: Cache cargo
|
|
43
|
+
uses: actions/cache@v3
|
|
44
|
+
with:
|
|
45
|
+
path: |
|
|
46
|
+
~/.cargo/registry
|
|
47
|
+
~/.cargo/git
|
|
48
|
+
target
|
|
49
|
+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
50
|
+
|
|
51
|
+
# Install Maturin into a venv and build wheel using the selected interpreter
|
|
52
|
+
- name: Create venv and install maturin (Unix)
|
|
53
|
+
if: runner.os != 'Windows'
|
|
54
|
+
run: |
|
|
55
|
+
python -m venv .venv
|
|
56
|
+
VENV_PY=./.venv/bin/python
|
|
57
|
+
$VENV_PY -m pip install --upgrade pip
|
|
58
|
+
$VENV_PY -m pip install maturin
|
|
59
|
+
echo "VENV_PY=$VENV_PY" >> $GITHUB_ENV
|
|
60
|
+
|
|
61
|
+
- name: Create venv and install maturin (Windows)
|
|
62
|
+
if: runner.os == 'Windows'
|
|
63
|
+
shell: pwsh
|
|
64
|
+
run: |
|
|
65
|
+
python -m venv .venv
|
|
66
|
+
$VENV = '.\\.venv\\Scripts\\python.exe'
|
|
67
|
+
& $VENV -m pip install --upgrade pip
|
|
68
|
+
& $VENV -m pip install maturin
|
|
69
|
+
Write-Output "VENV_PY=$VENV" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
70
|
+
|
|
71
|
+
# Build wheel (Unix)
|
|
72
|
+
- name: Build wheel
|
|
73
|
+
if: runner.os != 'Windows'
|
|
74
|
+
run: |
|
|
75
|
+
$VENV_PY -m maturin build --release --out dist
|
|
76
|
+
|
|
77
|
+
- name: Build wheel (Windows)
|
|
78
|
+
if: runner.os == 'Windows'
|
|
79
|
+
shell: pwsh
|
|
80
|
+
run: |
|
|
81
|
+
$VENV = $env:VENV_PY
|
|
82
|
+
& $VENV -m maturin build --release --out dist
|
|
83
|
+
|
|
84
|
+
# Upload artifact
|
|
85
|
+
- name: Upload artifact
|
|
86
|
+
uses: actions/upload-artifact@v4
|
|
87
|
+
with:
|
|
88
|
+
name: wheel-${{ matrix.os }}-${{ matrix.python-version }}
|
|
89
|
+
path: dist/*
|
|
90
|
+
|
|
91
|
+
android:
|
|
92
|
+
name: Android build (maturin)
|
|
93
|
+
runs-on: ubuntu-latest
|
|
94
|
+
steps:
|
|
95
|
+
- uses: actions/checkout@v4
|
|
96
|
+
|
|
97
|
+
# Ensure Python
|
|
98
|
+
- name: Set up Python
|
|
99
|
+
uses: actions/setup-python@v5
|
|
100
|
+
with:
|
|
101
|
+
python-version: "3.11"
|
|
102
|
+
|
|
103
|
+
# Ensure Rust
|
|
104
|
+
- name: Install Rust
|
|
105
|
+
run: |
|
|
106
|
+
if ! command -v rustc &> /dev/null
|
|
107
|
+
then
|
|
108
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
109
|
+
source $HOME/.cargo/env
|
|
110
|
+
fi
|
|
111
|
+
rustc --version
|
|
112
|
+
cargo --version
|
|
113
|
+
|
|
114
|
+
# Install Maturin into a venv
|
|
115
|
+
- name: Create venv and install maturin (Android)
|
|
116
|
+
run: |
|
|
117
|
+
python -m venv .venv
|
|
118
|
+
VENV_PY=./.venv/bin/python
|
|
119
|
+
$VENV_PY -m pip install --upgrade pip
|
|
120
|
+
$VENV_PY -m pip install maturin
|
|
121
|
+
echo "VENV_PY=$VENV_PY" >> $GITHUB_ENV
|
|
122
|
+
|
|
123
|
+
# Install Android NDK
|
|
124
|
+
- name: Install Android NDK
|
|
125
|
+
run: |
|
|
126
|
+
sudo apt-get update
|
|
127
|
+
sudo apt-get install -y unzip wget
|
|
128
|
+
wget https://dl.google.com/android/repository/android-ndk-r26d-linux.zip
|
|
129
|
+
unzip -q android-ndk-r26d-linux.zip -d $HOME
|
|
130
|
+
echo "ANDROID_NDK_HOME=$HOME/android-ndk-r26d" >> $GITHUB_ENV
|
|
131
|
+
echo "$HOME/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
|
|
132
|
+
|
|
133
|
+
# Build Android wheel
|
|
134
|
+
- name: Build Android (aarch64)
|
|
135
|
+
run: |
|
|
136
|
+
$VENV_PY -m maturin build --release --target aarch64-linux-android --out dist
|
|
137
|
+
|
|
138
|
+
# Upload artifact
|
|
139
|
+
- name: Upload artifact
|
|
140
|
+
uses: actions/upload-artifact@v4
|
|
141
|
+
with:
|
|
142
|
+
name: wheel-android
|
|
143
|
+
path: dist/*
|
|
144
|
+
|
|
145
|
+
release:
|
|
146
|
+
name: Publish Release
|
|
147
|
+
needs: [build, android]
|
|
148
|
+
runs-on: ubuntu-latest
|
|
149
|
+
steps:
|
|
150
|
+
- name: Download all artifacts
|
|
151
|
+
uses: actions/download-artifact@v4
|
|
152
|
+
with:
|
|
153
|
+
path: dist
|
|
154
|
+
|
|
155
|
+
- name: Publish GitHub Release
|
|
156
|
+
uses: softprops/action-gh-release@v2
|
|
157
|
+
with:
|
|
158
|
+
tag_name: ${{ github.event.inputs.tag }}
|
|
159
|
+
name: "BustAPI Release ${{ github.event.inputs.tag }}"
|
|
160
|
+
draft: false
|
|
161
|
+
prerelease: false
|
|
162
|
+
files: dist/**/*
|
|
163
|
+
env:
|
|
164
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
bustapi-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
# PyInstaller
|
|
25
|
+
*.manifest
|
|
26
|
+
*.spec
|
|
27
|
+
|
|
28
|
+
# Installer logs
|
|
29
|
+
pip-log.txt
|
|
30
|
+
pip-delete-this-directory.txt
|
|
31
|
+
|
|
32
|
+
# Unit test / coverage reports
|
|
33
|
+
htmlcov/
|
|
34
|
+
.tox/
|
|
35
|
+
.nox/
|
|
36
|
+
.coverage
|
|
37
|
+
.coverage.*
|
|
38
|
+
.cache
|
|
39
|
+
nosetests.xml
|
|
40
|
+
coverage.xml
|
|
41
|
+
*.cover
|
|
42
|
+
.hypothesis/
|
|
43
|
+
.pytest_cache/
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
*.pot
|
|
48
|
+
|
|
49
|
+
# Django stuff
|
|
50
|
+
*.log
|
|
51
|
+
local_settings.py
|
|
52
|
+
db.sqlite3
|
|
53
|
+
|
|
54
|
+
# Flask stuff
|
|
55
|
+
instance/
|
|
56
|
+
.webassets-cache
|
|
57
|
+
|
|
58
|
+
# Scrapy stuff
|
|
59
|
+
.scrapy
|
|
60
|
+
|
|
61
|
+
# Sphinx documentation
|
|
62
|
+
docs/_build/
|
|
63
|
+
|
|
64
|
+
# PyBuilder
|
|
65
|
+
target/
|
|
66
|
+
|
|
67
|
+
# Jupyter Notebook
|
|
68
|
+
.ipynb_checkpoints
|
|
69
|
+
|
|
70
|
+
# IPython
|
|
71
|
+
profile_default/
|
|
72
|
+
ipython_config.py
|
|
73
|
+
|
|
74
|
+
# pyenv
|
|
75
|
+
.python-version
|
|
76
|
+
|
|
77
|
+
# celery beat schedule file
|
|
78
|
+
celerybeat-schedule
|
|
79
|
+
|
|
80
|
+
# SageMath parsed files
|
|
81
|
+
*.sage.py
|
|
82
|
+
|
|
83
|
+
# Environments
|
|
84
|
+
.env
|
|
85
|
+
.venv
|
|
86
|
+
env/
|
|
87
|
+
venv/
|
|
88
|
+
ENV/
|
|
89
|
+
env.bak/
|
|
90
|
+
venv.bak/
|
|
91
|
+
|
|
92
|
+
# Spyder project settings
|
|
93
|
+
.spyderproject
|
|
94
|
+
.spyproject
|
|
95
|
+
|
|
96
|
+
# Rope project settings
|
|
97
|
+
.ropeproject
|
|
98
|
+
|
|
99
|
+
# mkdocs documentation
|
|
100
|
+
/site
|
|
101
|
+
|
|
102
|
+
# mypy
|
|
103
|
+
.mypy_cache/
|
|
104
|
+
.dmypy.json
|
|
105
|
+
dmypy.json
|
|
106
|
+
|
|
107
|
+
# Pyre type checker
|
|
108
|
+
.pyre/
|
|
109
|
+
|
|
110
|
+
# Rust
|
|
111
|
+
target/
|
|
112
|
+
Cargo.lock
|
|
113
|
+
**/*.rs.bk
|
|
114
|
+
|
|
115
|
+
# IDE
|
|
116
|
+
.vscode/
|
|
117
|
+
.idea/
|
|
118
|
+
*.swp
|
|
119
|
+
*.swo
|
|
120
|
+
*~
|
|
121
|
+
|
|
122
|
+
# OS
|
|
123
|
+
.DS_Store
|
|
124
|
+
.DS_Store?
|
|
125
|
+
._*
|
|
126
|
+
.Spotlight-V100
|
|
127
|
+
.Trashes
|
|
128
|
+
ehthumbs.db
|
|
129
|
+
Thumbs.db
|
|
130
|
+
|
|
131
|
+
# Maturin
|
|
132
|
+
*.whl
|
|
133
|
+
|
|
134
|
+
# Temp files
|
|
135
|
+
*.tmp
|
|
136
|
+
*.temp
|
|
137
|
+
|
|
138
|
+
# UV
|
|
139
|
+
.uv/
|
|
140
|
+
uv.lock
|
|
141
|
+
|
|
142
|
+
ex.yml
|
|
143
|
+
ex.toml
|
|
144
|
+
ex.py.toml
|
|
145
|
+
|
|
146
|
+
.zen*
|
|
147
|
+
.mypy_*
|
|
148
|
+
.ruff_*
|