Skip to content

Shared contributing guide for repos and boilerplate fixes - #18

Merged
tomaslink merged 12 commits into
mainfrom
PIPELINE-4672-shared-contributing-guide
Oct 16, 2026
Merged

tomaslink merged 12 commits into
mainfrom
PIPELINE-4672-shared-contributing-guide

Conversation

@tomaslink

@tomaslink tomaslink commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

PIPELINE-4672

Summary

Makes this template's CONTRIBUTING.md the single contributing guide for every repo created from it (pipelines and services), and ports the boilerplate fixes found while standardizing pipe-encounters (PIPELINE-3367) and pipe-anchorages.

Shared contributing guide

  • CONTRIBUTING.md and docs/contributing/ take pipe-docs' newer text, made generic for services as well as pipelines. The guide describes the tooling this template ships (Makefile, Docker, uv), so it lives here, next to it.
  • Repos link to it from their README: a clone step with the repo's own URL (renamed by init_project.py), then a link to the guide.
  • init_project.py removes CONTRIBUTING.md and docs/contributing/ from new projects and keeps links to the template's guide when renaming.
  • Fixes in the guide: requirements are compiled with uv pip compile (uv doesn't use pip-tools), and the venv is activated with . .venv/bin/activate (executing ./.venv/bin/activate fails, or only affects a subshell).
  • Why not pipe-docs: pipe-docs is private, while this template and the pipe repos are public, so links to it 404 for outsiders. pipe-docs will link here instead (follow-up).

Boilerplate fixes

  • CI: the "Python 3.13" job actually ran on 3.12 (make uv pins .python-version to 3.12 and uv venv follows it; see Using CPython 3.12.3 in the logs). The venv now gets --python from the matrix. Codecov never uploaded: the condition required Python 3.12, which isn't in the matrix. checkout@v6 in the Docker job.
  • Makefile: python -m codespell fails (No module named codespell); the module is codespell_lib. make hooks no longer installs a commit-msg hook (none is configured).
  • pyproject: drop pyyaml, rich, rich-argparse and types-PyYAML (nothing imports them; every new project inherited them) and the unused pip-tools; requires-python >= 3.12 to match the Docker image; Changelog URL → GitHub releases; drop coverage's parallel mode.
  • .dockerignore: exclude .git and .venv; the dev stage's COPY . . copied a local .venv (157 MB here) into the image.
  • .python-version (3.12) is now tracked, so local venvs use the same Python as the Docker image.
  • Cloud Build: replace the unused cloudbuild.yaml with the Terraform triggers in cloudbuild/ (cloudbuild-trigger module v0.6.7, as in pipe-anchorages/pipe-encounters). The module defines the build itself (--target prod); init_project.py renames the project in the .tf files.
  • Cleanup: README links to files that no longer exist, .gitignore leftovers (test/ silently ignored any test/ folder), pre-commit-hooks v6.0.0, and trailing whitespace / final newlines flagged by the template's own hooks (trailing-whitespace now keeps Markdown line breaks).
  • Fixes the Pygments Dependabot alert (it came through rich).

Test dependencies: a dependency group, compiled

requirements-test.txt held hand-written ranges that nothing compiled or upgraded, so test runs weren't reproducible and Dependabot only flagged the pytest tmpdir advisory because ~=8.3 blocked the fix (9.0.3).

  • Test dependencies are now a PEP 735 test dependency group in pyproject.toml (not published with the package), with pytest ~=9.0 and pytest-cov ~=7.0.
  • requirements-test.txt is compiled from it with uv pip compile --group test -c requirements.txt, so it's pinned against the production pins. The test image still installs just the test dependencies on top of the production image, as before.
  • make reqs / make reqs-upgrade compile both files; their containers now run as the host user, so the compiled files aren't owned by root.
  • Major versions stay a deliberate pyproject.toml change; reqs-upgrade moves within the ranges.

Verification

  • pytest: 10 passed; flake8: clean.
  • make reqs and make reqs-upgrade in the dev container produce the pinned requirements-test.txt, owned by the host user.
  • Simulated CI native job on Python 3.13 (make install-test, pip install ., make test): passes.
  • make docker-build && make docker-test: passes; the dev image no longer contains .git/.venv; the prod image's CLI runs.
  • python init_project.py my-service on a copy: the README clone step becomes my-service, guide links still point here, CONTRIBUTING.md and docs/contributing/ are removed, and cloudbuild/*.tf get repo_name = "my-service".
  • terraform fmt -check and terraform validate (with -backend=false) pass for cloudbuild/.

Follow-ups

  • PIPELINE-4673: example CLI built on gfw-common (stacked on this PR).
  • pipe-docs: replace its guide with a link to this one.
  • Apply the test dependency group workflow to the pipe repos.

🤖 Generated with Claude Code

…emplate

The guide describes the tooling the template ships (Makefile, Docker, uv), so
it lives here, next to it, instead of in pipe-docs or in a copy per project.

- CONTRIBUTING.md and docs/contributing/: take pipe-docs' newer version and
  make it apply to services as well as pipelines. The guide starts from the
  cloned repository; the README has the clone step. Requirements are compiled
  with uv pip compile, not pip-tools, and the venv activation script is
  sourced (running ./.venv/bin/activate only affects a subshell).
- init_project.py: remove CONTRIBUTING.md and docs/contributing/ from new
  projects, and keep links to the template's guide when renaming, so new
  READMEs point to it.
- README: clone step with the repository's URL (renamed by init_project.py),
  then a link to the guide; mention uv instead of pip-tools.
The codespell package's module is codespell_lib; python -m codespell fails
with 'No module named codespell'. pipe-anchorages already uses codespell_lib.
uv reimplements pip-compile's interface without using pip-tools, so the dev
dependency was unused. The reqs targets' help now says uv.
- The "Python 3.13" job ran on 3.12: make uv pins .python-version to 3.12 and
  uv venv follows it. Pass the matrix version to uv venv.
- Codecov never uploaded: the condition required Python 3.12, which isn't in
  the matrix. Upload on main, as pipe-anchorages does; drop develop.
- actions/checkout@v6 in the Docker job too.
The dev stage runs COPY . ., so a local .venv (157 MB here) and .git ended
up in the dev image. pipe-anchorages and pipe-gaps already exclude them.
Without it, uv creates local venvs with the newest Python it finds, while the
Docker image runs 3.12. It's the same version make uv pins, so running
make uv leaves it unchanged. pipe-anchorages tracks it for the same reason.
The triggers come from gfw-terraform-modules' cloudbuild-trigger module,
which defines the build itself (buildx, --target prod), so cloudbuild.yaml
was unused. cloudbuild/ has the same setup as pipe-encounters and
pipe-anchorages (module v0.6.7), and init_project.py renames the project in
it. The README says how to create the triggers, and .dockerignore leaves
cloudbuild/ (and its local .terraform cache) out of the build context.
- Drop pyyaml, rich and rich-argparse (and types-PyYAML): nothing imports
  them, and every project created from the template inherited them.
- requires-python >= 3.12 with 3.12 and 3.13 classifiers, matching the Docker
  image, .python-version, the ruff/black targets and the README badge.
- Changelog URL points to the GitHub releases; CHANGELOG.md doesn't exist.
- Drop coverage's parallel mode, as pipe-anchorages did.
…hooks

- README: the CLI lives in cli/main.py; examples/ and pytest.ini no longer
  exist; Continuous Deployment is CD; stray period in a heading.
- .gitignore: drop test/ (it silently ignored any test/ folder a project
  creates), scripts/config.sh (from another project) and .ipynb
  (.ipynb_checkpoints is already ignored).
- pre-commit-hooks v6.0.0.
- Makefile: hooks no longer installs a commit-msg hook; none is configured
  (commitizen is commented out).
…own hooks

The end-of-file-fixer and trailing-whitespace hooks failed on the template
itself. trailing-whitespace now keeps Markdown line breaks (two trailing
spaces) with --markdown-linebreak-ext=md.
@tomaslink tomaslink self-assigned this Oct 16, 2026
@tomaslink tomaslink changed the title Shared contributing guide for repos created from the template, and boilerplate fixes (CI really tests 3.13, Codecov uploads again) Shared contributing guide for repos created from the template, and boilerplate fixes Oct 16, 2026
@tomaslink tomaslink changed the title Shared contributing guide for repos created from the template, and boilerplate fixes Shared contributing guide for repos and boilerplate fixes Oct 16, 2026
requirements-test.txt held hand-written ranges that nothing compiled or
upgraded, so test runs weren't reproducible and Dependabot only saw a
problem when a range blocked the fix (pytest <9.0.3, tmpdir advisory).

- pyproject.toml: a PEP 735 "test" dependency group (not published with the
  package), with pytest ~=9.0 and pytest-cov ~=7.0.
- requirements-test.txt is now compiled from it with uv, against the pins in
  requirements.txt, so the test image still installs just the test
  dependencies on top of the production image. make reqs and
  make reqs-upgrade compile both files.
- The reqs containers run as the host user, so the compiled files written
  into the repo aren't owned by root.
- CONTRIBUTING.md and README describe the workflow.
@tomaslink
tomaslink force-pushed the PIPELINE-4672-shared-contributing-guide branch from bb87df5 to 9a5102b Compare October 16, 2026 19:13
@tomaslink
tomaslink added this pull request to stack #20 October 16, 2026 19:26
@tomaslink
tomaslink merged commit 9ff6187 into main Oct 16, 2026
3 checks passed
@tomaslink
tomaslink deleted the PIPELINE-4672-shared-contributing-guide branch October 16, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant