diff --git a/.agents/skills/release-preparation/SKILL.md b/.agents/skills/release-preparation/SKILL.md index d30bac3..f76cf16 100644 --- a/.agents/skills/release-preparation/SKILL.md +++ b/.agents/skills/release-preparation/SKILL.md @@ -5,16 +5,17 @@ description: Preparing duroxide-python release pull requests. Use when bumping t # Release Preparation -This skill prepares the repository changes for a release. Publishing is handled -by Microsoft's internal release infrastructure as described in -`RELEASE_POLICY.md`. +This skill covers release preparation, tagging, and GitHub release notes. +Only Microsoft's internal release pipeline publishes to PyPI, as described +in `RELEASE_POLICY.md`. -Do not publish to PyPI, create a GitHub Release, start the internal release -pipeline, or request publishing credentials. +Do not publish directly to PyPI, start the internal release pipeline, or +request publishing credentials. ## Prepare the Release 1. Confirm the target semantic version with the user if it was not provided. + Check runtime-floor and maintenance-line decisions against `RELEASE_POLICY.md`. 2. Set the same version in: - `pyproject.toml` under `[project]` - `Cargo.toml` under `[package]` @@ -34,6 +35,9 @@ preparation. Before presenting the changes: - Confirm the versions in `pyproject.toml` and `Cargo.toml` match. +- For a runtime-floor change, check `requires-python` and the classifiers + against the PyO3 `abi3-py*` feature. Align `.github/workflows/build.yml`, + `ci/validate_artifacts.py`, its tests, and the install, smoke and upgrade docs. - Confirm the changelog version and date are correct. - Confirm the diff contains only the intended release preparation. @@ -56,6 +60,21 @@ After the pull request is merged: 4. Confirm the `v`-prefixed tag does not already exist locally or on `origin`. 5. Create the tag on the recorded merge SHA and push it to `origin`. -For example, package version `0.1.29` uses tag `v0.1.29`. Treat release tags as -immutable; never move or reuse an existing tag. Never substitute the current +Use `vX.Y.Z` for package version `X.Y.Z`. Never move or reuse a tag or substitute the current `origin/main` or `HEAD` tip for the release pull request's merge SHA. + +## Publish GitHub Release Notes + +1. Use the tagged `CHANGELOG.md` entry, including upgrade notes. The developer's + request to publish authorizes the notes; ask if before/after PyPI timing is + unclear. For early notes, add “PyPI publication pending” and update that + line on publication or abandonment. Otherwise verify the expected files on PyPI first. +2. Verify the tag on `origin` resolves to the approved merge SHA, peeling + annotated tags. Stop on a missing or mismatched tag; never create or move + one here. If a release exists, verify it instead of creating another. +3. Run `gh release create "$tag" --verify-tag --notes-file "$notes" --latest="$latest"` + without assets. Set `latest=true` only for the highest stable version; for + prereleases use `--prerelease --latest=false`. +4. Check `gh release view "$tag" --json tagName,isDraft,isPrerelease,body,assets` + for the expected tag, public notes, prerelease status and empty assets; + verify Latest separately. Stop on discrepancies rather than overwriting a release. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a631142..c3d1cfc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,7 @@ jobs: - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.12" + check-latest: true - name: Install configured Rust toolchain run: | test -f rust-toolchain.toml @@ -57,6 +58,7 @@ jobs: - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.12" + check-latest: true - name: Require Rust toolchain configuration run: test -f rust-toolchain.toml - name: Build wheel @@ -69,6 +71,7 @@ jobs: with: name: wheels-macos-${{ matrix.target }} path: dist/*.whl + if-no-files-found: error # ── Linux (x86_64 + aarch64, manylinux) ─────────────────── linux: @@ -85,6 +88,7 @@ jobs: - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.12" + check-latest: true - name: Require Rust toolchain configuration run: test -f rust-toolchain.toml - name: Build wheel @@ -109,6 +113,7 @@ jobs: with: name: wheels-linux-${{ matrix.target }} path: dist/*.whl + if-no-files-found: error # ── Windows (x86_64) ───────────────────────────────────────── windows: @@ -121,6 +126,7 @@ jobs: - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.12" + check-latest: true - name: Require Rust toolchain configuration shell: bash run: test -f rust-toolchain.toml @@ -134,6 +140,7 @@ jobs: with: name: wheels-windows-${{ matrix.target }} path: dist/*.whl + if-no-files-found: error # ── Source distribution ───────────────────────────────────── sdist: @@ -151,11 +158,28 @@ jobs: with: name: wheels-sdist path: dist/*.tar.gz + if-no-files-found: error + + validate-artifacts: + runs-on: ubuntu-latest + needs: [macos, linux, windows, sdist] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: "3.12" + check-latest: true + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: wheels-* + merge-multiple: true + path: dist + - run: python ci/validate_artifacts.py dist # ── Packaging smoke: install wheel into fresh venv on real OSes ── smoke-local: name: Smoke (local) ${{ matrix.os }} py${{ matrix.python }} - needs: [macos, linux, windows] + needs: validate-artifacts env: PIP_ONLY_BINARY: duroxide strategy: @@ -174,28 +198,13 @@ jobs: - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ matrix.python }} + check-latest: true - name: Download wheels uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: wheels-* merge-multiple: true path: wheels - - name: List wheels - shell: bash - run: | - ls -lh wheels/ - shopt -s nullglob - wheels=(wheels/*.whl) - if (( ${#wheels[@]} == 0 )); then - echo "::error::No wheel artifacts found" - exit 1 - fi - for wheel in "${wheels[@]}"; do - [[ "$wheel" == *-cp311-abi3-*.whl ]] || { - echo "::error file=$wheel::Expected a cp311-abi3 wheel" - exit 1 - } - done - name: Run smoke (local wheel) if: runner.os != 'Windows' env: diff --git a/CHANGELOG.md b/CHANGELOG.md index f549f36..2ade6cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- The SDK now requires CPython 3.11 or newer; Python 3.9 and 3.10 are no - longer supported. Wheels use the `cp311-abi3` tag, and the CI smoke test - matrix covers standard CPython 3.11 through 3.15. +- Starting with 0.4.0, duroxide requires CPython 3.11 or newer and ships + `cp311-abi3` wheels. The minimum for 0.3.0 remains CPython 3.9. Upgrade + Python before upgrading duroxide: on 3.9 or 3.10, `pip install -U duroxide` + may stay on 0.3.0 without an error. ## [0.3.0] - 2026-11-30 diff --git a/README.md b/README.md index 45fa6f4..6e3f2ce 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ Write durable workflows as Python generators. The Rust runtime handles replay, p pip install duroxide ``` +Starting with 0.4.0, duroxide requires CPython 3.11 or newer. The minimum +for 0.3.0 is CPython 3.9. On CPython +3.9 or 3.10, `pip install -U duroxide` may leave 0.3.0 installed rather than +report an error. Upgrade Python before installing 0.4.0. + Prebuilt wheels are published for macOS arm64/x64, Linux manylinux x86_64 and aarch64, and Windows x86_64. @@ -253,6 +258,8 @@ reply = json.loads(status.custom_status) ## Development +Requires CPython 3.11 or newer. + Install Rust through [rustup](https://rustup.rs/). The root `rust-toolchain.toml` selects the compiler for local builds and GitHub Actions, including wheel builds inside manylinux containers. diff --git a/RELEASE_POLICY.md b/RELEASE_POLICY.md index 171e49e..9236a19 100644 --- a/RELEASE_POLICY.md +++ b/RELEASE_POLICY.md @@ -1,8 +1,7 @@ # Release Policy -`duroxide` is published to PyPI by Microsoft's internal open-source release -infrastructure. Publishing credentials and release execution remain outside -this repository. +Microsoft's internal release pipeline publishes `duroxide` to PyPI. Publishing +credentials and package builds for PyPI remain outside this repository. ## Contributor Workflow @@ -10,18 +9,31 @@ Contributors can prepare a release through a pull request: 1. Update the version in `pyproject.toml` and `Cargo.toml`. 2. Update `CHANGELOG.md` and relevant documentation. -3. Confirm the pull request's `Build & Smoke` workflow passes. -4. Open a pull request for review. +3. Open a pull request for review and confirm `Build & Smoke` passes. After the release change is merged, the matching release tag is created from the release pull request's exact merge commit with explicit approval. A Microsoft maintainer then uses that tag with the internal release pipeline to build and publish the package to PyPI. +## CPython support + +The minimum CPython version in `pyproject.toml` must match the PyO3 ABI +minimum in `Cargo.toml`. While the SDK is at 0.x, changing that minimum +requires at least a minor release. The current flow does not support +maintenance releases from older lines; those require a separately approved plan. + +## GitHub Release Notes + +Every new SDK version tag requires a notes-only GitHub Release. Existing tags +and releases remain unchanged. The release maintainer publishes the tagged +changelog and upgrade notes before or after PyPI publication, as requested by +the developer. Publishing notes requires explicit authorization separate from +tag approval. Do not upload package assets or trigger PyPI publication. + ## Publishing Boundary -- Do not publish directly to PyPI for the Microsoft release. -- Do not create a GitHub Release manually. +- Publish to PyPI only through Microsoft's internal release pipeline. - Do not request or store Microsoft publishing credentials in this repository. For release questions, open a GitHub issue without including credentials or diff --git a/ci/smoke/README.md b/ci/smoke/README.md index 678c407..dbe166e 100644 --- a/ci/smoke/README.md +++ b/ci/smoke/README.md @@ -4,6 +4,13 @@ Cross-platform smoke tests that exercise the **distributable** `duroxide` Python wheel — not the source tree. Installs into a fresh venv, resolves platform tags, runs a minimal SQLite-backed orchestration. +Starting with 0.4.0, duroxide requires CPython 3.11 or newer. CI checks the +wheels built by this repository's GitHub workflow for `cp311-abi3` tags and +checks the wheels and sdist for `Requires-Python: >=3.11`. The smoke matrix +installs those wheels on standard CPython 3.11 through 3.15. Version 0.3.0 +requires only CPython 3.9; a registry upgrade on 3.9 or 3.10 may select it +instead of the newer release. + Kept in lockstep with `sdks/duroxide-node/ci/smoke/`. The duroxide-update-manager agent owns parity. See its instructions for the full checklist. diff --git a/ci/validate_artifacts.py b/ci/validate_artifacts.py new file mode 100644 index 0000000..e65d901 --- /dev/null +++ b/ci/validate_artifacts.py @@ -0,0 +1,56 @@ +"""Check the wheels and sdist built by the GitHub workflow before smoke testing.""" + +import re +import sys +import tarfile +import tomllib +from email.parser import BytesParser +from pathlib import Path +from zipfile import BadZipFile, ZipFile + + +def check_floor(metadata: bytes, path: Path) -> None: + headers = BytesParser().parsebytes(metadata, headersonly=True) + floors = headers.get_all("Requires-Python", []) + if floors != [">=3.11"]: + raise ValueError(f"{path.name}: expected one Requires-Python: >=3.11, got {floors!r}") + + +def validate(directory: Path, version: str) -> None: + stem = f"duroxide-{version}" + wheels = sorted(directory.glob("*.whl")) + if len(wheels) != 5: # Two macOS, two Linux, one Windows. + raise ValueError(f"{directory}: expected five wheels, found {[p.name for p in wheels]}") + for path in wheels: + if not re.fullmatch(rf"{re.escape(stem)}-cp311-abi3-[a-z0-9_]+(?:\.[a-z0-9_]+)*\.whl", path.name): + raise ValueError(f"{path.name}: expected {stem}-cp311-abi3-.whl") + try: + with ZipFile(path) as wheel: + entries = [p for p in wheel.namelist() if re.fullmatch(r"[^/]+\.dist-info/METADATA", p)] + if entries != [f"{stem}.dist-info/METADATA"]: + raise ValueError(f"{path.name}: expected one top-level {stem}.dist-info/METADATA, got {entries!r}") + check_floor(wheel.read(entries[0]), path) + except BadZipFile as exc: + raise ValueError(f"{path.name}: {exc}") from exc + + path = directory / f"{stem}.tar.gz" + sdists = list(directory.glob("*.tar.gz")) + if sdists != [path]: + raise ValueError(f"{directory}: expected only {path.name}, found {[p.name for p in sdists]}") + try: + with tarfile.open(path, "r:gz") as sdist: + entries = [m for m in sdist if m.name == f"{stem}/PKG-INFO"] + if len(entries) != 1 or not entries[0].isfile(): + raise ValueError(f"{path.name}: expected one regular {stem}/PKG-INFO") + check_floor(sdist.extractfile(entries[0]).read(), path) + except (tarfile.TarError, EOFError) as exc: + raise ValueError(f"{path.name}: {exc}") from exc + + +if __name__ == "__main__": + with Path(__file__).resolve().parents[1].joinpath("pyproject.toml").open("rb") as manifest: + version = tomllib.load(manifest)["project"]["version"] + try: + validate(Path(sys.argv[1]), version) + except ValueError as exc: + sys.exit(str(exc)) diff --git a/docs/user-guide.md b/docs/user-guide.md index 921d91f..76d1950 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -8,6 +8,11 @@ This guide covers how to build workflows with duroxide-python. For architecture pip install duroxide ``` +Starting with 0.4.0, duroxide requires CPython 3.11 or newer. The minimum +for 0.3.0 is CPython 3.9. On 3.9 or 3.10, pip skips +incompatible releases, so `pip install -U duroxide` may stay on 0.3.0. +No further 0.3.x releases are planned through the current release pipeline. + ## Core Concepts | Concept | What It Is | diff --git a/pyproject.toml b/pyproject.toml index d7c07b2..a029ba8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,4 +29,5 @@ python-source = "python" module-name = "duroxide._duroxide" [tool.pytest.ini_options] +pythonpath = ["."] testpaths = ["tests"] diff --git a/tests/test_artifact_metadata.py b/tests/test_artifact_metadata.py new file mode 100644 index 0000000..e6ae49d --- /dev/null +++ b/tests/test_artifact_metadata.py @@ -0,0 +1,72 @@ +import io +import re +import tarfile +from zipfile import ZipFile + +import pytest + +from ci.validate_artifacts import validate + + +VERSION = "0.4.0" +STEM = f"duroxide-{VERSION}" +METADATA = f"{STEM}.dist-info/METADATA" +FLOOR = b"Requires-Python: >=3.11\n" +OLD = b"Requires-Python: >=3.9\n" + + +def write_wheel(path, headers=FLOOR, entries=(METADATA,)): + with ZipFile(path, "w") as archive: + for name in entries: + archive.writestr(name, headers) + + +def write_sdist(path, headers): + with tarfile.open(path, "w:gz") as archive: + member = tarfile.TarInfo(f"{STEM}/PKG-INFO") + member.size = len(headers) + archive.addfile(member, io.BytesIO(headers)) + + +@pytest.fixture +def inventory(tmp_path): + for platform in ("macosx_11_0_arm64", "macosx_11_0_x86_64", "manylinux_2_28_aarch64", + "manylinux_2_28_x86_64", "win_amd64"): + write_wheel(tmp_path / f"{STEM}-cp311-abi3-{platform}.whl") + write_sdist(tmp_path / f"{STEM}.tar.gz", FLOOR) + return tmp_path + + +def test_valid_inventory(inventory): + validate(inventory, VERSION) + + +@pytest.mark.parametrize("headers", [OLD, b"", FLOOR + OLD, OLD + FLOOR]) +def test_second_wheel_floor(inventory, headers): + path = sorted(inventory.glob("*.whl"))[1] + write_wheel(path, headers) + with pytest.raises(ValueError, match=re.escape(path.name) + ".*Requires-Python"): + validate(inventory, VERSION) + + +@pytest.mark.parametrize("entries", [(), ("nested/" + METADATA,), (METADATA, "other.dist-info/METADATA")]) +def test_wheel_metadata_count(inventory, entries): + path = sorted(inventory.glob("*.whl"))[1] + write_wheel(path, entries=entries) + with pytest.raises(ValueError, match=re.escape(path.name) + ".*one top-level"): + validate(inventory, VERSION) + + +@pytest.mark.parametrize("name", [f"{STEM}-cp39-abi3-win_amd64.whl", "cp311-abi3-win_amd64.whl", + f"{STEM}-cp311-abi3-.whl"]) +def test_wheel_filename(inventory, name): + next(inventory.glob("*.whl")).rename(inventory / name) + with pytest.raises(ValueError, match=re.escape(name)): + validate(inventory, VERSION) + + +def test_sdist_floor(inventory): + path, = inventory.glob("*.tar.gz") + write_sdist(path, OLD) + with pytest.raises(ValueError, match=re.escape(path.name) + ".*Requires-Python"): + validate(inventory, VERSION)