Skip to content

Add sample code for How to Set Up a Python Project for Agentic Coding - #829

Open
realpython-bot wants to merge 1 commit into
masterfrom
python-project-for-agentic-coding
Open

realpython-bot wants to merge 1 commit into
masterfrom
python-project-for-agentic-coding

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Sample code for the tutorial "How to Set Up a Python Project for Agentic Coding" (CMS Post 2244, Trello card 1546).

This fills the Materials PR slot on the card, which was still XXX.

Contents

The finished project from the tutorial, in a uv init --package layout:

File Purpose
pyproject.toml Dependencies plus Ruff, mypy, and pytest configuration
src/ai_agent_project/__init__.py The double() function the tutorial builds
tests/test_main.py The passing test behind the coverage gate
.pre-commit-config.yaml ruff-check, ruff-format, and mypy hooks
AGENTS.md The agent instructions from Step 3
.env.example Placeholder env vars, per the secrets section
README.md Setup and how to run each check

Verification

Run against uv 0.11.26:

  • uv run pytest passes at 100% coverage, clearing the --cov-fail-under=90 gate
  • uv run mypy . is clean under strict = true
  • uv run ruff check . and uv run ruff format --check . are clean
  • uv run pre-commit run --all-files passes all three hooks

Why it is needed now

The article's opt-in (python-project-for-agentic-coding-code) points its download URL at materials/python-project-for-agentic-coding. Until this merges, that URL returns 404 and the article's CMS preflight reports a URLFieldValidationError.

🤖 Generated with Claude Code

Finished project from "How to Set Up a Python Project for Agentic
Coding": a uv package layout wired up with Ruff, mypy in strict mode,
pytest with a 90% coverage gate, and pre-commit hooks.

Verified with uv 0.11.26: pytest passes at 100% coverage, mypy --strict
is clean, ruff check and format are clean, and all three pre-commit
hooks pass on a first commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@acsany acsany left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Verified against uv 0.11.26: pytest passes at 100% coverage clearing the 90% gate, mypy is clean under strict, Ruff check and format are clean, and all three pre-commit hooks pass. Contents match the finished project in the tutorial.

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.

2 participants