Skip to content

Commit fab89ed

Browse files
committed
build: streamline dependency management
1 parent dcc4129 commit fab89ed

File tree

3 files changed

+99
-99
lines changed

3 files changed

+99
-99
lines changed

.github/workflows/ci.yml

Lines changed: 87 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,22 @@ name: CI
88
on:
99
push:
1010
tags:
11-
- '*'
11+
- "*"
1212
pull_request:
1313
paths-ignore:
14-
- 'docs/**'
15-
- 'benchmark/**'
16-
- '*.pyi'
17-
- '*.md'
18-
- '.github/**'
19-
- 'python/**'
20-
- 'README.md'
14+
- "docs/**"
15+
- "benchmark/**"
16+
- "*.pyi"
17+
- "*.md"
18+
- ".github/**"
19+
- "python/**"
20+
- "README.md"
2121
workflow_dispatch:
2222

2323
concurrency:
2424
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
2525
cancel-in-progress: true
2626

27-
env:
28-
MATURIN_VERSION: '1.10.2'
29-
3027
permissions:
3128
contents: write
3229
packages: write
@@ -71,7 +68,8 @@ jobs:
7168
source .venv/bin/activate
7269
- name: Install dependencies
7370
run: |
74-
uv pip install maturin==${{ env.MATURIN_VERSION }} pytest pytest-asyncio pytest-rerunfailures
71+
uv pip install .[test]
72+
uv pip install maturin
7573
- name: Build wheels
7674
run: |
7775
source .venv/bin/activate
@@ -95,7 +93,7 @@ jobs:
9593
- runner: ubuntu-latest
9694
target: x86_64
9795
allocator: jemalloc
98-
apt_packages: ''
96+
apt_packages: ""
9997
custom_env: {}
10098
- runner: ubuntu-latest
10199
target: x86
@@ -140,9 +138,9 @@ jobs:
140138
rust-toolchain: stable
141139
target: ${{ matrix.platform.target }}
142140
args: ${{ matrix.platform.target == 'x86_64' && '--release --out dist --zig' || '--release --out dist' }} ${{ matrix.build_type.maturin_args }} --features ${{ matrix.platform.allocator }}
143-
sccache: 'false'
141+
sccache: "false"
144142
manylinux: auto
145-
container: 'off'
143+
container: "off"
146144
env: ${{ matrix.platform.custom_env }}
147145
- name: Upload wheels
148146
uses: actions/upload-artifact@v7
@@ -176,8 +174,7 @@ jobs:
176174
steps:
177175
- uses: actions/checkout@v6
178176
- name: Build wheels
179-
run:
180-
bash .github/musl_build.sh ${{ matrix.platform.target }} "${{ matrix.build_type.maturin_args }}" --features "${{ matrix.platform.allocator }}"
177+
run: bash .github/musl_build.sh ${{ matrix.platform.target }} "${{ matrix.build_type.maturin_args }}" --features "${{ matrix.platform.allocator }}"
181178
env:
182179
MATURIN_VERSION: ${{ env.MATURIN_VERSION }}
183180
- name: Upload wheels
@@ -224,7 +221,7 @@ jobs:
224221
maturin-version: ${{ env.MATURIN_VERSION }}
225222
target: ${{ matrix.platform.target }}
226223
args: --release --out dist ${{ matrix.build_type.maturin_args }} --features ${{ matrix.platform.allocator || '' }}
227-
sccache: 'false'
224+
sccache: "false"
228225
- name: Upload wheels
229226
uses: actions/upload-artifact@v7
230227
with:
@@ -263,7 +260,7 @@ jobs:
263260
maturin-version: ${{ env.MATURIN_VERSION }}
264261
target: ${{ matrix.platform.target }}
265262
args: --release --out dist ${{ matrix.build_type.maturin_args }} --features ${{ matrix.platform.allocator || '' }}
266-
sccache: 'false'
263+
sccache: "false"
267264
- name: Upload wheels
268265
uses: actions/upload-artifact@v7
269266
with:
@@ -276,78 +273,78 @@ jobs:
276273
strategy:
277274
matrix:
278275
include:
279-
- thing: arm64-android
280-
target: aarch64-linux-android
281-
arch: aarch64
282-
python_version: 3.14.0
283-
features: abi3-py314
284-
- thing: x86_64-android
285-
target: x86_64-linux-android
286-
arch: x86_64
287-
python_version: 3.14.0
288-
features: abi3-py314
276+
- thing: arm64-android
277+
target: aarch64-linux-android
278+
arch: aarch64
279+
python_version: 3.14.0
280+
features: abi3-py314
281+
- thing: x86_64-android
282+
target: x86_64-linux-android
283+
arch: x86_64
284+
python_version: 3.14.0
285+
features: abi3-py314
289286

