Modernize Python template and agent guidance#86
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Python template to a uv_build-based build and a src/ package layout, consolidating tooling configuration into pyproject.toml and aligning local workflows/tests/docs with uv, ruff, ty, and pytest.
Changes:
- Migrate packaging to
uv_buildand adopt asrc/pytemplatelayout with a console script entry point. - Centralize
ruff,pytest(with coverage), andtyconfiguration inpyproject.tomland removeruff.toml. - Update workflows and docs: Makefile targets, Docker command, Sphinx path configuration, and tests.
Reviewed changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Adds/updates locked tool dependencies (ruff/ty/pytest-cov/coverage) and dependency groups. |
pyproject.toml |
Switches build backend to uv_build, defines dependency groups, console script, and tool configs (pytest/ruff/ty). |
src/pytemplate/main.py |
Adds a proper module entry point (main()) and greeting helper. |
src/pytemplate/utils.py |
Minor docstring grammar fix. |
src/pytemplate/__init__.py |
Adds package initializer for src layout. |
tests/test_main.py |
Adds stdout/capsys test for main() and updates imports/docstrings. |
tests/test_utils.py |
Removes unnecessary noqa now that test ignores are configured. |
docs/source/conf.py |
Updates Sphinx import path to include src/. |
Makefile |
Updates targets to use uv sync, ruff, ty, and pytest consistently; adjusts docs generation path. |
Dockerfile |
Runs installed console script (pytemplate) instead of a module file path. |
.gitignore |
Ignores coverage/tool caches and standardizes .venv/. |
README.md |
Updates documentation to reflect src layout, uv workflows, and console entry point. |
ruff.toml |
Removed in favor of pyproject.toml configuration. |
pytemplate/main.py |
Removed old non-src module that printed at import time. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR modernizes the repository’s Python template to a uv_build + src/ layout, consolidating tooling configuration into pyproject.toml and updating docs/workflows to use uv, ruff, ty, pytest, and pip-audit consistently.
Changes:
- Migrates packaging/build to
uv_buildwith asrc/pytemplatelayout and adds a console entry point. - Centralizes
pytest,ruff, andtyconfiguration inpyproject.toml, adds dependency groups, and refreshesuv.lock. - Updates developer experience artifacts (Makefile, Dockerfile, docs config, README) and adds cross-agent guidance (
AGENTS.md).
Reviewed changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Switches build backend to uv_build, defines dependency groups/default groups, and centralizes tool configs (pytest/ruff/ty). |
uv.lock |
Refreshes lockfile and adds dev tooling dependencies (ruff/ty/pytest-cov/pip-audit, etc.). |
src/pytemplate/main.py |
Adds module with hello_world() and main() for console entry point. |
src/pytemplate/utils.py |
Fixes docstring grammar. |
src/pytemplate/__init__.py |
Adds package init file for src/ layout. |
tests/test_main.py |
Updates imports and adds a main() stdout test (but currently has a runtime annotation import issue). |
tests/test_utils.py |
Removes inline ruff ignore now covered by per-file ignores. |
docs/source/conf.py |
Updates Sphinx path injection to include src/ directory. |
README.md |
Updates template guidance and commands for uv/ruff/ty/pytest/pip-audit. |
Makefile |
Aligns common workflows with uv sync, ruff format/check, ty, pytest, and pip-audit. |
Dockerfile |
Runs the console script via uv run pytemplate. |
AGENTS.md |
Adds repository guidance for agents to follow the modern Python workflow. |
.python-version |
Pins local Python version to 3.14. |
.gitignore |
Adds ignores for coverage/caches and standardizes venv ignore to .venv/. |
ruff.toml |
Removes standalone Ruff config in favor of pyproject.toml. |
pytemplate/main.py |
Removes legacy top-level package layout entrypoint file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
uv_build+srclayout with tool configuration centralized inpyproject.tomluv,ruff,ty,pytest,pip-audit, andprek, including stricter template defaults such as docstrings from day one,ruffselect = ["ALL"], and a coverage floorMakefiletargets, and template onboarding guidance to match the new workflow, including runtime-only dependency sync in the container imageAGENTS.mdso skill-aware and non-skill-aware agents follow the same modern Python conventionsuv.lock, add.python-version, and remove the standaloneruff.tomlNotes
tystill emits its upstream Python 3.14 preview warning even though the checks pass