| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,128 @@ | |||
| 1 | + --- | ||
| 2 | + name: pr-workflow | ||
| 3 | + description: Create pull requests for python-zeroconf/python-zeroconf. Use when creating PRs, submitting changes, or preparing contributions. | ||
| 4 | + allowed-tools: Read, Bash, Glob, Grep | ||
| 5 | + --- | ||
| 6 | + | ||
| 7 | + # python-zeroconf PR Workflow | ||
| 8 | + | ||
| 9 | + When creating a pull request for `python-zeroconf/python-zeroconf`, | ||
| 10 | + follow these steps. Repo-wide conventions live in | ||
| 11 | + [CLAUDE.md](../../../CLAUDE.md); this skill summarises the parts | ||
| 12 | + that matter at PR-creation time. | ||
| 13 | + | ||
| 14 | + ## 1. Create branch from origin/master | ||
| 15 | + | ||
| 16 | + The default branch is `master`, not `main`. `origin` already | ||
| 17 | + points at `python-zeroconf/python-zeroconf` — there is no fork in | ||
| 18 | + this workflow. Always re-fetch first so the branch is based on | ||
| 19 | + the latest `master`: | ||
| 20 | + | ||
| 21 | + ```bash | ||
| 22 | + git fetch origin | ||
| 23 | + git checkout -b <branch-name> origin/master | ||
| 24 | + ``` | ||
| 25 | + | ||
| 26 | + If you accidentally branch from `main`, `gh pr create` will fail | ||
| 27 | + because the base branch does not exist. | ||
| 28 | + | ||
| 29 | + ## 2. There is no PR template | ||
| 30 | + | ||
| 31 | + `python-zeroconf` does not ship a `.github/PULL_REQUEST_TEMPLATE.md` | ||
| 32 | + — PR bodies are free-form. Aim for a body that looks roughly like: | ||
| 33 | + | ||
| 34 | + ``` | ||
| 35 | + ## Summary | ||
| 36 | + <1–3 sentence prose description of what changed and why> | ||
| 37 | + | ||
| 38 | + ## Details | ||
| 39 | + <bullets explaining the non-obvious parts: RFC sections cited, | ||
| 40 | + performance characteristics measured, edge cases handled> | ||
| 41 | + | ||
| 42 | + ## Test plan | ||
| 43 | + - [ ] <how you verified the change> | ||
| 44 | + - [ ] <new tests added under tests/ — point at the file> | ||
| 45 | + ``` | ||
| 46 | + | ||
| 47 | + Cite the relevant RFC section (RFC 6762 / RFC 6763) for any | ||
| 48 | + behaviour change that affects packet contents or timing — | ||
| 49 | + reviewers shouldn't have to reverse-engineer why a constant moved | ||
| 50 | + or a probe interval changed. | ||
| 51 | + | ||
| 52 | + ## 3. Commit message conventions | ||
| 53 | + | ||
| 54 | + Commit messages are linted by `commitlint` with | ||
| 55 | + `@commitlint/config-conventional`, _and_ by `commitizen` in | ||
| 56 | + pre-commit (`stages: [commit-msg]`). Both must pass. | ||
| 57 | + | ||
| 58 | + - **Conventional Commits prefix is required.** Pick from: | ||
| 59 | + `feat`, `fix`, `perf`, `refactor`, `docs`, `test`, `build`, | ||
| 60 | + `ci`, `chore`, `style`, `revert`. The `feat`/`fix`/`perf` | ||
| 61 | + prefixes show up in the release-notes; `chore*` and `ci*` are | ||
| 62 | + excluded by semantic-release (`exclude_commit_patterns` in | ||
| 63 | + `pyproject.toml`), so use those for housekeeping. | ||
| 64 | + - **Imperative-mood subject.** "fix: handle empty answer", not | ||
| 65 | + "fix: handled empty answer". | ||
| 66 | + - **No header length cap.** The commitlint config sets | ||
| 67 | + `header-max-length: [0, "always", Infinity]`, so a slightly | ||
| 68 | + longer subject is fine if it earns the space; don't pad. | ||
| 69 | + - **No `Co-Authored-By` trailers from automated agents.** | ||
| 70 | + - **One logical change per commit.** Let pre-commit run (ruff | ||
| 71 | + lint + format, mypy, flake8, codespell, cython-lint, | ||
| 72 | + pyupgrade). If a hook auto-fixes something, re-stage and | ||
| 73 | + re-commit; the commit-msg hook re-runs on the new commit. | ||
| 74 | + | ||
| 75 | + ## 4. Cython / `.pxd` discipline | ||
| 76 | + | ||
| 77 | + If the PR touches any module listed in `TO_CYTHONIZE` | ||
| 78 | + (`build_ext.py`): | ||
| 79 | + | ||
| 80 | + - Update the sibling `.pxd` in the same commit if you changed a | ||
| 81 | + `cdef class` layout or a `cpdef`/`cdef` signature. | ||
| 82 | + - Do not hand-edit the in-tree `.c` files; the build regenerates | ||
| 83 | + them, and they're excluded from sdist (`exclude = ["**/*.c"]` | ||
| 84 | + in `pyproject.toml`). | ||
| 85 | + - Verify the extension still builds locally: | ||
| 86 | + `REQUIRE_CYTHON=1 poetry install` (re-installs in-place, | ||
| 87 | + failing loudly if Cython rejects anything). | ||
| 88 | + - Verify it still works without the extension: | ||
| 89 | + `SKIP_CYTHON=1 poetry install && poetry run pytest tests/`. | ||
| 90 | + | ||
| 91 | + ## 5. Push and create the PR | ||
| 92 | + | ||
| 93 | + ```bash | ||
| 94 | + git push -u origin <branch-name> | ||
| 95 | + gh pr create --repo python-zeroconf/python-zeroconf --base master \ | ||
| 96 | + --title "<conventional-commit subject>" \ | ||
| 97 | + --body-file /tmp/pr-body.md | ||
| 98 | + ``` | ||
| 99 | + | ||
| 100 | + Always pass the body via `--body-file`, never `--body "..."` with | ||
| 101 | + shell-escaping — Markdown backticks, asterisks, and angle | ||
| 102 | + brackets must pass through verbatim. | ||
| 103 | + | ||
| 104 | + The PR title should match the commit subject (same Conventional | ||
| 105 | + Commits prefix). If the PR ends up squash-merged, the title | ||
| 106 | + becomes the merged commit message, so it has to satisfy | ||
| 107 | + commitlint on its own. | ||
| 108 | + | ||
| 109 | + ## 6. After the PR is open | ||
| 110 | + | ||
| 111 | + CI runs three jobs: | ||
| 112 | + | ||
| 113 | + - `lint` — `pre-commit/action`. If pre-commit passed locally | ||
| 114 | + this passes too. | ||
| 115 | + - `commitlint` — `wagoid/commitlint-github-action`. Validates | ||
| 116 | + every commit on the PR; if you amended after pushing, force- | ||
| 117 | + push the branch so the rewritten commits get linted. | ||
| 118 | + - `test` — the full pytest matrix across CPython 3.9–3.14, | ||
| 119 | + 3.14t (free-threaded), and PyPy 3.9 / 3.10, on Linux + macOS + | ||
| 120 | + Windows. The free-threaded entry is the canary for unguarded | ||
| 121 | + shared-state bugs; failures there are often genuine even when | ||
| 122 | + the GIL-enabled rows pass. | ||
| 123 | + | ||
| 124 | + CodSpeed also runs on PRs (`CodSpeedHQ/action`) and posts a | ||
| 125 | + benchmark delta as a check. A regression there is signal — if | ||
| 126 | + the PR is a perf change, the comment is the evidence; if not, a | ||
| 127 | + red CodSpeed check usually means the hot path picked up an extra | ||
| 128 | + Python-level branch and wants a second look. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,8 +69,12 @@ jobs: | |||
| 69 | 69 | runs-on: ${{ matrix.os }} | |
| 70 | 70 | steps: | |
| 71 | 71 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4 | |
| 72 | + - name: Set up uv | ||
| 73 | + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | ||
| 74 | + with: | ||
| 75 | + enable-cache: true | ||
| 72 | 76 | - name: Install poetry | |
| 73 | - run: pipx install poetry | ||
| 77 | + run: uv tool install poetry | ||
| 74 | 78 | - name: Set up Python | |
| 75 | 79 | uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5 | |
| 76 | 80 | with: | |
@@ -102,13 +106,18 @@ jobs: | |||
| 102 | 106 | uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5 | |
| 103 | 107 | with: | |
| 104 | 108 | python-version: 3.13 | |
| 105 | - - uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | ||
| 109 | + - name: Set up uv | ||
| 110 | + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | ||
| 111 | + with: | ||
| 112 | + enable-cache: true | ||
| 113 | + - name: Install poetry | ||
| 114 | + run: uv tool install poetry | ||
| 106 | 115 | - name: Install Dependencies | |
| 107 | 116 | run: | | |
| 108 | 117 | REQUIRE_CYTHON=1 poetry install --only=main,dev | |
| 109 | 118 | shell: bash | |
| 110 | 119 | - name: Run benchmarks | |
| 111 | - uses: CodSpeedHQ/action@d872884a306dd4853acf0f584f4b706cf0cc72a2 # v3 | ||
| 120 | + uses: CodSpeedHQ/action@3194d9a39c4d46684cb44bf7207fc56626aad8fd # v3 | ||
| 112 | 121 | with: | |
| 113 | 122 | token: ${{ secrets.CODSPEED_TOKEN }} | |
| 114 | 123 | run: poetry run pytest --no-cov -vvvvv --codspeed tests/benchmarks | |
@@ -135,7 +144,10 @@ jobs: | |||
| 135 | 144 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4 | |
| 136 | 145 | with: | |
| 137 | 146 | fetch-depth: 0 | |
| 138 | - ref: ${{ github.head_ref || github.ref_name }} | ||
| 147 | + ref: ${{ github.ref }} | ||
| 148 | + | ||
| 149 | + - name: Create local branch name | ||
| 150 | + run: git switch -C ${{ github.head_ref || github.ref_name }} | ||
| 139 | 151 | ||
| 140 | 152 | # Do a dry run of PSR | |
| 141 | 153 | - name: Test release | |
@@ -153,7 +165,7 @@ jobs: | |||
| 153 | 165 | github_token: ${{ secrets.GITHUB_TOKEN }} | |
| 154 | 166 | ||
| 155 | 167 | - name: Publish package distributions to PyPI | |
| 156 | - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1 | ||
| 168 | + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 | ||
| 157 | 169 | if: steps.release.outputs.released == 'true' | |
| 158 | 170 | ||
| 159 | 171 | - name: Publish package distributions to GitHub Releases | |
@@ -301,14 +313,14 @@ jobs: | |||
| 301 | 313 | fetch-depth: 0 | |
| 302 | 314 | ||
| 303 | 315 | - name: Build wheels ${{ matrix.musl }} (${{ matrix.qemu }}) | |
| 304 | - uses: pypa/cibuildwheel@ee02a1537ce3071a004a6b08c41e72f0fdc42d9a # v3.4.0 | ||
| 316 | + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 | ||
| 305 | 317 | # to supply options, put them in 'env', like: | |
| 306 | 318 | env: | |
| 307 | 319 | CIBW_SKIP: cp36-* cp37-* pp36-* pp37-* pp38-* cp38-* ${{ matrix.musl == 'musllinux' && '*manylinux*' || '*musllinux*' }} | |
| 308 | 320 | CIBW_BEFORE_ALL_LINUX: apt install -y gcc || yum install -y gcc || apk add gcc | |
| 309 | 321 | REQUIRE_CYTHON: 1 | |
| 310 | 322 | ||
| 311 | - - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4 | ||
| 323 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4 | ||
| 312 | 324 | with: | |
| 313 | 325 | path: ./wheelhouse/*.whl | |
| 314 | 326 | name: wheels-${{ matrix.os }}-${{ matrix.musl }}-${{ matrix.qemu }}-${{ matrix.pyver }} | |
@@ -330,4 +342,4 @@ jobs: | |||
| 330 | 342 | merge-multiple: true | |
| 331 | 343 | ||
| 332 | 344 | - uses: | |
| 333 | - pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | ||
| 345 | + pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ ci: | |||
| 9 | 9 | ||
| 10 | 10 | repos: | |
| 11 | 11 | - repo: https://github.com/commitizen-tools/commitizen | |
| 12 | - rev: v4.13.10 | ||
| 12 | + rev: v4.15.1 | ||
| 13 | 13 | hooks: | |
| 14 | 14 | - id: commitizen | |
| 15 | 15 | stages: [commit-msg] | |
@@ -54,7 +54,7 @@ repos: | |||
| 54 | 54 | hooks: | |
| 55 | 55 | - id: flake8 | |
| 56 | 56 | - repo: https://github.com/pre-commit/mirrors-mypy | |
| 57 | - rev: v1.20.2 | ||
| 57 | + rev: v2.0.0 | ||
| 58 | 58 | hooks: | |
| 59 | 59 | - id: mypy | |
| 60 | 60 | additional_dependencies: [ifaddr] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments