CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/python-project-structure

Python project structure — pyproject.toml, src layout, __init__.py, .gitignore, dependency groups, type hints, py.typed, test structure, entry points, ruff/mypy configuration

91

1.03x
Quality

87%

Does it follow best practices?

Impact

99%

1.03x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Build a Notification Microservice with Full Test Coverage

Problem/Feature Description

A SaaS company is adding a notification microservice to their platform. The service receives notification requests via a FastAPI REST API (email, SMS, push) and queues them for delivery. It needs to integrate with external providers (SendGrid for email, Twilio for SMS) but for now the implementations can be stubs.

The team has been burned by untested code before, so they want the project set up with a solid test foundation from day one. They also want proper CI tooling: linting with ruff, type checking with mypy, and test coverage reporting.

Output Specification

Produce a complete project structure with:

  • pyproject.toml -- [build-system], [project] with name/version/requires-python >= 3.11, production dependencies (fastapi, uvicorn, pydantic, pydantic-settings), [project.optional-dependencies] with separate dev group (ruff, mypy) and test group (pytest, pytest-asyncio, pytest-cov, httpx), [tool.ruff] with lint rules, [tool.mypy] with strict = true, [tool.pytest.ini_options] with testpaths and asyncio_mode
  • .gitignore -- .venv/, pycache/, dist/, .env, .coverage, htmlcov/, .mypy_cache/, .ruff_cache/
  • Application package with __init__.py in every directory:
    • main.py -- App factory with router registration and error handlers
    • config.py -- BaseSettings with provider API keys, database URL, environment name
    • models.py -- NotificationType (Literal), NotificationRequest, NotificationStatus, NotificationRecord
    • routes/notifications.py -- POST /notifications, GET /notifications/{id}, GET /notifications (list with filters)
    • db.py -- In-memory storage for notification records
    • services/email.py -- Email provider integration (stub)
    • services/sms.py -- SMS provider integration (stub)
    • errors.py -- Custom exceptions with error handler registration
  • tests/ with:
    • __init__.py
    • conftest.py -- App fixture, async test client fixture, sample notification data fixture
    • test_notifications.py -- Tests for notification endpoints (create, get, list)
    • test_models.py -- Tests for Pydantic model validation

All functions must have type hints. Focus on project structure and test infrastructure.

evals

tile.json