Skip to content

Sample code for: How to Set Up Quality Gates for AI Code in Python - #899

Open
lpozo wants to merge 1 commit into
masterfrom
quality-gates-ai-code
Open

lpozo wants to merge 1 commit into
masterfrom
quality-gates-ai-code

Conversation

@lpozo

@lpozo lpozo commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Where to put new files:

  • New files should go into a top-level subfolder, named after the article slug. For example: my-awesome-article

How to merge your changes:

  1. Make sure the CI code style tests all pass (+ run the automatic code formatter if necessary).
  2. Find an RP Team member on Slack and ask them to review & approve your PR.
  3. Once the PR has one positive ("approved") review, GitHub lets you merge the PR.
  4. 🎉

Code examples for the How to Set Up Quality Gates for AI Code in Python tutorial. Files live in the quality-gates-ai-code/ top-level folder, named after the article slug.

The folder is the tutorial's finished uv project: pyproject.toml and uv.lock with the pinned gate tools, .pre-commit-config.yaml, .github/workflows/ci.yml, .github/CODEOWNERS, scripts/agent_diff_check.py, the fixed src/demo/ai_module.py with its five tests, and the agent's flawed module and tests in examples/.

Notes for review:

  • examples/ holds deliberately broken code (hard-coded token, shell=True, wrong return type). The folder's own pyproject.toml excludes it from Ruff with extend-exclude, so the repo's ruff check and ruff format --check pass.
  • .github/workflows/ci.yml and .github/CODEOWNERS are sample files for readers to copy into their own repository root. GitHub doesn't run workflows or apply CODEOWNERS from a subfolder, so they're inert here.
  • .python-version is matched by the root .gitignore, so it was force-added. The tutorial uses Python 3.13.

Verified locally with uv 0.13.3 from a clean git archive of the branch: uv sync --locked, ruff check, ruff format --check, mypy src tests, bandit, pip-audit on the exported requirements, and pytest (5 passed, 94.44% coverage) all pass, and actionlint reports nothing for ci.yml. The repo's ruff==0.14.1 checks and dircheck.py pass too.

Generated from the tutorial markdown with the post-materials skill, then verified locally before pushing.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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