From 28a73ad93d7ee0b78f4056784d194ae0683bd4e5 Mon Sep 17 00:00:00 2001 From: Gemma Danks Date: Sat, 18 Jul 2026 12:01:01 +0100 Subject: [PATCH 1/9] docs: add AGENTS.md --- AGENTS.md | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..f165986 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,149 @@ +# AGENTS.md + +This file applies to the entire repository. It is guidance for coding agents +working on this Python project template. + +## Repository overview + +- The distributable package uses a `src` layout and lives in + `src/package_name/`. +- Unit tests live in `tests/unit/`; shared fixtures belong in + `tests/conftest.py`. +- Documentation is built with MkDocs Material from `docs/`. +- Example notebooks live in `notebooks/`. +- Dependencies and environments are managed with `uv`; common tasks are + exposed through the root `justfile`. +- Python 3.11 and newer are supported. `.python-version` selects Python 3.14 + for the default development environment. + +This is a reusable template. Keep examples and configuration generic unless a +task explicitly asks to customize the template for a specific project. + +## Working principles + +- Make the smallest coherent change that satisfies the task. +- Preserve unrelated work in the working tree. Inspect `git diff` before and + after editing, and do not revert changes you did not make. +- Follow the existing structure and naming conventions instead of introducing + a second tool or parallel configuration. +- Add or update tests when behavior changes. Update user-facing documentation + when public APIs, setup steps, or workflows change. +- Record architecturally significant decisions with an ADR based on + `docs/architecture/adr/template.md`. + +## Setup and commands + +Install the complete development environment with: + +```bash +uv sync --all-groups +``` + +Prefer the `just` recipes because they document the intended local workflow: + +```bash +just test # quick tests, excluding tests marked slow +just test-vv # verbose quick tests +just coverage # full pytest run with terminal coverage +just test-notebooks # execute notebooks through nbmake +just lint # Ruff checks +just format # Ruff formatting +just type-check # Pyright +just docs-build # strict MkDocs build +just build # build wheel and source distribution +just pre-commit # all push-stage hooks +``` + +For a focused test while iterating, run pytest through `uv`, for example: + +```bash +uv run pytest -q tests/unit/test_greet.py +uv run pytest -q tests/unit/test_greet.py::test_say_hello +``` + +Do not invoke tools from an unrelated global Python environment. If `just` is +not installed, run the corresponding `uv run ...` command from the `justfile`. + +## Python code conventions + +- Put production code under `src/package_name/`, not at the repository root. +- Use absolute imports from `package_name` in tests and consumer examples. +- Use four spaces, UTF-8, LF line endings, and a final newline, as configured in + `.editorconfig`. +- Let Ruff determine formatting. Do not hand-format code against Ruff's output. +- Add type annotations to new or changed functions. Keep code compatible with + every supported Python version (3.11 through 3.14), not only the version in + `.python-version`. +- Follow the existing Google-style docstrings for public modules and functions. + Examples in Python docstrings must be valid doctests because the quick test + recipes collect doctests from `*.py` files. +- Keep the package importable after changes. Export names from + `src/package_name/__init__.py` only when they are intentionally part of the + top-level public API. + +## Tests + +- Place unit tests in `tests/unit/` and name files `test_*.py`. +- Use pytest idioms, including parametrization for compact input/output cases + and fixtures in `tests/conftest.py` when they are shared. +- Test observable behavior rather than implementation details. +- Cover normal behavior and relevant edge or failure cases introduced by a + change. Keep tests deterministic and independent of execution order. +- Run the narrowest relevant test during development, then run `just test` for + code changes. Use `just coverage` when the change has broader impact. +- CI runs the full test suite on Linux, macOS, and Windows with Python + 3.11-3.14. Avoid platform-specific paths, shell assumptions, and timing-based + assertions in Python code and tests. + +## Dependencies and lockfiles + +- Declare runtime and development dependencies in `pyproject.toml`; do not add + `requirements.txt`, Poetry, or another environment manager. +- Use `uv add ` for runtime dependencies, `uv add --dev ` for + development dependencies, and `uv add --group docs ` for docs-only + dependencies. +- Commit the resulting `pyproject.toml` and `uv.lock` changes together. +- Use `uv lock` after a manual metadata change and `uv lock --upgrade` only when + an upgrade is intended. Do not casually regenerate or broadly upgrade the + lockfile for an unrelated task. + +## Documentation and notebooks + +- Keep documentation within the existing Diataxis sections: `tutorials/`, + `how-to/`, `reference/`, and `explanation/`. +- Add new pages to `mkdocs.yml` when they should appear in navigation. +- Build docs with `just docs-build`; the build is strict and warnings fail CI. +- Keep API reference paths aligned with importable modules under + `src/package_name/`. +- Notebook outputs are stripped by pre-commit. After changing a notebook, run + `just test-notebooks` and do not commit execution output or local kernel + metadata. +- `site/`, `dist/`, and `build/` are generated artifacts and must not be + committed. + +## Releases and commits + +- Use Conventional Commit subjects such as `feat:`, `fix:`, `docs:`, `test:`, + `refactor:`, `build:`, and `ci:` when asked to create commits. +- Release Please manages version bumps, release notes, and release metadata. + Do not manually edit `CHANGELOG.md`, `.release-please-manifest.json`, or + release version fields in `pyproject.toml`, `CITATION.cff`, and `uv.lock` + unless the task is specifically about a release. +- Never commit secrets, local virtual environments, caches, coverage output, or + generated documentation. + +## Validation before handoff + +Choose checks proportional to the change, but for a typical Python change run: + +```bash +just format +just lint +just type-check +just test +``` + +Also run `just docs-build` for documentation or public API changes, +`just test-notebooks` for notebook changes, and `just build` for packaging +changes. Report which checks ran and clearly identify any check that could not +be run. From ae1a4e4ddab3626a562b66c4f50c6855547fb1dd Mon Sep 17 00:00:00 2001 From: Gemma Danks Date: Sat, 18 Jul 2026 12:30:05 +0100 Subject: [PATCH 2/9] feat: add templates for working with AI agents --- .github/workflows/ci.yaml | 10 +- .pre-commit-config.yaml | 2 +- AGENTS.md | 25 ++-- CODE_REVIEW.md | 59 +++++++++ PLAN.md | 217 ++++++++++++++++++++++++++++++++++ README.md | 30 ++++- justfile | 22 ++++ plans/README.md | 15 +++ scripts/package_smoke_test.py | 89 ++++++++++++++ 9 files changed, 450 insertions(+), 19 deletions(-) create mode 100644 CODE_REVIEW.md create mode 100644 PLAN.md create mode 100644 plans/README.md create mode 100644 scripts/package_smoke_test.py diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 02802c9..239eeaf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -126,11 +126,5 @@ jobs: - name: Install dependencies run: uv sync --all-groups - - name: Build and install wheel - run: | - uv build - python -m venv pkgtest - source pkgtest/bin/activate - python -m pip install --upgrade pip - python -m pip install dist/*.whl - python -c "import package_name as m; print(getattr(m, '__version__', 'OK'))" + - name: Build, install, and import package + run: uv run --no-sync python scripts/package_smoke_test.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a08152..9cbf23a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # --- Ruff: lint + format (fast) --- - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.9 + rev: v0.15.17 hooks: - id: ruff args: [--fix] # remove if you want fail-only diff --git a/AGENTS.md b/AGENTS.md index f165986..6dfcb77 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,6 +28,12 @@ task explicitly asks to customize the template for a specific project. a second tool or parallel configuration. - Add or update tests when behavior changes. Update user-facing documentation when public APIs, setup steps, or workflows change. +- Use the lightest planning level in `PLAN.md`: routine work needs no plan file, + while durable task plans are copied into `plans/`. +- Use one writing agent by default. Delegate only independent, bounded work; + prefer parallel agents for read-heavy exploration, testing, or review. Give + parallel writers separate worktrees and non-overlapping ownership. +- Review meaningful changes against `CODE_REVIEW.md` before handoff. - Record architecturally significant decisions with an ADR based on `docs/architecture/adr/template.md`. @@ -48,9 +54,13 @@ just coverage # full pytest run with terminal coverage just test-notebooks # execute notebooks through nbmake just lint # Ruff checks just format # Ruff formatting +just format-check # verify formatting without changing files just type-check # Pyright +just check # fast, non-mutating handoff checks just docs-build # strict MkDocs build just build # build wheel and source distribution +just package-smoke-test # install and import the built wheel in isolation +just ci # comprehensive local CI equivalent just pre-commit # all push-stage hooks ``` @@ -134,16 +144,15 @@ not installed, run the corresponding `uv run ...` command from the `justfile`. ## Validation before handoff -Choose checks proportional to the change, but for a typical Python change run: +Choose checks proportional to the change. For a typical Python change, run the +non-mutating handoff suite: ```bash -just format -just lint -just type-check -just test +just check ``` Also run `just docs-build` for documentation or public API changes, -`just test-notebooks` for notebook changes, and `just build` for packaging -changes. Report which checks ran and clearly identify any check that could not -be run. +`just test-notebooks` for notebook changes, and `just package-smoke-test` for +packaging changes. Use `just ci` before handing off a broad or high-risk change. +Review the final diff using `CODE_REVIEW.md`, report which checks ran, and +clearly identify any check that could not be run. diff --git a/CODE_REVIEW.md b/CODE_REVIEW.md new file mode 100644 index 0000000..db33deb --- /dev/null +++ b/CODE_REVIEW.md @@ -0,0 +1,59 @@ +# Code Review Guide + +Use this guide for human or agent review of uncommitted changes, commits, and +pull requests. Establish the intended outcome from the request, issue, or work +plan before judging the implementation. + +## Review priorities + +Review in this order: + +1. Correctness and regressions +2. Security, privacy, and unsafe data handling +3. Public API and supported-version compatibility +4. Missing or misleading tests +5. Packaging, documentation, and operational impact +6. Maintainability that materially affects future changes + +Do not spend review attention on formatting that Ruff or another configured +tool handles automatically. + +## Review method + +1. Read the complete diff and inspect relevant surrounding code, not only the + changed lines. +2. Trace important inputs, outputs, error paths, and platform-dependent paths. +3. Compare behavior with tests, documentation, and public API promises. +4. Run the narrowest command that can confirm or refute a suspected problem. +5. Check that generated files, lockfiles, and release-managed files changed only + when the task requires them. +6. Finish with `just check` when proportional to the change, plus the additional + commands required by `AGENTS.md`. + +## Finding quality + +Report only actionable findings caused by the change. Each finding should +include: + +- **Priority:** `P0` critical, `P1` high, `P2` normal, or `P3` low +- **Location:** the smallest useful file and line range +- **Impact:** the concrete failure or risk and who or what it affects +- **Evidence:** the execution path, reproduction, test, or repository fact that + supports the finding +- **Remediation:** a concise direction when the fix is not obvious + +Avoid vague warnings, speculative failures without a reachable path, and style +preferences not enforced by the repository. Group findings that share one root +cause. + +## Review output + +Present findings first, ordered by priority. Then state: + +- assumptions or questions that limit confidence; +- checks run and their results; +- residual risks or coverage gaps. + +If there are no findings, say so explicitly and still report checks and +remaining test or review gaps. A clean review means no actionable issue was +found; it does not claim the change is risk-free. diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..7c53cd3 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,217 @@ +# Collaborative Planning Guide + +This is the repository's reusable planning template for human-agent work. Do +not replace this file with a task-specific plan. When a persisted plan is +useful, copy the appropriate template below to +`plans/-.md`. + +Plans are coordination aids, not fixed contracts. Keep them current when new +evidence changes the scope, approach, or acceptance criteria, and avoid +duplicating status that already has a clear source of truth in an issue or pull +request. + +## Choose the lightest planning level + +| Work type | Planning approach | +| --- | --- | +| Small and well-scoped | State the goal, relevant context, constraints, and what "done" means in the task request. No plan file is needed. | +| Ambiguous or medium-sized | Investigate first, agree on a short plan, then use the **Quick plan** template if the plan must persist. | +| Long-running, high-risk, or multi-session | Copy the **Execution plan** template and maintain decisions, checkpoints, progress, and evidence. | + +## Working agreement + +- The human owns the desired outcome, priorities, product decisions, and final + acceptance. +- The agent owns repository investigation, implementation proposals, scoped + changes, verification, and an evidence-based handoff. +- The agent may proceed with read-only investigation and reversible work that + clearly falls within the agreed scope. +- The agent pauses when a missing decision could materially change the result, + new authority is required, or an action is destructive or externally visible. +- Either collaborator may challenge an assumption. Important decisions belong + in the plan or in an ADR when they are architecturally significant. +- Keep one execution step `in progress` unless independent parallel work is + explicitly planned. Give parallel workers non-overlapping ownership. + +--- + +# Quick plan template + +Use this for bounded work that needs a durable shared plan but not a detailed +execution record. + +## Summary + +| Field | Value | +| --- | --- | +| Work item | [Short descriptive title] | +| Status | `draft` / `approved` / `in progress` / `blocked` / `complete` | +| Human owner | [Name or role] | +| Last updated | [YYYY-MM-DD] | +| Related issue/PR | [Link or `N/A`] | + +## Outcome + +- **Goal:** [Observable result, not implementation details] +- **Done when:** [Acceptance criteria and required evidence] +- **Non-goals:** [Related work deliberately excluded] +- **Constraints:** [Compatibility, safety, performance, or process boundaries] + +## Approach + +[Summarize the intended change and the important trade-off, if any.] + +| Step | Owner | Status | Evidence | +| --- | --- | --- | --- | +| [Investigate or implement a bounded change] | Human / Agent | `not started` | [Finding, diff, or command result] | +| [Validate and review] | Human / Agent | `not started` | [Acceptance evidence] | + +## Questions and decisions + +- **Open:** [Question, owner, and when the answer is needed] +- **Decided:** [Decision and brief rationale] + +## Handoff + +- **Delivered:** [Behavior and files changed] +- **Validation:** `[command]` — [result] +- **Remaining:** [Known limitation, follow-up, or `None`] +- **Human acceptance:** `pending` / `accepted` / `changes requested` + +--- + +# Execution plan template + +Use this for work that spans sessions, carries meaningful risk, or requires +several human-agent checkpoints. Remove prompts and sections that do not apply. + +## Plan summary + +| Field | Value | +| --- | --- | +| Work item | [Short descriptive title] | +| Status | `draft` / `approved` / `in progress` / `blocked` / `complete` | +| Human owner | [Name or role] | +| Agent owner | [Agent/session identifier, if useful] | +| Created | [YYYY-MM-DD] | +| Last updated | [YYYY-MM-DD] | +| Related issue/PR | [Link or `N/A`] | + +## Outcome and scope + +### Goal + +[Describe the user-visible or operational result in one or two sentences.] + +### Success criteria + +- [Observable condition that must be true] +- [Required behavior, compatibility, or quality level] +- [Required verification or review evidence] + +### In scope + +- [Component, behavior, or deliverable] + +### Non-goals + +- [Related work deliberately excluded] +- [Behavior or component that must remain unchanged] + +### Constraints + +- [Compatibility, security, performance, deadline, or dependency constraint] + +## Context and evidence + +[Summarize why the work is needed and link relevant issues, documentation, +code, logs, designs, or previous decisions. Distinguish verified facts from +assumptions.] + +| Assumption | Evidence or reason | Impact if false | Owner to verify | +| --- | --- | --- | --- | +| [Current belief] | [Source or rationale] | [Required plan change] | Human / Agent | + +## Open questions + +Questions that do not block useful investigation may remain open while the +agent gathers evidence. Use `blocking` only when proceeding risks the wrong +outcome. + +| Question | Owner | Needed by | Status or answer | +| --- | --- | --- | --- | +| [Missing decision or information] | Human / Agent | [Step or date] | `open` / `blocking` / [answer] | + +## Proposed approach + +[Describe the intended design and why it is appropriate. Include only +meaningful alternatives and trade-offs.] + +### Expected files or components + +- `[path/to/file]` — [expected change] +- `[path/to/test]` — [expected coverage] +- `[path/to/docs]` — [expected documentation change] + +## Execution + +Use `not started`, `in progress`, `blocked`, `done`, or `dropped`. Every +completed step should leave evidence. + +| Step | Work | Owner | Status | Completion evidence | +| --- | --- | --- | --- | --- | +| 1 | Confirm current behavior and constraints | Agent | `not started` | [Findings or reproduction] | +| 2 | Resolve outcome-changing questions | Human + Agent | `not started` | [Recorded decisions] | +| 3 | Implement the smallest coherent change | Agent | `not started` | [Files or commit] | +| 4 | Add or update tests and documentation | Agent | `not started` | [Tests/docs changed] | +| 5 | Validate and review the diff | Agent | `not started` | [Commands and results] | +| 6 | Review against success criteria | Human | `not started` | [Approval or feedback] | + +## Checkpoints and risks + +Define checkpoints only where human judgment or authorization is genuinely +needed. + +| Trigger | Human decision | Agent action while waiting | +| --- | --- | --- | +| Material design trade-off | Select the preferred outcome | Summarize evidence and recommendation | +| Required work exceeds scope | Approve, defer, or reject expansion | Stop expansion; finish safe in-scope work | +| External or destructive action | Explicitly authorize the exact action | Prepare and validate without executing | +| Final review | Accept or request in-scope changes | Present evidence and remaining risks | + +| Risk | Likelihood/impact | Mitigation or fallback | Owner | +| --- | --- | --- | --- | +| [What could go wrong] | [Low/Medium/High] | [Prevention or recovery] | Human / Agent | + +## Validation + +Map validation directly to the success criteria and `AGENTS.md`. + +- `[focused test command]` — [behavior covered] +- `[lint/type-check command]` — [quality covered] +- `[broader test/build command]` — [integration covered] +- [Manual or environment-specific check] + +Before handoff, confirm: + +- [ ] Every success criterion has evidence. +- [ ] Relevant tests, checks, documentation, and builds pass. +- [ ] The diff contains no unrelated changes or generated artifacts. +- [ ] Known limitations and checks not run are documented. + +## Decisions and progress + +For architecturally significant decisions, create an ADR and link it here. +Keep progress entries brief enough to support resuming work. + +| Date | Type | Update | Owner/next action | +| --- | --- | --- | --- | +| [YYYY-MM-DD] | Decision / Progress | [Decision, evidence, or material change] | [Owner or next step] | + +## Completion and handoff + +- **Delivered:** [Behavior, files, documentation, or migration] +- **Verification:** `[command]` — [result] +- **Remaining work:** [Follow-up, known limitation, or `None`] +- **Human decision:** `pending` / `accepted` / `changes requested` +- **Notes:** [Acceptance notes or requested follow-up] diff --git a/README.md b/README.md index 88bad3e..e6397ac 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,10 @@ The goal is to help you start writing code immediately without having to spend t 1. Rename your package directory `cd src; mv package_name my_package` 1. Update [pyproject.toml](pyproject.toml) with your package name, author, and description. 1. Update all references to package_name in: - - [package_name/tests/](package_name/tests/) + - [tests/](tests/) - [docs/](docs/) - [release-please-config.json](release-please-config.json) - - [GitHub Actions workflow](.github/workflows/ci.yaml) + - [AGENTS.md](AGENTS.md) - This README (including badge links) 1. Update the `"package-name"` field in [release-please-config.json](release-please-config.json) with your package name for automatically bumping the version number in [uv.lock](uv.lock) (see [release-please issue #2561](https://github.com/googleapis/release-please/issues/2561)). 1. Customise this README with a description of your project and planned features. @@ -61,6 +61,7 @@ The goal is to help you start writing code immediately without having to spend t - Citation metadata, automatically updated for each new release: [CITATION.cff](CITATION.cff) - BSD-3-Clause: [LICENSE](LICENSE) - [EditorConfig](https://editorconfig.org/) configuration for consistent coding style across editors: [.editorconfig](.editorconfig) +- Agent collaboration guidance, including repository instructions ([AGENTS.md](AGENTS.md)), tiered planning ([PLAN.md](PLAN.md)), and consistent review criteria ([CODE_REVIEW.md](CODE_REVIEW.md)) ## 📦 Installation @@ -105,13 +106,31 @@ just test # run quick (non-slow) tests just test-notebooks just lint # ruff check just format # ruff format +just format-check # verify formatting without changing files just type-check # pyright type-check +just check # fast, non-mutating handoff checks just docs-serve # live docs just docs-build # build docs +just package-smoke-test # build, install, and import the package in isolation +just ci # comprehensive local CI equivalent just pre-commit # run all pre-commit hooks just clean # remove generated files and folders ``` +## 🤝 Working with coding agents + +- [AGENTS.md](AGENTS.md) gives coding agents durable, repository-specific + conventions and validation expectations. +- [PLAN.md](PLAN.md) explains when to use a prompt, a quick plan, or a detailed + execution plan. Persisted plans are copied into [plans/](plans/), leaving the + reusable template unchanged. +- [CODE_REVIEW.md](CODE_REVIEW.md) defines finding priorities, evidence + requirements, and the expected review output for humans and agents. + +For routine work, start with the goal, relevant context, constraints, and what +must be true when the task is done. Reserve persisted plans and parallel agents +for work whose ambiguity, risk, or duration justifies the extra coordination. + ## 📚 Documentation - Configuration: [mkdocs.yml](mkdocs.yml) @@ -163,6 +182,10 @@ Managed by release-please: ([conventional commits](https://www.conventionalcommi │ └── 002-manage-dependencies-with-uv.md ├── notebooks/ # Jupyter notebooks │ └── example.ipynb +├── scripts/ +│ └── package_smoke_test.py # Clean-wheel package smoke test +├── plans/ +│ └── README.md # Location for task-specific work plans ├── .github/ │ ├── workflows/ │ │ ├── ci.yaml # Lint / test / build @@ -179,6 +202,9 @@ Managed by release-please: ([conventional commits](https://www.conventionalcommi ├── pyproject.toml # Project metadata + dependencies (uv) ├── uv.lock # Locked dependency versions (uv) ├── README.md # Project overview (you are here) +├── AGENTS.md # Durable guidance for coding agents +├── PLAN.md # Human-agent planning guide and templates +├── CODE_REVIEW.md # Shared code-review rubric ├── mkdocs.yml # MkDocs configuration ├── CITATION.cff # Citation metadata ├── LICENSE # License diff --git a/justfile b/justfile index 30f520b..628ff6f 100644 --- a/justfile +++ b/justfile @@ -16,6 +16,14 @@ default: install: uv sync +# Install all dependencies (including dev + docs groups) +install-all: + uv sync --all-groups # include dev + docs groups (matches CI) + +# Install development dependencies (create/update virtualenv) +install-dev: + uv sync --dev + # Update dependencies to latest allowed versions update: uv lock --upgrade @@ -32,6 +40,10 @@ lint: format: uv run ruff format . +# Verify formatting without changing files +format-check: + uv run ruff format --check . + # Type checking (Pyright) type-check: uv run pyright @@ -44,6 +56,9 @@ test: test-vv: uv run pytest -vv -m "not slow" --doctest-modules --doctest-glob="*.py" --maxfail=1 --disable-warnings +# Run the fast, non-mutating handoff checks +check: format-check lint type-check test + # Test notebooks test-notebooks: uv run pytest --nbmake notebooks/ @@ -79,6 +94,13 @@ clean: build: uv build +# Build, install, and import the package in a clean temporary environment +package-smoke-test: + uv run --no-sync python scripts/package_smoke_test.py + +# Run the comprehensive local equivalent of CI (excluding its OS/Python matrix) +ci: pre-commit coverage docs-build package-smoke-test + # Start Jupyter lab from inside a container jupyter-devcontainer: uv run jupyter lab --allow-root --ip 0.0.0.0 --no-browser diff --git a/plans/README.md b/plans/README.md new file mode 100644 index 0000000..5b0dd2b --- /dev/null +++ b/plans/README.md @@ -0,0 +1,15 @@ +# Work plans + +This directory holds task-specific plans copied from the templates in +[`PLAN.md`](../PLAN.md). + +- Use `-.md` when an issue exists, or + `-.md` otherwise. +- Keep the issue or pull request as the source of truth for status when one + exists; the plan should capture implementation decisions and evidence that do + not fit there. +- Update a plan when its scope, approach, decisions, or validation evidence + changes. +- Remove abandoned plans that have no lasting value. Completed plans may remain + when they provide useful implementation history; architectural decisions + belong in `docs/architecture/adr/`. diff --git a/scripts/package_smoke_test.py b/scripts/package_smoke_test.py new file mode 100644 index 0000000..c10fd61 --- /dev/null +++ b/scripts/package_smoke_test.py @@ -0,0 +1,89 @@ +"""Build and import the project package in a clean environment.""" + +from __future__ import annotations + +import os +import subprocess +import tempfile +import tomllib +from pathlib import Path + + +REPOSITORY_ROOT = Path(__file__).resolve().parents[1] + + +def run(command: list[str], *, environment: dict[str, str] | None = None) -> None: + """Run a smoke-test command from the repository root.""" + subprocess.run( + command, + check=True, + cwd=REPOSITORY_ROOT, + env=environment, + ) + + +def package_module_name() -> str: + """Return the importable module configured for the uv build backend.""" + pyproject_path = REPOSITORY_ROOT / "pyproject.toml" + pyproject = tomllib.loads(pyproject_path.read_text(encoding="utf-8")) + module_name = pyproject["tool"]["uv"]["build-backend"]["module-name"] + + if not isinstance(module_name, str) or not module_name: + msg = "[tool.uv.build-backend].module-name must be a non-empty string" + raise ValueError(msg) + + return module_name + + +def main() -> None: + """Build a wheel, install its dependencies, and verify its top-level import.""" + module_name = package_module_name() + + with tempfile.TemporaryDirectory(prefix="package-smoke-") as temporary_dir: + temporary_path = Path(temporary_dir) + distribution_dir = temporary_path / "dist" + virtual_environment = temporary_path / "venv" + + run(["uv", "build", "--out-dir", str(distribution_dir)]) + + wheels = list(distribution_dir.glob("*.whl")) + if len(wheels) != 1: + msg = f"expected one wheel in {distribution_dir}, found {len(wheels)}" + raise RuntimeError(msg) + + run(["uv", "venv", str(virtual_environment)]) + run( + [ + "uv", + "pip", + "install", + "--python", + str(virtual_environment), + str(wheels[0]), + ] + ) + + environment = os.environ.copy() + environment["PACKAGE_SMOKE_MODULE"] = module_name + run( + [ + "uv", + "run", + "--no-project", + "--python", + str(virtual_environment), + "python", + "-c", + ( + "import importlib, os; " + "module = importlib.import_module(" + "os.environ['PACKAGE_SMOKE_MODULE']); " + "print(f'Imported {module.__name__} successfully')" + ), + ], + environment=environment, + ) + + +if __name__ == "__main__": + main() From 2906a877135972243d7e0fe91958ca9dbbe61651 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Jul 2026 11:35:16 +0000 Subject: [PATCH 3/9] docs: include workflows in package rename checklist --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e6397ac..f7ca37d 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ The goal is to help you start writing code immediately without having to spend t 1. Update all references to package_name in: - [tests/](tests/) - [docs/](docs/) + - [.github/workflows/](.github/workflows/) - [release-please-config.json](release-please-config.json) - [AGENTS.md](AGENTS.md) - This README (including badge links) From 56780f9e8f3099d6b2d0400a5ae2f121ec05f6ab Mon Sep 17 00:00:00 2001 From: Gemma Danks <8269577+gemmadanks@users.noreply.github.com> Date: Sat, 18 Jul 2026 12:39:31 +0100 Subject: [PATCH 4/9] fix: update smoke test Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- scripts/package_smoke_test.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/package_smoke_test.py b/scripts/package_smoke_test.py index c10fd61..23f7b6d 100644 --- a/scripts/package_smoke_test.py +++ b/scripts/package_smoke_test.py @@ -52,13 +52,18 @@ def main() -> None: raise RuntimeError(msg) run(["uv", "venv", str(virtual_environment)]) + + python_executable = virtual_environment / ( + "Scripts/python.exe" if os.name == "nt" else "bin/python" + ) + run( [ "uv", "pip", "install", "--python", - str(virtual_environment), + str(python_executable), str(wheels[0]), ] ) @@ -71,7 +76,7 @@ def main() -> None: "run", "--no-project", "--python", - str(virtual_environment), + str(python_executable), "python", "-c", ( From e4b7e3e25544fb9345ecaa14e90c5897013d229e Mon Sep 17 00:00:00 2001 From: Gemma Danks <8269577+gemmadanks@users.noreply.github.com> Date: Sat, 18 Jul 2026 12:44:00 +0100 Subject: [PATCH 5/9] fix: update smoke test Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- scripts/package_smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package_smoke_test.py b/scripts/package_smoke_test.py index 23f7b6d..814830f 100644 --- a/scripts/package_smoke_test.py +++ b/scripts/package_smoke_test.py @@ -51,7 +51,7 @@ def main() -> None: msg = f"expected one wheel in {distribution_dir}, found {len(wheels)}" raise RuntimeError(msg) - run(["uv", "venv", str(virtual_environment)]) +run(["uv", "venv", "--python", sys.executable, str(virtual_environment)]) python_executable = virtual_environment / ( "Scripts/python.exe" if os.name == "nt" else "bin/python" From eca6f76120eaf3497806765fedb754d9554c15b1 Mon Sep 17 00:00:00 2001 From: Gemma Danks <8269577+gemmadanks@users.noreply.github.com> Date: Sat, 18 Jul 2026 12:44:24 +0100 Subject: [PATCH 6/9] fix: edit imports in smoke test Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- scripts/package_smoke_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/package_smoke_test.py b/scripts/package_smoke_test.py index 814830f..c462785 100644 --- a/scripts/package_smoke_test.py +++ b/scripts/package_smoke_test.py @@ -4,6 +4,7 @@ import os import subprocess +import sys import tempfile import tomllib from pathlib import Path From 4d883433b79f0abbe539a3418f63c01a85ac7e19 Mon Sep 17 00:00:00 2001 From: Gemma Danks Date: Sat, 18 Jul 2026 12:46:10 +0100 Subject: [PATCH 7/9] fix: fix smoke test --- scripts/package_smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package_smoke_test.py b/scripts/package_smoke_test.py index c462785..0202d4d 100644 --- a/scripts/package_smoke_test.py +++ b/scripts/package_smoke_test.py @@ -52,7 +52,7 @@ def main() -> None: msg = f"expected one wheel in {distribution_dir}, found {len(wheels)}" raise RuntimeError(msg) -run(["uv", "venv", "--python", sys.executable, str(virtual_environment)]) + run(["uv", "venv", "--python", sys.executable, str(virtual_environment)]) python_executable = virtual_environment / ( "Scripts/python.exe" if os.name == "nt" else "bin/python" From 0862d43d33cef6fdd09dd64665df0a52d811a653 Mon Sep 17 00:00:00 2001 From: Gemma Danks <8269577+gemmadanks@users.noreply.github.com> Date: Sat, 18 Jul 2026 13:29:37 +0100 Subject: [PATCH 8/9] fix: fix smoke test Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- scripts/package_smoke_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/package_smoke_test.py b/scripts/package_smoke_test.py index 0202d4d..8145e4e 100644 --- a/scripts/package_smoke_test.py +++ b/scripts/package_smoke_test.py @@ -70,6 +70,7 @@ def main() -> None: ) environment = os.environ.copy() + environment.pop("PYTHONPATH", None) environment["PACKAGE_SMOKE_MODULE"] = module_name run( [ @@ -88,6 +89,7 @@ def main() -> None: ), ], environment=environment, + cwd=temporary_path, ) From 566403c331ebf1d4a424773280bc14edc6357525 Mon Sep 17 00:00:00 2001 From: Gemma Danks <8269577+gemmadanks@users.noreply.github.com> Date: Sat, 18 Jul 2026 13:29:51 +0100 Subject: [PATCH 9/9] fix: fix smoke test Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- scripts/package_smoke_test.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/package_smoke_test.py b/scripts/package_smoke_test.py index 8145e4e..98a902a 100644 --- a/scripts/package_smoke_test.py +++ b/scripts/package_smoke_test.py @@ -13,12 +13,17 @@ REPOSITORY_ROOT = Path(__file__).resolve().parents[1] -def run(command: list[str], *, environment: dict[str, str] | None = None) -> None: - """Run a smoke-test command from the repository root.""" +def run( + command: list[str], + *, + environment: dict[str, str] | None = None, + cwd: Path | None = None, +) -> None: + """Run a smoke-test command.""" subprocess.run( command, check=True, - cwd=REPOSITORY_ROOT, + cwd=REPOSITORY_ROOT if cwd is None else cwd, env=environment, )