This is MHoroszowski/python-pptx, a fork of scanny/python-pptx published on PyPI as python-pptx-extended. Commit 253dbc87 on master (PR #30 — transparency & opacity, issue #17) is the canonical example of a feature PR in this repo.
This file documents project rules that apply to every contributor — human or AI — working in this codebase. Claude Code auto-merges it into any session opened in this directory.
Run pip show python-pptx-extended (or python-pptx, depending on what's installed) to see the package location. With an editable install (pip install -e .), that location points at the clone the install was run against — typically THIS directory's src/.
Consequence for git worktree: pytest in a parallel worktree still imports from the original install location, not the worktree's src/. Edits in the worktree are invisible to the test runner. Tests appear to "fail mysteriously" against the new code because the new code never loads.
Two acceptable workflows:
- Single feature at a time: create a feature branch directly in the main checkout. No worktree. Editable install Just Works.
- Parallel checkouts via worktree: every pytest invocation MUST set
PYTHONPATH=src, e.g.PYTHONPATH=src python3 -m pytest tests/ -q. No exceptions.
If you skip this and run plain pytest from a worktree, you will spend hours debugging "test failures" that are actually phantom imports.
This fork's master had a repo-wide ruff format pass (PR #10). Upstream scanny/python-pptx master did not. git cherry-pick of upstream PRs will conflict on whitespace across nearly every touched file. Always manually apply the semantic changes from upstream PRs onto the ruff-formatted base. Reuse the design and tests from upstream; redo the diff against current master.
- Unit tests: new tests in
tests/mirroring source layout. Aim for ≥30 new tests for a meaningful surface (PR #30 added 31 intests/dml/test_transparency.py). - Behave acceptance:
python3 -m behave features/ --no-color 2>&1 | tail -5must show0 failed(current baseline: 981 scenarios). - Pytest:
python3 -m pytest tests/ -qmust show0 failed(current baseline: 3017 passed on master, ef8ee6a8). - Ruff: both
ruff format src tests(no diff or applied cleanly) andruff check src tests(All checks passed).
Run pytest at least once during implementation, not just at the end. TDD ordering is the most reliable way to get there: write the first failing test, run it, see it fail with the expected error, implement, see it pass, then expand. Writing everything before running anything is how subtle indentation bugs and stale-import gotchas turn into hour-long debugging sessions.
- Ruff: install via
pip install ruffif it isn't on PATH already. Locate withwhich ruff. Used for both lint (ruff check) and format (ruff format). - Pytest, behave: invoke as
python3 -m pytest tests/andpython3 -m behave features/. ghCLI: target this fork asMHoroszowski/python-pptx.
Reference git log 253dbc87 --format=%B -n1 for the canonical shape: scope, design notes, test counts, Closes #N (or Refs #N if partial). Long-form, not terse.
git checkout -b feature/<slug>off master- Implement → test → ruff → commit
- Drop a
uat_<slug>.pyat the repo root (untracked) — small Python script that builds a.pptxexercising the new API and prints a round-trip read-back. PR #30 used this for issue #17 review. - The maintainer runs the UAT. Opens the
.pptxin PowerPoint or Keynote, gives signoff. - Then push the branch and open a PR.
Automated runs must not push or open PRs without maintainer approval. The approval-gated UAT step is the rule, not a suggestion.
AI agents may execute the UAT script to verify the script itself is functional, but PASS from the script does NOT constitute signoff. Signoff requires a human opening the generated .pptx in PowerPoint or Keynote and visually confirming behavior. Unless the maintainer has explicitly delegated signoff in a specific case, the agent does not claim UAT acceptance.
Concretely:
- Agents author the UAT script (it's part of the deliverable per §6.3).
- Agents may run the UAT — after the §7 trinity is green — to verify the script doesn't crash, exits non-zero on failure, and actually asserts what it claims to assert. This is QA on the test itself, not acceptance of the feature.
- Agents must not report or imply UAT signoff in commit messages, PR bodies, or summaries. Acceptable: "UAT script runs clean — pending maintainer visual signoff in PowerPoint/Keynote." Not acceptable: "UAT: PASS — round-trip confirmed."
- UAT files should be stored under the
./uatsubdirectory. - The §7 reporting trinity below (pytest + ruff + behave) is the agent's full self-verification surface. UAT execution output may be included as an attachment but it is not the fourth gate.
- Round-trip / behavioral evidence within agent-runnable scope still goes through pytest integration tests that exercise save+reopen. If pytest can fully cover it, the UAT is just a maintainer convenience; if pytest can't, UAT becomes the maintainer's primary acceptance path.
- If unsure whether the maintainer has delegated signoff for a particular case, the agent stops and asks.
Why: the .pptx rendering in PowerPoint or Keynote is the actual acceptance surface — agents can't open it, and a green script exit only proves byte-level round-tripping, not visual correctness. Claiming "UAT PASS" in a summary creates false-confidence pressure to merge; the explicit signoff-vs-execution split removes that pressure.
When an AI agent or automated workflow finishes implementation work in this repo, the wrap-up report MUST include the literal output of:
python3 -m pytest tests/ -q | tail -3
ruff check src tests | tail -3
python3 -m behave features/ --no-color 2>&1 | tail -3
Pasted verbatim. If any shows a failure, the agent stops there and reports verification-failed rather than committing. Self-attestation ("tests pass") without the captured output is not acceptable — too easy to skip the actual run and inherit a false sense of done.
UAT output is NOT part of this trinity. Per §6a, agents do not run the UAT. The maintainer runs it after seeing the trinity is green and reviewing the diff.