Skip to content

Commit 53368c7

Browse files
OriNachumclaude
andauthored
fix: stabilize PyPI deployment pipeline (#49)
* fix: stabilize PyPI deployment pipeline Root cause: v0.4.2 tag pointed to a commit where version.py still said 0.4.1, causing PyPI to reject the duplicate version upload. - Remove setup.py (conflicts with pyproject.toml: wrong python_requires, missing deps, causes setuptools warnings) - Simplify publish.yml: replace 6 redundant pip/uv steps with uv build + twine check verification - Fix pyproject.toml deprecations: SPDX license format, remove deprecated classifier, bump setuptools>=77.0.0 - Update _config.yml to remove deleted setup.py from exclude list - Add PR workflow instructions to CLAUDE.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: pin Python 3.12 in publish workflow Address review feedback: explicitly pin Python version via setup-uv to avoid fragility when runner images update their default Python. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: auto-release on version bump Add workflow that triggers when version.py changes on main: - Extracts version from version.py - Deletes stale tags pointing to wrong commits - Creates GitHub Release (which triggers publish.yml → PyPI) This makes the release flow fully automatic: merge PR with version bump → auto-release → auto-publish to PyPI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6bed19d commit 53368c7

File tree

7 files changed

+86
-73
lines changed

7 files changed

+86
-73
lines changed

.github/workflows/auto-release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Auto Release on Version Bump
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "src/open_responses_server/version.py"
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
auto-release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Extract version
22+
id: version
23+
run: |
24+
VERSION=$(python3 -c "import re; print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', open('src/open_responses_server/version.py').read()).group(1))")
25+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
26+
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
27+
28+
- name: Check if release already exists
29+
id: check
30+
run: |
31+
if gh release view "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
32+
echo "exists=true" >> "$GITHUB_OUTPUT"
33+
else
34+
echo "exists=false" >> "$GITHUB_OUTPUT"
35+
fi
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Delete stale tag if exists
40+
if: steps.check.outputs.exists == 'false'
41+
run: |
42+
if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
43+
git push origin ":refs/tags/${{ steps.version.outputs.tag }}" || true
44+
fi
45+
env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Create GitHub Release
49+
if: steps.check.outputs.exists == 'false'
50+
run: |
51+
gh release create "${{ steps.version.outputs.tag }}" \
52+
--title "Release ${{ steps.version.outputs.tag }}" \
53+
--generate-notes \
54+
--target "${{ github.sha }}"
55+
env:
56+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,16 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- name: Set up Python 3.x
19-
uses: actions/setup-python@v5
18+
- name: Install uv and Python
19+
uses: astral-sh/setup-uv@v4
2020
with:
21-
python-version: "3.x"
22-
23-
- name: Install uv
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install uv
27-
28-
- name: Set up uv env
29-
run: |
30-
uv venv
31-
32-
- name: Install build dependencies with uv
33-
run: |
34-
uv pip install build setuptools wheel
35-
uv pip install -e ".[dev]"
36-
37-
- name: Install build module
38-
run: |
39-
python -m pip install --upgrade pip
40-
pip install build
21+
python-version: "3.12"
4122

4223
- name: Build release distributions
43-
run: python -m build
24+
run: uv build
25+
26+
- name: Verify distributions
27+
run: uvx twine check dist/*
4428

4529
- name: Upload distributions
4630
uses: actions/upload-artifact@v4
@@ -69,4 +53,4 @@ jobs:
6953
- name: Publish release distributions to PyPI
7054
uses: pypa/gh-action-pypi-publish@release/v1
7155
with:
72-
packages-dir: dist/
56+
packages-dir: dist/

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,7 @@ Version lives in `src/open_responses_server/version.py` as `__version__` and is
9191
## CLI Entry Point
9292

9393
The `otc` command is defined in `pyproject.toml` pointing to `open_responses_server.cli:main`. Commands: `start`, `configure`, `help`.
94+
95+
## PR Workflow
96+
97+
When a plan is ready and implementation is complete, create a PR and run the `/pr-review` skill. The PR review workflow should: wait 5 minutes for automated reviewers to run, then check every 2 minutes for completion before fetching and addressing review comments.

_config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ exclude:
5252
- demo/
5353
- examples/
5454
- pyproject.toml
55-
- setup.py
5655
- uv.lock
5756
- run_tests.sh
5857
- release.py

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0", "wheel"]
2+
requires = ["setuptools>=77.0.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -10,7 +10,7 @@ authors = [
1010
{ name = "Ori Nachum", email = "ori.nachum@gmail.com" }
1111
]
1212
readme = "README.md"
13-
license = { text = "MIT" }
13+
license = "MIT"
1414
requires-python = ">=3.12"
1515
dependencies = [
1616
"mcp>=1.0.0",
@@ -24,7 +24,6 @@ dependencies = [
2424
]
2525
classifiers = [
2626
"Programming Language :: Python :: 3",
27-
"License :: OSI Approved :: MIT License",
2827
"Operating System :: OS Independent",
2928
"Environment :: Web Environment",
3029
]

setup.py

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

uv.lock

Lines changed: 16 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)