Curious about this, but not sure I understand exactly what it is for. Could you maybe say what it is an alternative to? For example is it an alternative to using Flask?
i have worked on multiple languages - php, java (spring etc.), ruby (rails), golang (gin), javascript, typescript (nextjs), and many i am forgetting to recall.
FastAPI is the sweetest and the most intuitive web framework.
I just checked a few doc pages for your framework, seems heavily inspired by FastAPI.
So what have you not found in FastAPI that is making you write a new web framework from scratch?
IMO Litestar is even better than FastAPI and its governance structure will better enable a solid foundation to build from. FastAPI a bit all over place and quite minimalist (which is great in some respects). I just prefer that Litestar offers more goodies similar to eg Django in many respects but still much more lightweight. Litestar feels generally more well integrated than FastAPI.
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 :)
> and usually use a three tier (presentation-service-data), DI-driven approach to development...
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.
I forgot to add that most of my "custom" implementations are also open-source, to avoid repeating the same boilerplate over and over at different places. Its not "pythonic", and it is at varying degrees of maturity, and honestly, they are mostly for internal use in my projects (documentation is incomplete, interfaces may change, etc), but if you want have a look:
https://github.com/oddbit-project/rick_db - postgresql query builder & object mapper - it is built around the concept of pure data objects (no indirect references do open resources) that can represent application data between layers; It also features a forward-only migration manager;
https://github.com/oddbit-project/rick - plumbing, validation & assorted logic - provides service locators, registries, containers (including dependency injection); validators, forms & request validation (with support for laravel-style validation chains), and a bunch of other stuff;
https://github.com/oddbit-project/pokie - flask-based web meta-framework, focused on REST api design, that brings components from the other two projects into an modular applicational framework;
You'd need to do a little work have flasks blueprints with prefixes and that makes me feel like this might not scale all that well?
Handling get, post, delete to the same URL is handled by an If statement in the handler function which in a lot of cases would dispatch to another function that handles get requests vs another than handles post requests. It feels weird you have to write this dispatcher.
This is a very minimalistic framework. I feel like the simplicity lends itself to a very small application like a service that just does one very simple thing.
Maybe if you don't already know another framework, e.g. you are a scientist who just wants to put an API on your analysis function, this might be a nice tool.
At the same time it feels like the lack of depth would bite you pretty fast for anything complex.
Are document oriented databases a viable solution for a general purpose web app use case?
E.g. many web apps involve relations (user authored a comment, user liked a blog post) and traversing them (show comments with best score, show all liked posts). Is panther a good tool for developing features like this?
It's been a while since I worked with a document oriented database; perhaps modern releases don't have a problem with this use case?
Of course they’re viable - millions of apps use them. The way you’re using "relations" here is not the same meaning as "relational database". You mean something more akin to "relationships" which you can do in document databases, though they may look different than in an RDBMS.
15 comments
[ 3.0 ms ] story [ 41.3 ms ] threadFastAPI is the sweetest and the most intuitive web framework.
I just checked a few doc pages for your framework, seems heavily inspired by FastAPI.
So what have you not found in FastAPI that is making you write a new web framework from scratch?
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.
https://github.com/oddbit-project/rick_db - postgresql query builder & object mapper - it is built around the concept of pure data objects (no indirect references do open resources) that can represent application data between layers; It also features a forward-only migration manager;
https://github.com/oddbit-project/rick - plumbing, validation & assorted logic - provides service locators, registries, containers (including dependency injection); validators, forms & request validation (with support for laravel-style validation chains), and a bunch of other stuff;
https://github.com/oddbit-project/pokie - flask-based web meta-framework, focused on REST api design, that brings components from the other two projects into an modular applicational framework;
You'd need to do a little work have flasks blueprints with prefixes and that makes me feel like this might not scale all that well?
Handling get, post, delete to the same URL is handled by an If statement in the handler function which in a lot of cases would dispatch to another function that handles get requests vs another than handles post requests. It feels weird you have to write this dispatcher.
This is a very minimalistic framework. I feel like the simplicity lends itself to a very small application like a service that just does one very simple thing.
Maybe if you don't already know another framework, e.g. you are a scientist who just wants to put an API on your analysis function, this might be a nice tool.
At the same time it feels like the lack of depth would bite you pretty fast for anything complex.
Are document oriented databases a viable solution for a general purpose web app use case?
E.g. many web apps involve relations (user authored a comment, user liked a blog post) and traversing them (show comments with best score, show all liked posts). Is panther a good tool for developing features like this?
It's been a while since I worked with a document oriented database; perhaps modern releases don't have a problem with this use case?