Skip to content

Commit ed4880e

Browse files
committed
Migrate package metadata to pyproject.toml, remove setup.py
1 parent 4ce9153 commit ed4880e

File tree

6 files changed

+105
-766
lines changed

6 files changed

+105
-766
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ jobs:
3333
- name: Run tests
3434
run: pytest -k "not example"
3535
env:
36-
API_KEY: ${{secrets.API_KEY}}
36+
API_KEY: ${{ secrets.API_KEY }}
3737

3838
- name: Run example tests
3939
if: matrix.python-version == '3.13'
4040
run: pytest -k "example"
4141
env:
42-
API_KEY: ${{secrets.API_KEY}}
42+
API_KEY: ${{ secrets.API_KEY }}

.github/workflows/release.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,18 @@ jobs:
7171
name: dist
7272
path: dist/
7373

74+
- uses: actions/setup-python@v5
75+
with:
76+
python-version: "3.13"
77+
7478
- name: Create GitHub Release
7579
env:
7680
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7781
GH_REPO: ${{ github.repository }}
7882
run: gh release create ${{ github.ref_name }} dist/* --generate-notes
7983

8084
- name: Install twine
81-
run: pip install twine
85+
run: pip install --upgrade pip twine
8286

8387
- name: Publish to PyPI
8488
env:
@@ -91,3 +95,47 @@ jobs:
9195
TWINE_USERNAME: ${{ github.repository_owner }}
9296
TWINE_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
9397
run: twine upload --repository-url https://pypi.pkg.github.com/${{ github.repository_owner }} dist/*
98+
99+
smoke-test:
100+
name: Smoke test published package
101+
needs: [publish]
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/setup-python@v5
105+
with:
106+
python-version: "3.13"
107+
108+
- name: Wait for PyPI availability
109+
run: |
110+
VERSION=${GITHUB_REF_NAME#v}
111+
echo "Waiting for serpapi==$VERSION on PyPI..."
112+
for i in $(seq 1 12); do
113+
if pip index versions serpapi 2>/dev/null | grep -q "$VERSION"; then
114+
echo "Available!"
115+
exit 0
116+
fi
117+
echo "Attempt $i/12 — sleeping 10s..."
118+
sleep 10
119+
done
120+
echo "Timed out waiting for PyPI propagation" && exit 1
121+
122+
- name: Install from PyPI
123+
run: |
124+
VERSION=${GITHUB_REF_NAME#v}
125+
pip install "serpapi==$VERSION"
126+
127+
- name: Verify import and version
128+
env:
129+
API_KEY: ${{ secrets.API_KEY }}
130+
run: |
131+
VERSION=${GITHUB_REF_NAME#v}
132+
python - <<PY
133+
import os
134+
import serpapi
135+
assert serpapi.__version__ == '$VERSION', f'Version mismatch: {serpapi.__version__} != $VERSION'
136+
print(f'OK: serpapi=={serpapi.__version__} installed successfully')
137+
client = serpapi.Client(api_key=os.environ["API_KEY"])
138+
results = client.search({"engine": "google", "q": "coffee"})
139+
assert results.get("organic_results"), "No organic results returned"
140+
print(f'OK: live search returned {len(results["organic_results"])} organic results')
141+
PY

Pipfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)