Python project structure — pyproject.toml, src layout, __init__.py, .gitignore, dependency groups, type hints, py.typed, test structure, entry points, ruff/mypy configuration
91
87%
Does it follow best practices?
Impact
99%
1.03xAverage score across 5 eval scenarios
Passed
No known issues
A small e-commerce company has a Flask application that started as a quick prototype and grew to over 800 lines in a single app.py file. The file contains everything: route handlers for products, orders, and users, database queries using raw SQL, hardcoded configuration values, and inline error handling. There are no tests.
The team needs help restructuring this into a maintainable project with proper packaging, separated concerns, configuration management, and a test foundation. They also want to add linting and type checking to their CI pipeline.
The application currently handles:
Produce a restructured project with:
pyproject.toml -- with Flask and dependencies, dev/test optional dependency groups, ruff and mypy configuration, requires-python, build-system.gitignore -- proper Python ignores (venv, pycache, .env, dist, coverage)__init__.py in all directories:
main.py -- Flask app factory using create_app() patternconfig.py -- Settings loaded from environment using pydantic-settings (database_url, secret_key, debug)routes/products.py -- Product endpoints using Flask Blueprintroutes/orders.py -- Order endpoints using Flask Blueprintroutes/users.py -- User endpoints using Flask Blueprintdb.py -- Database connection and query helpersmodels.py -- Data models/schemas for Products, Orders, Userserrors.py -- Custom exceptions and error handler registrationtests/ with __init__.py, conftest.py (with app fixture and test client), and at least one test fileAll functions must have type annotations. Do not use setup.py.
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
python-project-structure
verifiers