290287
steps:
291-
- uses: actions/checkout@v6
292-
- uses: actions/setup-python@v6
293-
with:
294-
python-version: 3.x
295-
- name: Set Android Linker path
296-
if: endsWith(matrix.thing, '-android')
297-
run: |
298-
LINKER_PATH="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++"
299-
echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$LINKER_PATH" >> "$GITHUB_ENV"
300-
echo "$PATH:$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_PATH"
301-
env
302-
- name: Download and setup Android Python
303-
run: |
304-
wget https://www.python.org/ftp/python/${{ matrix.python_version }}/python-${{ matrix.python_version }}-${{ matrix.arch }}-linux-android.tar.gz
305-
306-
mkdir -p /tmp/python-android
307-
tar -xzf python-${{ matrix.python_version }}-${{ matrix.arch }}-linux-android.tar.gz -C /tmp/python-android --strip-components=1
308-
309-
mv /tmp/python-android/prefix/lib /tmp/python-android/
310-
mv /tmp/python-android/prefix/include /tmp/python-android/
311-
312-
echo "RUSTFLAGS=-L native=/tmp/python-android/lib" >> "$GITHUB_ENV"
313-
314-
echo "=== Root directory after move ==="
315-
ls -la /tmp/python-android/
316-
echo "=== Lib directory ==="
317-
ls -la /tmp/python-android/lib/ | head -10
318-
echo "=== Include directory ==="
319-
ls -la /tmp/python-android/include/
320-
- name: Build wheels
321-
uses: PyO3/maturin-action@v1
322-
with:
323-
maturin-version: ${{ env.MATURIN_VERSION }}
324-
rust-toolchain: stable
325-
target: ${{ matrix.target }}
326-
args: --release --out dist --no-default-features --features ${{ matrix.features }} --skip-auditwheel
327-
sccache: 'false'
328-
container: 'off'
329-
- name: Fix Android wheel platform tags
330-
run: |
331-
cd dist
332-
for wheel in *.whl; do
333-
case "$wheel" in
334-
*linux_aarch64*)
335-
new_wheel=${wheel/linux_aarch64/android_21_arm64_v8a}
336-
mv "$wheel" "$new_wheel"
337-
echo "Renamed: $wheel -> $new_wheel"
338-
;;
339-
*linux_x86_64*)
340-
new_wheel=${wheel/linux_x86_64/android_21_x86_64}
341-
mv "$wheel" "$new_wheel"
342-
echo "Renamed: $wheel -> $new_wheel"
343-
;;
344-
esac
345-
done
346-
- name: Upload wheels
347-
uses: actions/upload-artifact@v7
348-
with:
349-
name: wheels-android-${{ matrix.target }}
350-
path: dist
288+
- uses: actions/checkout@v6
289+
- uses: actions/setup-python@v6
290+
with:
291+
python-version: 3.x
292+
- name: Set Android Linker path
293+
if: endsWith(matrix.thing, '-android')
294+
run: |
295+
LINKER_PATH="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++"
296+
echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$LINKER_PATH" >> "$GITHUB_ENV"
297+
echo "$PATH:$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_PATH"
298+
env
299+
- name: Download and setup Android Python
300+
run: |
301+
wget https://www.python.org/ftp/python/${{ matrix.python_version }}/python-${{ matrix.python_version }}-${{ matrix.arch }}-linux-android.tar.gz
302+
303+
mkdir -p /tmp/python-android
304+
tar -xzf python-${{ matrix.python_version }}-${{ matrix.arch }}-linux-android.tar.gz -C /tmp/python-android --strip-components=1
305+
306+
mv /tmp/python-android/prefix/lib /tmp/python-android/
307+
mv /tmp/python-android/prefix/include /tmp/python-android/
308+
309+
echo "RUSTFLAGS=-L native=/tmp/python-android/lib" >> "$GITHUB_ENV"
310+
311+
echo "=== Root directory after move ==="
312+
ls -la /tmp/python-android/
313+
echo "=== Lib directory ==="
314+
ls -la /tmp/python-android/lib/ | head -10
315+
echo "=== Include directory ==="
316+
ls -la /tmp/python-android/include/
317+
- name: Build wheels
318+
uses: PyO3/maturin-action@v1
319+
with:
320+
maturin-version: ${{ env.MATURIN_VERSION }}
321+
rust-toolchain: stable
322+
target: ${{ matrix.target }}
323+
args: --release --out dist --no-default-features --features ${{ matrix.features }} --skip-auditwheel
324+
sccache: "false"
325+
container: "off"
326+
- name: Fix Android wheel platform tags
327+
run: |
328+
cd dist
329+
for wheel in *.whl; do
330+
case "$wheel" in
331+
*linux_aarch64*)
332+
new_wheel=${wheel/linux_aarch64/android_21_arm64_v8a}
333+
mv "$wheel" "$new_wheel"
334+
echo "Renamed: $wheel -> $new_wheel"
335+
;;
336+
*linux_x86_64*)
337+
new_wheel=${wheel/linux_x86_64/android_21_x86_64}
338+
mv "$wheel" "$new_wheel"
339+
echo "Renamed: $wheel -> $new_wheel"
340+
;;
341+
esac
342+
done
343+
- name: Upload wheels
344+
uses: actions/upload-artifact@v7
345+
with:
346+
name: wheels-android-${{ matrix.target }}
347+
path: dist
351348

