lazyreqs 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.
- lazyreqs-0.1.0/.github/workflows/ci.yml +223 -0
- lazyreqs-0.1.0/.gitignore +31 -0
- lazyreqs-0.1.0/Cargo.lock +2069 -0
- lazyreqs-0.1.0/Cargo.toml +47 -0
- lazyreqs-0.1.0/PKG-INFO +374 -0
- lazyreqs-0.1.0/README.md +354 -0
- lazyreqs-0.1.0/benchmarks/bench_lazy.py +209 -0
- lazyreqs-0.1.0/pyproject.toml +37 -0
- lazyreqs-0.1.0/python/lazyreqs/__init__.py +208 -0
- lazyreqs-0.1.0/python/lazyreqs/_lazyreqs.pyi +81 -0
- lazyreqs-0.1.0/python/lazyreqs/_version.py +3 -0
- lazyreqs-0.1.0/python/lazyreqs/exceptions.py +106 -0
- lazyreqs-0.1.0/python/lazyreqs/models.py +444 -0
- lazyreqs-0.1.0/python/lazyreqs/py.typed +0 -0
- lazyreqs-0.1.0/python/lazyreqs/sessions.py +495 -0
- lazyreqs-0.1.0/python/lazyreqs/structures.py +218 -0
- lazyreqs-0.1.0/src/error.rs +172 -0
- lazyreqs-0.1.0/src/lazy.rs +200 -0
- lazyreqs-0.1.0/src/lib.rs +52 -0
- lazyreqs-0.1.0/src/proxy.rs +140 -0
- lazyreqs-0.1.0/src/response.rs +187 -0
- lazyreqs-0.1.0/src/session.rs +852 -0
- lazyreqs-0.1.0/tests/_server.py +228 -0
- lazyreqs-0.1.0/tests/test_pyureq_compat.py +745 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["**"]
|
|
6
|
+
tags: ["v*"]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: ["**"]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
gate:
|
|
17
|
+
name: Check for duplicate tag push
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
outputs:
|
|
20
|
+
skip: ${{ steps.tag.outputs.skip }}
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0 # tags are needed by `git tag --points-at`
|
|
25
|
+
- id: tag
|
|
26
|
+
run: |
|
|
27
|
+
# `git push main --follow-tags` fires both a branch and a tag event.
|
|
28
|
+
# The tag run does the real work; the branch run (same commit) is
|
|
29
|
+
# redundant, so it skips lint/test/build.
|
|
30
|
+
if [ "${{ github.ref_type }}" = "branch" ] && [ -n "$(git tag --points-at HEAD)" ]; then
|
|
31
|
+
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
32
|
+
else
|
|
33
|
+
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
lint:
|
|
37
|
+
name: Lint
|
|
38
|
+
needs: gate
|
|
39
|
+
if: needs.gate.outputs.skip != 'true'
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
|
|
45
|
+
- name: Set up Python
|
|
46
|
+
uses: actions/setup-python@v5
|
|
47
|
+
with:
|
|
48
|
+
python-version: "3.12"
|
|
49
|
+
|
|
50
|
+
- name: Install ruff
|
|
51
|
+
run: pip install ruff
|
|
52
|
+
|
|
53
|
+
- name: Lint Python (ruff)
|
|
54
|
+
run: ruff check python/
|
|
55
|
+
|
|
56
|
+
- name: Install Rust toolchain (with clippy + rustfmt)
|
|
57
|
+
shell: bash
|
|
58
|
+
run: |
|
|
59
|
+
for attempt in 1 2 3 4; do
|
|
60
|
+
rustup toolchain install stable --profile minimal --no-self-update \
|
|
61
|
+
--component clippy --component rustfmt \
|
|
62
|
+
&& rustup default stable \
|
|
63
|
+
&& break
|
|
64
|
+
echo "Attempt $attempt failed, retrying in $((attempt * 15))s..."
|
|
65
|
+
sleep $((attempt * 15))
|
|
66
|
+
done
|
|
67
|
+
|
|
68
|
+
- name: Cache Rust build artifacts
|
|
69
|
+
uses: Swatinem/rust-cache@v2
|
|
70
|
+
|
|
71
|
+
- name: Lint Rust (clippy)
|
|
72
|
+
run: cargo clippy --all-targets -- -D warnings
|
|
73
|
+
|
|
74
|
+
- name: Check Rust formatting
|
|
75
|
+
run: cargo fmt --check
|
|
76
|
+
|
|
77
|
+
test:
|
|
78
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
79
|
+
needs: gate
|
|
80
|
+
if: needs.gate.outputs.skip != 'true'
|
|
81
|
+
# ubuntu-24.04: the 26.04 image no longer provides Python 3.9 builds
|
|
82
|
+
# (python-versions only ships 3.9 for 22.04/24.04).
|
|
83
|
+
runs-on: ubuntu-24.04
|
|
84
|
+
strategy:
|
|
85
|
+
fail-fast: false
|
|
86
|
+
matrix:
|
|
87
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
88
|
+
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
|
|
92
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
93
|
+
uses: actions/setup-python@v5
|
|
94
|
+
with:
|
|
95
|
+
python-version: ${{ matrix.python-version }}
|
|
96
|
+
|
|
97
|
+
- name: Install Rust toolchain
|
|
98
|
+
shell: bash
|
|
99
|
+
run: |
|
|
100
|
+
for attempt in 1 2 3 4; do
|
|
101
|
+
rustup toolchain install stable --profile minimal --no-self-update \
|
|
102
|
+
&& rustup default stable \
|
|
103
|
+
&& break
|
|
104
|
+
echo "Attempt $attempt failed, retrying in $((attempt * 15))s..."
|
|
105
|
+
sleep $((attempt * 15))
|
|
106
|
+
done
|
|
107
|
+
|
|
108
|
+
- name: Cache Rust build artifacts
|
|
109
|
+
uses: Swatinem/rust-cache@v2
|
|
110
|
+
|
|
111
|
+
- name: Install maturin
|
|
112
|
+
run: pip install maturin
|
|
113
|
+
|
|
114
|
+
- name: Build and install wheel
|
|
115
|
+
run: |
|
|
116
|
+
maturin build --release
|
|
117
|
+
pip install target/wheels/*.whl
|
|
118
|
+
|
|
119
|
+
- name: Install test dependencies
|
|
120
|
+
run: pip install pytest
|
|
121
|
+
|
|
122
|
+
- name: Run tests
|
|
123
|
+
run: pytest tests/ -v
|
|
124
|
+
|
|
125
|
+
build-wheels:
|
|
126
|
+
name: Build wheels (${{ matrix.os }})
|
|
127
|
+
needs: gate
|
|
128
|
+
if: needs.gate.outputs.skip != 'true'
|
|
129
|
+
runs-on: ${{ matrix.os }}
|
|
130
|
+
strategy:
|
|
131
|
+
fail-fast: false
|
|
132
|
+
matrix:
|
|
133
|
+
# abi3-py39: a single cp39-abi3 wheel per platform/architecture.
|
|
134
|
+
# macos-latest is arm64; macos-26-intel covers the Intel slice.
|
|
135
|
+
os: [ubuntu-latest, macos-latest, macos-26-intel, windows-latest]
|
|
136
|
+
|
|
137
|
+
steps:
|
|
138
|
+
- uses: actions/checkout@v4
|
|
139
|
+
|
|
140
|
+
- name: Install Rust toolchain
|
|
141
|
+
shell: bash
|
|
142
|
+
run: |
|
|
143
|
+
for attempt in 1 2 3 4; do
|
|
144
|
+
rustup toolchain install stable --profile minimal --no-self-update \
|
|
145
|
+
&& rustup default stable \
|
|
146
|
+
&& break
|
|
147
|
+
echo "Attempt $attempt failed, retrying in $((attempt * 15))s..."
|
|
148
|
+
sleep $((attempt * 15))
|
|
149
|
+
done
|
|
150
|
+
|
|
151
|
+
- name: Cache Rust build artifacts
|
|
152
|
+
uses: Swatinem/rust-cache@v2
|
|
153
|
+
|
|
154
|
+
- name: Build wheels
|
|
155
|
+
uses: PyO3/maturin-action@v1
|
|
156
|
+
with:
|
|
157
|
+
command: build
|
|
158
|
+
# abi3-py39 + generate-import-lib: one cp39-abi3 wheel per platform,
|
|
159
|
+
# no Python interpreter required (works on Windows without python3.9).
|
|
160
|
+
args: --release --out dist
|
|
161
|
+
|
|
162
|
+
- name: Build source distribution
|
|
163
|
+
if: matrix.os == 'ubuntu-latest'
|
|
164
|
+
uses: PyO3/maturin-action@v1
|
|
165
|
+
with:
|
|
166
|
+
command: sdist
|
|
167
|
+
args: --out dist
|
|
168
|
+
|
|
169
|
+
- name: Upload wheels
|
|
170
|
+
uses: actions/upload-artifact@v4
|
|
171
|
+
with:
|
|
172
|
+
name: wheels-${{ matrix.os }}
|
|
173
|
+
path: dist/
|
|
174
|
+
|
|
175
|
+
release:
|
|
176
|
+
name: Publish to PyPI + GitHub Release
|
|
177
|
+
runs-on: ubuntu-latest
|
|
178
|
+
needs: [gate, lint, test, build-wheels]
|
|
179
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
180
|
+
environment: pypi
|
|
181
|
+
permissions:
|
|
182
|
+
id-token: write
|
|
183
|
+
contents: write # required for GitHub Release creation
|
|
184
|
+
|
|
185
|
+
steps:
|
|
186
|
+
- uses: actions/checkout@v4
|
|
187
|
+
|
|
188
|
+
- uses: actions/download-artifact@v4
|
|
189
|
+
with:
|
|
190
|
+
pattern: wheels-*
|
|
191
|
+
merge-multiple: true
|
|
192
|
+
path: dist/
|
|
193
|
+
|
|
194
|
+
- name: Publish to PyPI
|
|
195
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
196
|
+
|
|
197
|
+
- name: Create GitHub Release
|
|
198
|
+
uses: softprops/action-gh-release@v2
|
|
199
|
+
with:
|
|
200
|
+
files: dist/*
|
|
201
|
+
generate_release_notes: true
|
|
202
|
+
body: |
|
|
203
|
+
## Installation
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
pip install lazyreqs==${{ github.ref_name }}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Full changelog: https://github.com/${{ github.repository }}/releases
|
|
210
|
+
|
|
211
|
+
- name: Update repository About description
|
|
212
|
+
env:
|
|
213
|
+
GH_TOKEN: ${{ github.token }}
|
|
214
|
+
run: |
|
|
215
|
+
gh api --method PATCH /repos/${{ github.repository }} \
|
|
216
|
+
-f description="Tokio-powered requests/pyureq drop-in replacement with zero-await lazy concurrency" \
|
|
217
|
+
-f homepage="https://pypi.org/project/lazyreqs/" \
|
|
218
|
+
-f topics[]="python" \
|
|
219
|
+
-f topics[]="rust" \
|
|
220
|
+
-f topics[]="http" \
|
|
221
|
+
-f topics[]="requests" \
|
|
222
|
+
-f topics[]="pyo3" \
|
|
223
|
+
-f topics[]="tokio" || true
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
*.so
|
|
9
|
+
*.pyd
|
|
10
|
+
|
|
11
|
+
# Rust
|
|
12
|
+
target/
|
|
13
|
+
Cargo.lock.orig
|
|
14
|
+
|
|
15
|
+
# Environments
|
|
16
|
+
.venv/
|
|
17
|
+
venv/
|
|
18
|
+
env/
|
|
19
|
+
|
|
20
|
+
# Tooling
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
.mypy_cache/
|
|
23
|
+
.ruff_cache/
|
|
24
|
+
.coverage
|
|
25
|
+
htmlcov/
|
|
26
|
+
|
|
27
|
+
# Editors / OS
|
|
28
|
+
.vscode/
|
|
29
|
+
.idea/
|
|
30
|
+
.DS_Store
|
|
31
|
+
Thumbs.db
|