Repository navigation
272 lines (246 loc) · 8.63 KB
/
Copy pathpython-package.yml
File metadata and controls
272 lines (246 loc) · 8.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Package
on:
push:
branches: [ "master" ]
pull_request: {}
env:
PYTHON_VERSION: "3.13"
jobs:
bandit:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
test: "true"
- name: Run bandit
run: bandit -c pyproject.toml -r instagrapi
dependency-audit:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
test: "true"
- name: Run pip-audit
run: pip-audit --strict --progress-spinner off .
lint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
test: "true"
- name: Run Ruff
run: |
ruff check --output-format=github .
ruff format --check .
minimum-runtime-dependencies:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install package with minimum runtime dependencies
run: |
python -m pip install --upgrade pip
python -m pip install \
"curl_cffi==0.15.0" \
"requests==2.34.2" \
"PySocks==1.7.1" \
"pydantic==2.12.5" \
"Pillow==13.0.0" \
"pycryptodomex==3.23.0"
python -m pip install .
python -m pip check
python - <<'PY'
from instagrapi import Client
assert Client().private_transport == "curl"
PY
test-compat:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
steps:
- name: Check out code
uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
test: "true"
- name: Run full offline regression suite
env:
PYTHON_DOTENV_DISABLED: "1"
TEST_ACCOUNTS_URL: ""
run: pytest -q tests/regression
test-utls-native:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/setup-go@v7
with:
go-version: "1.27.2"
cache-dependency-path: instagrapi/native/go.sum
- name: Install Python test dependencies
uses: ./.github/actions/install-dependencies
with:
test: "true"
- name: Build verified strict native transport
working-directory: ${{ runner.temp }}
env:
PYTHONPATH: ""
run: python -m instagrapi.utls_native "$GITHUB_WORKSPACE/.utls-native"
- name: Exercise actual native TLS and HTTP/2 on loopback
env:
PYTHON_DOTENV_DISABLED: "1"
TEST_ACCOUNTS_URL: ""
run: |
library=$(python -c 'from instagrapi.utls_native import native_library_asset; print(native_library_asset().name)')
INSTAGRAPI_UTLS_TEST_LIBRARY="$PWD/.utls-native/$library" pytest -q \
tests/regression/test_utls_transport_wire.py \
tests/regression/test_utls_failures_wire.py \
tests/regression/test_utls_peer_wire.py
default-install:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Verify a clean standard installation
shell: bash
run: |
python - <<'PY'
import os
import subprocess
import sys
from pathlib import Path
environment = Path(".default-install").resolve()
subprocess.run([sys.executable, "-m", "venv", str(environment)], check=True)
python = environment / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
subprocess.run([str(python), "-m", "pip", "install", "."], check=True)
subprocess.run([str(python), "-m", "pip", "check"], check=True)
code = """
import importlib.util
from instagrapi import Client
assert importlib.util.find_spec("h2") is None
assert importlib.util.find_spec("curl_adapter") is None
client = Client()
assert client.private_transport == "curl"
assert callable(client.login_legacy)
print(type(client.private).__name__, client.private_transport)
"""
subprocess.run([str(python), "-c", code], cwd=environment, check=True)
PY
test-curl-transport:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11", "3.14" ]
curl-cffi: [ "curl_cffi==0.15.0", "curl_cffi" ]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install standard package and wire test dependencies
run: python -m pip install . "${{ matrix.curl-cffi }}" pytest "h2>=4.3,<5" "cryptography>=46,<47"
- name: Verify dependencies and run real TLS/HTTP2 tests
run: |
python -c "import curl_cffi, h2, cryptography"
pytest -q tests/regression/test_default_transport.py tests/regression/test_private_transport.py tests/regression/test_private_transport_wire.py
public-curl-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.14"]
dependencies: [minimum, current]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install optional public transport dependencies
env:
DEPENDENCIES: ${{ matrix.dependencies }}
run: |
if [ "$DEPENDENCIES" = minimum ]; then
python -m pip install ".[curl]" pytest "urllib3>=2.8.0" "curl-adapter==1.2.3" "curl_cffi==0.15.0"
else
python -m pip install ".[curl]" pytest "urllib3>=2.8.0"
fi
python -m pip check
- name: Check public curl response bodies on loopback
run: |
python -c "import curl_adapter"
python -m pytest -q tests/regression/test_public_transport.py tests/regression/test_public_transport_wire.py
build-docs:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master')
steps:
- name: Check out code
uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
test: "true"
- name: Build Docs
run: mkdocs build --strict
# upload artifact for dev build
- name: Upload coverage results artifact
if: github.ref != 'refs/heads/master'
uses: actions/upload-artifact@v7
with:
name: docs-site
path: site/
update-dev-docs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Check out code
uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
test: "true"
- name: Push documentation changes
uses: ./.github/actions/publish-docs-with-mike
with:
version_name: dev