352349
sdist:
353350
runs-on: ubuntu-latest
@@ -382,7 +379,7 @@ jobs:
382379
- name: Generate artifact attestation
383380
uses: actions/attest-build-provenance@v4
384381
with:
385-
subject-path: 'wheels-*/*'
382+
subject-path: "wheels-*/*"
386383
- name: Publish to PyPI
387384
if: ${{ startsWith(github.ref, 'refs/tags/') }}
388385
uses: PyO3/maturin-action@v1

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ build:
2828
# https://docs.readthedocs.io/page/guides/reproducible-builds.html
2929
install:
3030
- pip install zensical
31-
- pip install -r docs/requirements.txt
31+
- pip install .[docs]
3232
build:
3333
html:
3434
- zensical build -f docs/mkdocs.yml

pyproject.toml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,24 @@ authors = [{ name = "0x676e67", email = "[email protected]" }]
2929
keywords = ["http", "client", "websocket", "ja3", "ja4"]
3030

3131
[tool.maturin]
32-
features = ["pyo3/extension-module", "pyo3/generate-import-lib"]
33-
strip = true
3432
python-source = "python"
3533

3634
[project.urls]
3735
Documentation = "https://python.wreq.org"
3836
Homepage = "https://github.com/0x676e67/wreq-python"
3937
Repository = "https://github.com/0x676e67/wreq-python"
4038

41-
[dependency-groups]
42-
dev = [
43-
"pytest>=8.3.5; python_version >= '3.8'",
44-
"pytest>=7.4.4; python_version == '3.7'",
45-
"pytest-asyncio>=0.25.3; python_version >= '3.9'",
46-
"pytest-rerunfailures>=15.0; python_version >= '3.9'",
39+
[project.optional-dependencies]
40+
test = [
41+
"pytest",
42+
"pytest-asyncio",
43+
"pytest-rerunfailures",
44+
]
45+
docs = [
46+
"zensical",
47+
"mkdocs-material>=9.5.0",
48+
"mkdocstrings[python]>=1.0.3",
49+
"mike>=2.0.0",
4750
]
4851

4952
[tool.ruff]

0 commit comments

Comments
 (0)