Menu

1 / 3

Enforce Your Hexagon in CI: 3 import-linter Contracts for a FastAPI Project

DEV Community: fastapi·Gabriel Anhaia·about 17 hours ago
#iQKBcB4S
#devtofastapi#devto#dev#shop#import
Long article (2432 words) — no AI summary yet.
Reading 0:00
15s threshold

Book: Hexagonal Architecture in Python

Companion code: hexagonal-python-examples — every listing from the book, free on GitHub

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

The line is from sqlalchemy import select , and it sits at the top of shop/orders/domain/order.py . A coding agent put it there while adding a "find orders above a threshold" query to your FastAPI service, because the Order class lived in that file and the import was the shortest path to a working query. The tests stayed green, and a reviewer skimming twelve lines of diff on a Friday approved it.

That one line is where the hexagon starts to dissolve. Your domain now depends on your database library, and the next change will lean on it, because the import is already there.

A folder called domain/ is a convention. Conventions hold while everyone remembers them, and an agent has no memory of the architecture talk you gave last quarter.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.