|
|
|
|
|
by aforwardslash
1056 days ago
|
|
Haven't used panther myself, but I've chosen to use other solutions instead of FastAPI because tends to be the usual python soup mess on multi-modular projects. Also, I dislike pydantic quite a lot (I know, it works well for many use cases, its not a bad library), and usually use a three tier (presentation-service-data), DI-driven approach to development, which is largely incompatible with most python framework approaches. So, I've been building pretty much all the required layers on top of some of the Flask functionality for http (mostly the router and the dispatcher). Also, building a framework is also a nice way of understanding how the sausages are made :) |
|
For web I love this approach and have moved more towards this myself.
Pydantic has it's place in my opinion, there are other packages that do a similar thing and for most use cases you can roll your own pretty effectively. For me that place is marshalling on the wire data to a typed custom data type with validation. Whether you are using JSON, or {binary format}.
You likely need to write the validation code yourself since you should be validating from the database as well.
So there we go, I am anti ORM as well.
Anything relates to the request should be handled at the "request layer" which in my case is flask(werkzeus) and maybe per request DB connection should be created at that layer.
Everything else should be in a business layer, that way which framework you use doesn't matter and can be trivially replaced with something else.