DEV Community

Cover image for Build a well-structured modern Python app from a template — Part 1: Get started
yuxuzi
yuxuzi

Posted on Originally published at Medium AI-assisted

Build a well-structured modern Python app from a template — Part 1: Get started

This is part 1 of a 5-part series. One part a day, from zero to an app you can hand to an AI agent: get started, configuration and components, finding the best template, creating your own, and hooking up with AI.

You don't need a blank file and a week of decisions to start a Python project. One command gives you a typed, tested, linted project that passes its checks from the first commit. This series walks the ladder in order — and every command in it was run while writing, with pytemplate-uv 3.8.

All you need is uv. Nothing is installed: uvx runs the latest release.

One command, a working project

uvx pytemplate-uv@latest create my-tool -y
Enter fullscreen mode Exit fullscreen mode

That's it. -y accepts the defaults instead of asking. You get:

Created 'python' project at my-tool
Components: cli

Next steps:
  cd my-tool
  uv sync
  uv run ruff check .
  uv run ruff format --check .
  uv run mypy my_tool
  uv run pytest
Enter fullscreen mode Exit fullscreen mode

create used the default python profile: a typed package with a Typer CLI. It comes with ruff, strict mypy, pytest, a GitHub Actions workflow, and an AGENTS.md for coding agents. Run the steps it prints:

cd my-tool
uv sync
uv run ruff check . && uv run ruff format --check .
uv run mypy my_tool
uv run pytest
Enter fullscreen mode Exit fullscreen mode

The result, on a fresh project: All checks passed!, Success: no issues found in 3 source files, and 6 passed in 1.31s. The project is yours from the first commit — commit it, and build on it.

Two things to know. First, without -y, create prompts you and offers the profile's optional components as a multi-select list. Second, if you prefer a real command, uv tool install pytemplate-uv gives you pytemplate — this series uses uvx so nothing is installed.

Tomorrow: Part 2 — Configuration and components

The default is a CLI tool. Tomorrow we make it yours: the three profiles, the eight components — database, auth, worker, container, MCP — and how to configure a render before it writes anything, with a FastAPI service that passes 47 tests out of the box.

Disclosure: written by me, polished with the help of AI.

Top comments (0)